Hi guys,
I’m trying to apply a fragment shader on a SceneKit node to achieve non-photorealistic render. I would like to use the diffuse and ambiant colors of each vertex group as the base color in the fragment shader.
In swift:
program.vertexFunctionName = "toonVertex"
program.fragmentFunctionName = "toonFragment"
if let materials = node.geometry?.materials
{
for material in materials
{
material.program = program
material.setValue(lightNode.position, forKey: "lightPosition")
material.setValue(material.diffuse.contents, forKey: "baseColor")
}
}
I’m not sure on how I should input this in the fragment function. Can anyone help me on this?
Thanks!