Rendering transparent objects in OpenGL

前端 未结 2 1808
南笙
南笙 2021-01-03 11:38

Iam trying to render some 3d objects using opengl. Requirement is that i need to hide all the transparent objects which are z-behind another transparent object. All the tria

2条回答
  •  遥遥无期
    2021-01-03 12:10

    You can do this by sorting your scene, which is what you have to do anyway to get transparency working correctly.

    Here's what you need to do:

    1. Enable z-buffer writes and tests
    2. Render all opaque objects
    3. Render all transparent objects front to back. The z-buffer will prevent transparent objects from being displayed behind other transparent objects.

提交回复
热议问题