Osg Geometry clamped to terrain #2175
Unanswered
marcoma9023
asked this question in
Support Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I need to create an object that is composed of multiple geometries with their textures.
Then, I defined osg::geometry and applied texture coordinates and texture.
All running well....
I used DrapeableNode as father node.
I used then the following fragment shader to apply color to the texture....
const char* imageOutFS =
"#version " GLSL_VERSION_STR "\n"
"in vec2 oe_ImageOverlay_texcoord; \n"
"uniform sampler2D oe_ImageOverlay_tex; \n"
"uniform float oe_ImageOverlay_alpha; \n"
"uniform float time; \n"
"uniform vec3 sweepColor; \n"
"void oe_Output_FS(inout vec4 color) { \n"
"vec4 texcolor = texture(oe_ImageOverlay_tex, oe_ImageOverlay_texcoord); \n"
" color = texture2D(oe_ImageOverlay_tex, oe_ImageOverlay_texcoord);\n"
" color.a = color.a - clamp(time,0.0,1.0); \n"
" color.rgb = sweepColor; \n"
" gl_FragColor = color; \n"
"} \n";
Ok, the problem is related to the DrapeableNode:
If I put setDrapingEnabled=true , I have the perfect behaviour in which the geometry it's clamped to the terrain, but in this case the texture is colored with a grey scale interpolated to my color.
If I put setDrapingEnabled=false , I have the expected colour of the texture, but the geometry it's not clamped to the terrain.
Anyone can help me?
Beta Was this translation helpful? Give feedback.
All reactions