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

I'm not sure what you mean by "overlay". The examples you pointed to apply multiple textures to a mesh and blend them together. This technique is possible within Vizard. To apply multitple textures on a node just do the following:
Code:
node.texture(tex1,'',0) #Apply to texture unit 0 (default)
node.texture(tex2,'',1) #Apply to texture unit 1
In the examples they use different texture coordinates per unit. You either need to set these in your modelling program and make sure they are exported, or you can use a texture matrix to change the coordinates of a unit. In the examples you gave, they simply have the detailed textures repeat over the surface, so create a texture matrix that scales the texture coordinates:
Code:
m = viz.Transform.scale(20,20,1)
node.texmat(m,'',1) #Scale texture coordinates of unit 1 (detail texture)
For this to work you need to make sure that your detail texture is in repeat mode:
Code:
tex.wrap(viz.WRAP_S,viz.REPEAT)
tex.wrap(viz.WRAP_T,viz.REPEAT)
To blend the textures you can use the following example:
Code:
node.texblend(0.5,'',1) #Blend texture 1 50% with texture 0
I believe this is similar to what the first example does. The second example is a little more tricky. It would be easier to implement in a shader. If you don't have a card that supports shaders then I could create a simple plugin that implements that behaviour.

Hope this helps.
Reply With Quote