SceneKit Culling Plane

前端 未结 2 812
野性不改
野性不改 2020-12-17 01:48

I have a SCNScene rendering in a SCNView. I have some *.dae models that are rendered/moving in the scene.

I have a transparent cube, when one of my models goes behin

2条回答
  •  没有蜡笔的小新
    2020-12-17 02:07

    Here's a solution

    1. For the cube, use a material with constant as its lightingModel. It's the cheapest one.
    2. This material will have writesToDepthBuffer set to true and colorBufferWriteMask set to [] (empty option set). That way the cube will write in the depth buffer, but won't draw anything on screen.
    3. Set the cube's renderingOrder to -1 so that it's drawn before any other node in the scene. This will make the cube write in the depth buffer before any other object, preventing them from being drawn if they are behind the cube.

提交回复
热议问题