WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #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, 2824 views)
Reply With Quote
 


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 10:50 PM.


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