Jump to content
  • Advertisement
Sign in to follow this  
fugedizsolt

wireframe landscape hiding edges that can't see

This topic is 3879 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi Dear Community! Pleas help me, I want to see a nice landscape! I have a height map, 256x256. Every little square 2 triangles. I have a working program to draw this landscape in wireframe mode. But I see all the edges. I have tried to use backface culling, it is a partial success. Is it possible that draw edges only I can see, from the camera viewpoint? These are not the solution: - I fill the little triangles with black, draw the wireframe triangles little above the black solid triangles, but the result is not that I like: close to surface I can see the little error lines... - I have tried to use stencil buffer: colormask false,false,false,false first draw the wireframe mode edges to the stencil buffer second I draw the filled triangles, with depth test colormask true,,, then draw the scene again this is not the solution (I think) Any idea? Thanks

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by fugedizsolt
I have tried to use backface culling, it is a partial success.

This should work. Are you sure both triangles are set up in the same orientation?

Share this post


Link to post
Share on other sites
Hi DevFred!

Imagine that you are standing on a highland and you see ahead of you a big canyon. Backface culling is hiding triangles that facing away, but there are triangles that are facing towards you and you can't see them either, because the highland surface hides them.

|
---------\ /------------
\ /
\ /
\/

Thanks
Fuge

Share this post


Link to post
Share on other sites
Hi,
In the Directx SDK there is a MeshViewer. If I open an .X file, I can view the mesh with solid fill AND edges. This is what I want, but I don't know how to do it in OpenGL. Please help

Share this post


Link to post
Share on other sites
From your description I take it that you draw GL_LINES for the wireframe?
If so this may be the problem. I'm not 100% sure but you could draw the wireframe using glPolygonMode(GL_LINES), but I'm not sure if the interiors are filled then or if you are already using this.

Another way is to first draw the whole geometry filling the depth buffer and then using glPolygonOffset with appropriate parameters and then draw in wireframe again.

Share this post


Link to post
Share on other sites
I'm pretty sure you need to render the scene twice to get the effect you're after. Render the whole scene once into just the depth buffer. Then render the scene again into the colour buffer with depth test enabled and a small polygon offset toward the camera.

I think I heard someone saying there was another way to do it using DX10 class shaders ... but I didn't really pay attention to the details unfortunately.

Good luck!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!