Skip to content

Disable depth mask when rendering custom blocks #8

@deathcap

Description

@deathcap

From mikolalysenko in #2:

When rendering the world you need to do 2 passes:

  • First draw all opaque/transparent voxels without using any blending and with the depthMask enabled.
  • Then disable depthMask (but keep the depthTest on!), turn on blending and draw all transparent faces.

or http://stackoverflow.com/questions/3388294/opengl-question-about-the-usage-of-gldepthmask, similar process:

  1. Turn on the depth mask glDepthMask( GL_TRUE )
  2. Draw all opaque objects, in any order
  3. Turn off the depth mask glDepthMask( GL_FALSE )
  4. Turn on a BLEND_MODE
  5. Draw translucent objects sorted from furthest away to nearest

Currently, voxel-shader draws all opaque/transparent objects first, then translucent objects with blending enabled. However, the meshes are not sorted (voxel/voxel-mesher#9) and the depth mask is not enabled or disabled (this issue, GH-8).

https://www.opengl.org/sdk/docs/man/html/glDepthMask.xhtml

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions