View Single Post
  #2  
Old 04-06-2006, 11:29 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

I've attached a sample script that shows how to move a texture across a surface:
Code:
import viz
viz.go()

viz.clearcolor(viz.SKYBLUE)

#Create a quad to display texture
quad = viz.add(viz.TEXQUAD)
quad.translate(0,1.8,3)

CLOUD_SPEED = 0.1

#Create texture with repeating wrap mode
tex = viz.add('ball.jpg')
tex.wrap(viz.WRAP_S,viz.REPEAT)
tex.wrap(viz.WRAP_T,viz.REPEAT)
tex.pos = 0

#Apply texture to quad
quad.texture(tex)

def ontimer(num):
	#Increment texture position
	tex.pos += CLOUD_SPEED * viz.elapsed()
	
	#Create transform for texture
	mat = viz.Transform()
	mat.setTrans(tex.pos,0,0)
	
	#Apply transform to texture
	quad.texmat(mat)

viz.callback(viz.TIMER_EVENT,ontimer)
viz.starttimer(0,0,viz.FOREVER)
There is no built-in command to set a transparent color on a texture. You can set the transparent level on an object though. If you want only a certain color to be transparent then you will have to use a shader or simply edit the image with a program like Photoshop and save it to a format that supports transparency (png,tiff,etc..).

Also, I've attached a sample script that uses shaders to creating a moving sky with two cloud layers. I think it might be usefull for you.
Attached Files
File Type: zip SkyTexture.zip (167.7 KB, 1241 views)
Reply With Quote