I have used shader modifiers for Plane but its not working. Can anyone suggest me how to solve it?
let myShaderfragment = "#pragma transparent;\n" + "_output.color.a = 0.0;"
let myShaderSurface = "#pragma transparent;\n" + "_surface.diffuse.a = 0.0;"
material.shaderModifiers = [SCNShaderModifierEntryPoint.fragment : myShaderfragment, SCNShaderModifierEntryPoint.surface : myShaderSurface]
The SceneKit: What's New session from WWDC 2017 explains how to do that.
- For the plane, use a material with
constant
as itslightingModel
. It's the cheapest one. - This material will have
writesToDepthBuffer
set totrue
andcolorBufferWriteMask
set to[]
(empty option set). That way the plane will write in the depth buffer, but won't draw anything on screen. - Set the light's
shadowMode
todeferred
so that shadows are not applied when rendering the objects themselves, but as a final post-process.
来源:https://stackoverflow.com/questions/45505471/can-we-render-shadow-on-a-transparent-plane-in-scenekit