WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
  #1  
Old 12-02-2008, 03:27 PM
shivanangel shivanangel is offline
Member
 
Join Date: Feb 2006
Location: New Jersey
Posts: 182
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)
My problem is that the texture moves just fine, however the alpha does
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
Reply With Quote
  #2  
Old 12-02-2008, 03:38 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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)
Does this script work for you?
Reply With Quote
  #3  
Old 12-02-2008, 04:12 PM
shivanangel shivanangel is offline
Member
 
Join Date: Feb 2006
Location: New Jersey
Posts: 182
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
Reply With Quote
  #4  
Old 12-02-2008, 04:18 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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.
Reply With Quote
  #5  
Old 12-02-2008, 04:29 PM
shivanangel shivanangel is offline
Member
 
Join Date: Feb 2006
Location: New Jersey
Posts: 182
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.
Reply With Quote
  #6  
Old 12-02-2008, 04:52 PM
shivanangel shivanangel is offline
Member
 
Join Date: Feb 2006
Location: New Jersey
Posts: 182
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.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:00 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC