Skin 3D cube with OGV video


#1

I am trying to “map” or “skin” a 3D object, a cube.obj, with an OGV video. I have used the code below given as an example in the Z.VideoTexture documentation. I changed the first variable to the name of my OGV video, and no problems there. But the problem comes in the second line, var myplane = Z.Object(“plane.aro”); I change “plane” to “cube” (the name of my 3D object, my .obj file, and I get an error message “expected 0 arguments and found 1”

below is the complete code from documentation:
VideoTexture_Example

I am not a “coder” and am really bad at the scripting stuff…I don’t even know what an argument is (I looked it up and got the definition, but am no closer to understanding). And honestly, I have tried to learn this stuff, but it seems my brain is just not wired for it.

I have looked at the Z.Object documentation to try to understand the .aro convention in the “plane.aro” variable. From the documentation I see that a Z.Object node is just an instance of any renderable 3D object, which would make my .obj cube an “instance” or a Z.Object. At least that’s how I took it. And the documentation goes on to say that ARO Simple (Zappar’s simple proprietary format).

Okay, so from that I assumed that my cube will then need that .aro at the end, such as cube.aro. Of course that didn’t work, so I tried cube.obj and tried just cube and nothing seems to work. Still get the “expected 0 arguments and found 1”

—So, can anyone tell me what the secret sauce is that I need to “skin” my 3D cube with my very very tiny 128px by 128px .ogv video?

—Also, by using the example code above appended with my object and video names, will the video play/start on “show?”

—Or does that need to be set up in the “Show” script, which I have already done and amazingly it worked! Of course I just had audio and ogv video play upon “show” on a flat plane, not on a 3D object or in conjunction with a “trained” image, neither of which works for me. I can’t even get past the scripting problems with the 3D object to see if the video will even play if I did get it mapped to the cube.

Thanks for reading all this and any help you may offer,

Lonnie


#2

This should help you out. You don’t really need to do any coding expect for the Play part.

Enjoy
Steve

Tracking Image Used:


3D cube with video.zpp (4.2 MB)


#3

Hi Steve, thanks for the quick reply! However, I don’t see any video. I previewed the file but still see no video, so maybe I’m missing something. Or maybe I didn’t make myself clear. I am trying to put OGG video “onto” the 3D cube. Right now the cube in your file is just black, and it is black when I preview. I don’t see any video media in the file either.

I’m sorry, but I’m not sure I understand.

Steve, I have attached my working file. I am hesitant to do this as it may be confusing because my video is on a regular plane, but if you preview it, even on a plane the video won’t play because it is related to the “trained” image. So it won’t work in 3D. But ultimately, I want that video to be mapped to a 3D cube, or any 3D object, not a plane. So the issue is actually two-fold: First, I need to get the video mapped to a 3D object, then Second, I need the video to play on the 3D object, and I can’t get to the second issue without first solving the first issue!

Oh, if you pull the “Video Plane with video-Material” out from under the trained image, then the video should play if you preview it. Just thought I’d add that so you can see the video play.

I hope this all makes sense.

test OGV.zpp (3.5 MB)

Best
Lonnie


#4

Ok?
Your testing it on a device not the pc right?
You will not see the video playing in zapworks.

I know the video takes a min to start playing on the cube. It will play on each side. Also make sure your using my tracking image in the post. (Point your device at it :wink:)

If you go into the block model you can add your video and change the videotexture to yours.

Steve

Ps.
I’m going out of town if I can I’ll take a look at it tomorrow.


#5

Yes, I scanned your tracking image in the post with my iPhone first, but the zappar scan symbol just keeps scanning and never unlocks the experience. Not sure why.

But in the zpp file, when i go into the “block” object, I only see a texture for a minecraft–stone.jpg, not a video.

I’m sorry if I am not understanding, but I am going to go back and inspect closer. I am very new to Zapworks. This is what I am seeing in the “block” properties.

Thanks for you help!
Best


#6

At quick rest stop. Spinning and not unlocking usually means an error in the coding.
I’ll have to look at later.
As for your photo that is the properties of the model. You can double click on the name and it will open up some more settings that are inside that model. That is where I have the video settings set.

Steve


#7

Okay, now I see that! Cool. I’ll have a play around with that and see if I can make it work for me. I’ve not seen things hidden in the object before. Can I set this up by just adding the Video Texture in the root? I’m not sure how you “hid” the textures in the model. But I’m excited about this!

Thanks, Steve!

best
Lonnie


#8

I really appreciate all your help, Steve, but I still can’t get video to play, but was able to exchange my video for yours. But now I see that this is a .pod format, and that must be why the Mat is hidden within the object, due to the PVGeoPOD export function. I do not have that ability as yet.

My fault, I should have been more specific about the type of 3D object I am working with.

I guess I was hoping I could do this with a .obj file that I export from Cinema4D. Not really wanting to add more software to do this at this point. Anyone have any idea how I can map a video .ogv file to a standard.obj 3D object?

Best


#9

Okay, Steve, so upon further playing with this I see it is not just a POD thing. And I have my video on an .obj object from C4D, so far so good. Getting ready to see if I can make the video play now. Will check back with new update!

Okay, finally got the video to play on a 3D object!!! But, the orientation is all messed up. Back to the drawing board!

So, the orientation issue persists and I think it is because we are calling the video to play with the script within the object, so there is nothing there to orient the object. But I am just guessing!!! When I played your cube, Steve, the video never played but the black cube kept sticking to the edges of my iPhone screen. Even though my video is playing, my 3D object is also sticking to the edges of the iPhone so I can’t orient the object to see the video completely. aaagghhhh! There must be a simpler way to do this.

Best with your travels!


#10

You know I was just thinking if you are just wanting a cube you can use 6 plains and line them up to make a cube.

Steve.


#11

Yes, Steve, that is cool thinking and definitely outside the box ( a little pun) but I need the flexibility to map it to any 3D object. Like right now I have my video mapped to a sphere. And the video plays. Now the problem is to make it functional, in other words, to be able to control the sphere (or any object) so that it appears correctly and calmly in the experience, not some crazy jumping around blob. I know it is possible because it is outlined in the Zapworks documentation. I just can’t get the scripting correct so that the video will map to a 3D object and play. That is truly what I need help with. So if anyone understands the documentation and how to implement it, it would be greatly appreciated!

I also appreciate the help you’ve given me, Steve, as I learned an aspect of Zapworks that I had no prior knowledge of, that there is more parameters within an object. I just wish I could use what you showed me and then be able to control the object in the experience. But I would really appreciate anyone who could help me understand the documentation on applying .ogv video to a 3D object as I stated in my initial post, especially the scripting part!

thanks!


#12

No problem glad to help when I can.
I would go thru the videos zappar has. Most are on YouTube. It will give you a good basic idea of zapworks.

As for your project maybe a more detailed explanation of what your end point project is will help us get you there faster.

Steve


#13

Hey @airbusch,

If your model is displaying relative to your screen, it’s worth placing your model on a target (with image- or world tracking) so that you can view your model in 3D space.

When using video as a 3D model’s texture it’s important to note that for the video to map accurately, it needs to have been created in a way that matches the 3D model’s UV layout.

For example, if a cube was UV unwrapped as in the image below, where each square represents a face on the cube, then the video would need to match that layout.

image

Hope this helps.

All the best,
Seb


#14

Thanks, Seb. Actually, I am using a tracking image, (see my posted file on my first reply to “stevesanerd”) and the UV layout really isn’t the problem. In my original post (if you go back and check that) you’ll see I was seeking help with the coding from Zapworks documentation that no longer seems to work. (There is a screenshot showing the error) and I included the error message in the post.

I don’t know much about all this, but it seems to me that the problem is coming from where the “play” function is being called. Because I am mapping the video within the 3D object parameters, (the way stevesanerd showed me in his post) instead of the parent parameters, I think the “object” parameters are not “seeing” the “tracking image” but you would know more about that.

At this point I want to get back to my original post as this whole thing has seemed to drift off task. When I first tried to map a video to a 3D object, I went to the Zapworks documentation on mapping video to 3D objects, so that I could map the video directly in the parent hierarchy instead of the object hierarchy, and I referenced the script from the documentation that seems to allow for mapping in the parent hierarchy so that the whole experience is in the parent hierarchy.

If for a moment you recall how 3D objects animation is setup, the animation lives in the object parameters, but the animation has to be linked into the parent hierarchy. I think there is a similar issue here, but there is no way to link the “play/animation” parameter of the video in the 3D object parameters to the parent node that I know of.

Anyway, please have a look at your documentation that I reference in my original post so you know what I am trying to do, which is just map video to a 3D object and get it to play. Nothing more. You have it all right there in your documentation, it’s just that the coding seems to be a problem, as I keep getting the error, “expected 0 arguments but found 1”.

Hope this makes sense.

Best


#15

I am just now having a min to look at your code and last post. Your first post about z.videoTexture is how you can use it but 3d models are treated as sub symbols. You can not set the z.videoTexture from the parent hierarchy out right. That’s why in my test block code I have the video inside the 3d model.
This is what you should have seen with my test code.

Now in your code you posted you have the video stating when the tracking image is seen. I have found this may not work right (for me) at times.
To call the play from inside the 3d model you will need to set up an export function you can call from the parent. (like the animation you posted about) The function will then play the videos.

Sebs post about the uv layout is how the model will place the video on the model when playing it. that’s why in my demo the videos may be flipped on one side.

Just checking do you want the video to only be on one part or side of the 3d model? or like my video on each?

Steve


#16

Okay, Steve, now that is exactly what I am looking for! Can you post the file that you zapped from so I can check out the code and get this to work! As far as the UV mapping, I’m not concerned about that. I do lots of UV mapping in Cinema 4D. I just need the scripting to get this to work.

Thanks!


#17

So the video is from the code I posted before. But I made a new one for you :smile:
In this code I have Start, Pause and Restart buttons. I also have it set to emit video:playing, video:paused, video:restart and video:finish.

Here is the code:
3D cube with video Ver2.zpp (5.2 MB)

I’m using the same tracking image from before.

I uploaded it to one of my test codes.

Here is a video demo of it.

Enjoy

Steve


#18

Awesome, Steve!! Thanks so much for taking the time to do this!!

All the best!


#19

Your welcome. I hope it works for you.

Steve