|
#1
|
|||
|
|||
Multi-Texturing...
Hi,
Is it possible to do multi texturing in Vizard, not as in blend-mode, but as overlay? I have attached 2 sites which captures exactly what I have in mind. Multi Texturing in openGL; http://www.kraftwrk.com/multi_texturing.htm http://www.cs.auckland.ac.nz/~jvan00.../multitex.html I hope that I posted this in the right forum. Kind Regards, Iwan |
#2
|
|||
|
|||
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 Code:
m = viz.Transform.scale(20,20,1) node.texmat(m,'',1) #Scale texture coordinates of unit 1 (detail texture) Code:
tex.wrap(viz.WRAP_S,viz.REPEAT) tex.wrap(viz.WRAP_T,viz.REPEAT) Code:
node.texblend(0.5,'',1) #Blend texture 1 50% with texture 0 Hope this helps. |
#3
|
|||
|
|||
tiling doesn't work?!? could be a mistake from my end
Hi,
Firstly, thanks for the reply. In order to attempt this blend-multi texture, I created a model out of Candor Canyon on mars, and I textured it. The blending does work, but the repeating texture does not. for the detail texture I used a 64 x 64 image. I was hoping this small texture would repeat itself over large terrain. There are 2 screenshot attached; no_detail.jpg - plain texture.. no additional texture applied not_tiled.jpg - I could see here that my 64 x 64 texture is fully streched across the terrain. the terrain has only 1 UV map applied to it. I attached my script, I couldn't figure out what did I do wrong??? could you have aa look and see why I couldn't repeat my small texture across the terrain? #--------------------------------------------------------------------- import viz viz.go() viz.enable(viz.CULL_FACE) viz.enable(viz.CULLING) #loading textures tex1 = viz.add('texModified.jpg') tex2 = viz.add('detail.jpg') tex2.wrap(viz.WRAP_S,viz.REPEAT) tex2.wrap(viz.WRAP_T,viz.REPEAT) #loading the objects stage = viz.add('output.osg') stage.enable(viz.CULL_FACE) stage.enable(viz.CULLING) stage.texture(tex1,'',0) #Apply to texture unit 0 (default) stage.texture(tex2,'',1) #Apply to texture unit 1 stage.texblend(0.8,'',1) #Blend texture 1 50% with texture 0 #loading the skybox env = viz.add(viz.ENVIRONMENT_MAP,'mars_sky\mars_sky.jpg ') sky = viz.add('skydome.dlc') sky.texture(env) #--------------------------------------------------------------------- Thanks for your help! Have a great day. Regards, Iwan |
#4
|
|||
|
|||
Hi,
The texture coordinates were probably not exported for the second texture unit. Try setting the texture matrix like I mentioned in my previous post. Code:
m = viz.Transform.scale(20,20,1) #Repeat 20 times in both directions stage.texmat(m,'',1) |
#5
|
|||
|
|||
Hi,
I just double checked to make sure this works and was able to create this sample script. Code:
import viz viz.go() #Create quad and place it in front of user quad = viz.add(viz.TEXQUAD,pos = (0,1.8,3)) #Add main texture tex1 = viz.add('ball.jpg') #Add detail texture in repeat mode tex2 = viz.add('gb_noise.jpg',wrap=viz.REPEAT) #Apply textures to quad quad.texture(tex1) quad.texture(tex2,unit=1) #Blend textures 50% quad.texblend(0.5,unit=1) #Repeat detail texture 20 times quad.texmat(viz.Transform.scale(20,20,1),unit=1) |
#6
|
|||
|
|||
VR Mars exploration has just started on Vizard!!!
Hi,
Thank you for your speedy response. It didn't work initially because I missed 2 lines!!! Thanks for pointing this one out to me. Please look at the screenshots attached, the detail looks great. Detail texture may look bit repetitive for now, but it will change soon! I attached my script with some changes in it, I had to bring the blend value to 0.065 to get the result that I wanted. #----------------------------------------------------- viz.go() #loading textures tex1 = viz.add('texModified.jpg') tex2 = viz.add('detail.jpg') tex2.wrap(viz.WRAP_S,viz.REPEAT) tex2.wrap(viz.WRAP_T,viz.REPEAT) #loading the objects stage = viz.add('output.osg') stage.enable(viz.CULL_FACE) stage.enable(viz.CULLING) stage.texture(tex1,'',0) #Apply to texture unit 0 (default) stage.texture(tex2,'',1) #Apply to texture unit 1 stage.texblend(0.065,'',1) #Blend texture 1 0.065% with texture 0 m = viz.Transform.scale(5000,5000,1) #Repeat 5000 times in both directions stage.texmat(m,'',1) #loading the skybox env = viz.add(viz.ENVIRONMENT_MAP,'mars_sky\mars_sky.jpg ') sky = viz.add('skydome.dlc') sky.texture(env) #disabling head-light viz.disable(viz.LIGHT0) #------------------------------------------------------------------- Thank you for your assistance! have a great day. Regards, Iwan |
|
|