nint22 / dwarfcraft

Automatically exported from code.google.com/p/dwarfcraft
Other
0 stars 0 forks source link

Need to investigate how to better hide non-visible surfaces #77

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When looking from the back inside of a mountain face, some faces are visible 
that shouldn't be. For example back-face culling will remove the invisible 
faces, but still allows the bottom surfaces in which the camera is above to 
still be visible. See example rotation and note that surfaces that should be 
invisible:

http://imgur.com/a/YtU9Z

Original issue reported on code.google.com by nin...@gmail.com on 18 Nov 2011 at 7:28

GoogleCodeExporter commented 9 years ago
Ideas:

1. Place black blocks (or optimize by building x or z length "strips") to hide 
content below. (Maybe not black, but an unknown texture).
2. Ignore smooth edges as a texture and stick with doing an edge much like cell 
shading using GLSL (reported as bug 76 I think?)
3. Using a better octree implementation, we can quickly and correctly determine 
the world geometry without bothering with complex edge detection, or 
hidden-state

Original comment by nin...@gmail.com on 18 Nov 2011 at 7:58

GoogleCodeExporter commented 9 years ago
Need bug #78 complete before.

Original comment by nin...@gmail.com on 19 Nov 2011 at 10:44

GoogleCodeExporter commented 9 years ago
Done! but only on the tops; still need to do the sides (use the z-depth trick?)

Original comment by nin...@gmail.com on 22 Nov 2011 at 3:54

GoogleCodeExporter commented 9 years ago
Note: generates VERY slowly in debug-mode on Win32

Original comment by nin...@gmail.com on 22 Nov 2011 at 6:43

GoogleCodeExporter commented 9 years ago
Solution:

1. For the top-hidden layer (black), use a quad-tree class to store and 
optimize the geometry so that we don't waste a ton of polygons
2. For the sides, each layer's "hidden" geometry includes all the hiding 
information below it; this might be in a special buffer so that we don't render 
black, but simply set the depth buffer to 0 removing any drawn content.

Original comment by nin...@gmail.com on 22 Nov 2011 at 8:23

GoogleCodeExporter commented 9 years ago
Good sudgestion from reddit:

Render the object a second time, solid black, with the face culling mode 
reversed and with the vertex positions extruded out along the normals. I've 
shipped a game using this technique. Super cheap. Works great.

There's no need for any extra data in the VBO. Just re-draw the original VBO 
with a different vertex shader that does "position += normal*extrusionScale" 
before transforming the position.

Original comment by nin...@gmail.com on 25 Nov 2011 at 7:35

GoogleCodeExporter commented 9 years ago
Just going to use a black-block to hide...

Original comment by nin...@gmail.com on 8 Jan 2012 at 10:29