Transparency Blocks

Started by
20 comments, last by dpadam450 13 years, 2 months ago
I am splitting my code to draw in the Chunk class. I will then implement as described above and post another screen-shot of the results.
By splitting the code I can then draw the diffrent types of the whole map as opposed to chunk by chunk.

ex now:
chunk1->draw()
opaque
translucent
transparent
chunk2->draw()
opaque
translucent
transparent

after:
chunk1->drawOpaque()
chunk1->drawTranslucent()
chunk1->drawTransparent()
chunk2->drawOpaque()
chunk2->drawTranslucent()
chunk2->drawTransparent()
If this post was helpful please +1 or like it !

Webstrand
Advertisement


First, all opaque and alpha-tested blocks like glass or leaves are rendered. This initializes the color buffer and the depth-buffer with the correct values.
[/quote]
Done


Then, the transparent blocks are rendered in two passes:

Render the blocks with color-write disabled, but depth-testing and depth-write enabled. This modifies the depth-buffer without changing the color-buffer.

Next, enable alpha-blending and color-write and draw the transparent blocks once more. (Keep depth-testing enabled)

Because they have already been written to the depth-buffer once, only the polygons nearest to the camera are rendered. This gives convincing results, while being cheap and pretty simple to implement.

Just make sure that the compare function for the depth test is less-or-equal. glDepthFunc(GL_LEQUAL);
[/quote]
What is the command to disable GL Color write.
Google turns up really strange results.

I assume it's something simular to:
glDisable(GL_COLOR_WRITE);
glDisable(GL_COLORWRITE); ?
Neither of those are the answer though
If this post was helpful please +1 or like it !

Webstrand
The same as glDepthMask http://www.opengl.org/sdk/docs/man/xhtml/glColorMask.xml

NBA2K, Madden, Maneater, Killing Floor, Sims http://www.pawlowskipinball.com/pinballeternal

This topic is closed to new replies.

Advertisement