Can we render shadow on a transparent Plane in SceneKit

前端 未结 2 1673
自闭症患者
自闭症患者 2020-12-18 12:39

I have used shader modifiers for Plane but its not working. Can anyone suggest me how to solve it?

let myShaderfragment = \"#pragma transparent;\\n\" + \"_ou         


        
相关标签:
2条回答
  • 2020-12-18 13:16

    The SceneKit: What's New session from WWDC 2017 explains how to do that.

    1. For the plane, 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 plane will write in the depth buffer, but won't draw anything on screen.
    3. Set the light's shadowMode to deferred so that shadows are not applied when rendering the objects themselves, but as a final post-process.
    0 讨论(0)
  • 2020-12-18 13:21

    There's a dedicated lighting model now (SCNLightingModelShadowOnly) to only render shadows

    0 讨论(0)
提交回复
热议问题