SceneKit: Is it possible to cast an shadow on an Transparent Object?

前端 未结 3 1474
梦如初夏
梦如初夏 2021-01-15 05:50

i am trying to cast an shadow on an totally transparent plane in SceneKit on OSX. I am struggling with this problem since several hours and do not come to any solution.

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-15 06:27

    Oily Guo, your solution works. Here the solution is in code:

    Configuration of the light source:

    light.shadowColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.4)
    light.shadowMode = .deferred
    

    And for the floor (ie. SCNFloor underneath your objects):

    material.diffuse.contents = UIColor.white
    material.colorBufferWriteMask = SCNColorMask(rawValue: 0)
    

提交回复
热议问题