Previous topicNext topic

animated texture map on 3d model

Questions, comments, feedback, etc.
Post Reply
hazardman
Posts: 74
Joined: Sat Nov 08, 2014 1:33 am

animated texture map on 3d model

Post by hazardman »

i need--err, like to-- use an animated texture on a 3d model...

i'm currently using 3D max and exporting as either *.obj or *.3ds but the "animated" texture does not appear on the model in magic...

...i also tried to used an animated gif and that too does not playback the frames...

is this supported?...if not, is it something that can implemented?..
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: animated texture map on 3d model

Post by Magic »

That feature isn't supported right now unfortunately. But we can definitely look into adding it.
hazardman
Posts: 74
Joined: Sat Nov 08, 2014 1:33 am

Re: animated texture map on 3d model

Post by hazardman »

:)
Syd
Posts: 60
Joined: Thu Oct 16, 2014 10:32 am

Re: animated texture map on 3d model

Post by Syd »

while you cant do proper animated textures atm, one trick I use sometimes for a similar effect is chaining up inverts like so:

http://i.imgur.com/ujfr31l.png
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: animated texture map on 3d model

Post by Magic »

Thanks Syd, that's a cool idea.

A similar and perhaps more efficient strategy could be to use an alpha mask: http://magicmusicvisuals.com/forums/vie ... ?f=3&t=146. Instead of using an image as the first input in that example, you could use a model.

You'd get the same effect of a video texture projected onto the model, but using less modules and therefore retaining a higher frame rate.
Syd
Posts: 60
Joined: Thu Oct 16, 2014 10:32 am

Re: animated texture map on 3d model

Post by Syd »

that's a neat idea!

I started using the invert chains before the shader module had inputs and never really thought about changing it up.
hazardman
Posts: 74
Joined: Sat Nov 08, 2014 1:33 am

Re: animated texture map on 3d model

Post by hazardman »

so close!...unfortunately using the invert and/or GLSL alpha mask "converts" the 3D model into a different class object (?) that is now simply 2D...as such, it will no longer interact and/or be able to intersect with any other 3D model...

what i'm trying to do is have a tv play back videos on the screen while the tv gets rotated/translated as per input...

when i use the GLSL alpha trick to the screen (which i inserted as a separate model than the rest of the tv) and rotate the tv and the screen, the screen will always be in front of the tv as per the draw order set by the spout input connection...if i change the input order, the tv body will obscure the screen...

still, using a 3D model as part of the GLSL alpha trick may prove to provide some other interesting visuals ;)

here's a screen cap of my experiment thus far...
tv_test.jpg
tv_test.jpg (184.35 KiB) Viewed 10708 times
Syd
Posts: 60
Joined: Thu Oct 16, 2014 10:32 am

Re: animated texture map on 3d model

Post by Syd »

hrm, tricky one. Tried experimenting w/ alpha with ramp+threshold on the video?

edit: you can't use alpha on a video it seems, brightness perhaps then?
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: animated texture map on 3d model

Post by Magic »

so close!...unfortunately using the invert and/or GLSL alpha mask "converts" the 3D model into a different class object (?) that is now simply 2D...as such, it will no longer interact and/or be able to intersect with any other 3D model...
That's true. Invert and Alpha Mask are 2D effects, so if you have a 3D model as input to one of them, the model will be "rendered" into an image first, and you'll lose the depth.
what i'm trying to do is have a tv play back videos on the screen while the tv gets rotated/translated as per input...

when i use the GLSL alpha trick to the screen (which i inserted as a separate model than the rest of the tv) and rotate the tv and the screen, the screen will always be in front of the tv as per the draw order set by the spout input connection...if i change the input order, the tv body will obscure the screen...
Ahh, gotcha. You can do that pretty easily if you use a DepthTest module. It controls whether or not things should intersect and/or obscure each other in 3D space. Like this:
DepthTest.png
DepthTest.png (56.66 KiB) Viewed 11015 times
DepthTest2.png
DepthTest2.png (32.97 KiB) Viewed 11015 times
In the second screenshot, you can see the video is in front of the cube. But what you don't see is that when the cube rotates around 180 degrees, the video will be behind it. Which is exactly what you're looking for, I think :). It maintains its position relative to the cube, as it would in "reality".

Sorry I don't have time to do a video example right now, but hopefully that will help. Also you should look at the sample project called "DepthTestExample.magic". Try bypassing the DepthTest module to see how it affects the scene.

Basically what DepthTest does is it groups all of its inputs into one 3D region, so they will interact with each other properly if they're in the same (x,y,z) location. Otherwise everything in Magic is done with layers (http://magicmusicvisuals.com/downloads/ ... ingModules), more like Photoshop, and they don't intersect even if they're in the same position.
edit: you can't use alpha on a video it seems
Actually you can, but Magic uses premultiplied alpha (which some people also call "additive blending"). So you have to set both the brightness and the alpha to get a transparent effect. See this tutorial: http://magicmusicvisuals.com/forums/vie ... p?f=3&t=28
hazardman
Posts: 74
Joined: Sat Nov 08, 2014 1:33 am

Re: animated texture map on 3d model

Post by hazardman »

eric, even closer!...the DepthTest works if you simply use a video...
video_only.jpg
video_only.jpg (144.54 KiB) Viewed 10995 times
however, using the GLSL AlphaMask (to get the specific shape of the screen) is not elevating the object to the same 3D region...perhaps this is a limitation of the shader?...
GLSL_version.jpg
GLSL_version.jpg (137.69 KiB) Viewed 10995 times
i suppose what i could do is render the video i want on the screen with an embed alpha channel (to cut out the tv bezel shape) and then directly use that video without the need for the GLSL pipeline --sweet! ;)

thanks for all the ideas everyone...
Syd
Posts: 60
Joined: Thu Oct 16, 2014 10:32 am

Re: animated texture map on 3d model

Post by Syd »

I found the same thing with depth testing the shader output. I came to the same conclusion as you :)

one way that might be easier than editing all the source videos is playing it with something else, applying the mask to the composition, then bringing it into magic with spout/syphon and using the same solution you came up with.
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: animated texture map on 3d model

Post by Magic »

however, using the GLSL AlphaMask (to get the specific shape of the screen) is not elevating the object to the same 3D region...perhaps this is a limitation of the shader?...
Hmm, you're right! I think this is a bug actually. I'll see what I can do.
BaconMKII
Posts: 36
Joined: Mon Jun 02, 2014 8:31 pm

Re: animated texture map on 3d model

Post by BaconMKII »

Syd wrote: one way that might be easier than editing all the source videos is playing it with something else, applying the mask to the composition, then bringing it into magic with spout/syphon and using the same solution you came up with.
You may be able to do this with unity via spout 2
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: animated texture map on 3d model

Post by Magic »

Eric wrote:
however, using the GLSL AlphaMask (to get the specific shape of the screen) is not elevating the object to the same 3D region...perhaps this is a limitation of the shader?...
Hmm, you're right! I think this is a bug actually. I'll see what I can do.
I think I've fixed this in v1.53 (beta). Just make sure the Model module is the bottom input to the Depth Test module, so the video will be rendered on top, as shown in the images below.

Notice the difference in rotation angle, so you can see how the video is obscured by the cube when it's on the back side.
rotate1.jpg
rotate1.jpg (69.71 KiB) Viewed 10603 times
rotate2.jpg
rotate2.jpg (66.94 KiB) Viewed 10603 times
Post Reply