![]() |
|
#1
|
|||
|
|||
![]()
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 |
#2
|
|||
|
|||
Hi,
Looks good. I just realized that the texblend operation is not the same as the blending in the example website you posted. I've attached another example that uses a shader to perform the correct blending. This example assumes the detail texture is gray scale. Let me know if this is better. |
#3
|
|||
|
|||
Error compiling ... ?
Hi,
I tried this just now and I get this error everytime I run it. The Blending looks okay though. I'll play around with it more. I have CG toolkit 1.4.1 installed. ----------------------------------- FRAGMENT glCompileShader "" FAILED FRAGMENT Shader "" infolog: ERROR: 0:6: 'texture2D' : no matching overloaded function found ERROR: 0:6: '=' : cannot convert from 'const float' to '4-component vector of float' ERROR: 0:7: 'texture2D' : no matching overloaded function found ERROR: 0:7: 'assign' : cannot convert from 'float' to 'FragColor 4-component vector of float' ERROR: 4 compilation errors. No code generated. glLinkProgram "" FAILED Program "" infolog: Link failed. All shader objects have not been successfully compiled. ------------------------- |
#4
|
|||
|
|||
Hi,
Sorry about that. Replace the the code in the shader file with the following: Code:
uniform sampler2D BaseTexture; uniform sampler2D DetailTexture; void main (void) { vec4 detailColor = texture2D(DetailTexture, gl_TexCoord[1].xy); gl_FragColor = (texture2D(BaseTexture, gl_TexCoord[0].xy) * detailColor.r) * 2.0; } |
#5
|
|||
|
|||
![]()
Hi,
It works! Have a look at the screenshots attached. The fog is completely gone?!? and the terrain is somehow very-brightly lit!! (perhaps this is caused by uniform intensity command?)In which actually looks nice, I could turn down the spot light color a bit to get the brownish feeling on the planet. I like the result! heaps better than normal blending. Thank you! From high elevation the terrain looks bit funny with tiled detail texture (oh well). From right above the ground... the terrain looks amazing!! What do you think? Regards, Iwan |
#6
|
|||
|
|||
Hi,
I agree, the close-up shot looks really cool! But the tiling is noticeable from far away. The second example you posted would fix the tiling problem, but it might be harder to create the textures for it. The fog is gone because you are using a shader. You will have to implement the fog in the shader. Let me know if you need help with this. The terrain is bright because of the scale applied. In the shader try changing the scale parameter from 2.0 to 1.0. If you end up doing this, then you don't even need the shader anymore, plus the fog will work again. Either way, I just added the ability to set all the texture combine properties from within Vizard. This should be available in the next release. |
#7
|
|||
|
|||
![]()
Hi,
I would definitely need your expertise in this matter, since you solved the shader problem within a couple of minutes while it would probably take me 2 months alone on it. Fog shader would be great, what about fractal animated layered fogs? would this be too much asking for next release??? ...perhaps something like; fog1 = viz.add(viz.fogshader, 'someFractalImage.png') #finite fog shader fog1.size(10,1,10) #fog plane 100 unit square fog1.transform(0,2,0) #putting the fog plane 2 unit up fog1.animate(1,0,0, 4) #animating the fog 4 unit/sec in x direction fog1.intensity(1.5) fog1.amplitude(1.5) # strength of someFractalImageImage.png fog1.color(0.92, 0.92, 0.98) #blue-ish color hmmm... somehow this ideas might go futher to fractal animated cloud plane ![]() I wish you guys all the best in improving vizard. *edited* for incorrect grammar :P Regards, Iwan |
![]() |
|
|