![]() |
#1
|
|||
|
|||
Translating a texture and its Alpha
Hello,
I had a question on how Vizard handles alpha maps when imported from files. I've got a scene with lava spewing forth and in order to make it look like it is moving I used the tutorial for transforming a texture across an object: Code:
import viz viz.go() #Load the Skull graphics skull = viz.add('SkullGraphics/Skull.IVE') leftEyeLava = viz.add('SkullGraphics/LeftEyeLave.IVE') rightEyeLava = viz.add('SkullGraphics/RightEyeLave.IVE') mouthLava = viz.add('SkullGraphics/MouthLava.IVE') leftEyeLava_Tex = viz.addTexture('images/LavaFlow_01.tga') leftEyeLava_Tex.wrap(viz.WRAP_S,viz.REPEAT) leftEyeLava_Tex.wrap(viz.WRAP_T,viz.REPEAT) rightEyeLava_Tex = viz.addTexture('images/LavaFlow_01.tga') rightEyeLava_Tex.wrap(viz.WRAP_S,viz.REPEAT) rightEyeLava_Tex.wrap(viz.WRAP_T,viz.REPEAT) mouthLava_Tex = viz.addTexture('images/LavaFlow_01.tga') mouthLava_Tex.wrap(viz.WRAP_S,viz.REPEAT) mouthLava_Tex.wrap(viz.WRAP_T,viz.REPEAT) lLavaIter = 0.0 rLaveIter = 0.0 mLaveIter = 0.0 def onTimer(num): global lLavaIter global rLaveIter global mLaveIter #Get the textures matrix leftEyeLava_Tex_Matrix = vizmat.Transform() #Move the matrix forward leftEyeLava_Tex_Matrix.setTrans([0,lLavaIter,1]) #Set the textures matrix leftEyeLava.texmat(leftEyeLava_Tex_Matrix,'',0,False,viz.OP_OVERRIDE) lLavaIter += 0.1 viz.callback(viz.TIMER_EVENT,onTimer) viz.starttimer(0,0.11,viz.FOREVER) not move with the texture as well. I am using a TGA file that I made in photoshop with an alpha imbeded which has a bunch of 'holes'. My hope was that these holes would move with the texture to give the appearance of hot lava pouring forth. Right now I've only got the lava moving but the alpha stays static. Is there a simple fix to this, or do I need to apply my own custom alpha channel and move that as well as the texture? Thanks, George |
#2
|
|||
|
|||
I can't reproduce this. I tried the following test script and the alpha properly animates with the texture:
Code:
import viz import vizact viz.go() #Add textured quad tex = viz.add('dot.tif',wrap=viz.REPEAT) quad = viz.addTexQuad(pos=(0,1.8,2),texture=tex) #Add environment viz.add('gallery.ive') #Update texture matrix of quad every frame def UpdateTextureMatrix(): quad.texmat( viz.Matrix.translate(0,viz.getFrameTime(),0) ) vizact.ontimer(0,UpdateTextureMatrix) |
#3
|
|||
|
|||
Yes it does work.
Here is my problem. As you can see it is moving on the right side (not easy to see but the reds and yellows are moving along), but the alpha is not. Curious. ![]() ![]() Thanks for the help so far. ~George |
#4
|
|||
|
|||
This may sound stupid, but are you sure the textures have an alpha map and it's not just the mesh that has holes in it? If you can send your files and sample script to lashkari@worldviz.com I can take a better look at it.
|
#5
|
|||
|
|||
Well the reason is stupid but not because I don't know how to model. Actually, making holes in a mesh would probably mean I did know how to
model, but that is beside the point. Reviewing the files I was about to send you I noticed that my zip was a HUGE 29 megs. Looks like I may have forgotten to down-convert the original 2048x2048 to a 512x512 sized file in photoshop for the lava texture. I'm gonna see if maybe that is the source of the problem. I am familiar with Vizard not liking large textures, so maybe this is just a similar problem? I'll let you know if it fixes it. Thanks for the time, once again I feel like an idiot. George L. |
#6
|
|||
|
|||
I tracked down the problem to trying to override the texture inside the IVE file.
I already had the image applied with the alpha in MAX. When I went to reapply it in Vizard it did so to the texture but not the alpha. However, when I added a flat material with no texture I lost my UV coords of the object. To FIX everything, all I did was remove my alpha parameters inside of MAX and then exported to IVE. After that I applied my texture with the alpha and now the alpha moves with the texture. Thanks for the help, I couldn't of fixed this without the troubleshooting, George L. |
![]() |
Thread Tools | |
Display Modes | Rate This Thread |
|
|