I'm trying to figure out how to have an SCNScylinder on sceen with only a border / stroke / edge visible. Everything in my scene is working fine and i was thinking of just applying a clear color to specular.contents
is the use of a SCNNode delegate / Metal code required (i'm not using opengl on my scene)
Any pointers? help is appreciated
The WWDC 2014 presentation showed orbiting cubes that had only wireframes. The technique was to use an image with green edges but transparent interior as the material. From AAPLSlideScenegraphSummary.m:
// A node that will help visualize the position of the stars
_wireframeBoxNode = [SCNNode node];
_wireframeBoxNode.rotation = SCNVector4Make(0, 1, 0, M_PI_4);
_wireframeBoxNode.geometry = [SCNBox boxWithWidth:1 height:1 length:1 chamferRadius:0];
_wireframeBoxNode.geometry.firstMaterial.diffuse.contents = [NSImage imageNamed:@"box_wireframe"];
_wireframeBoxNode.geometry.firstMaterial.lightingModelName = SCNLightingModelConstant; // no lighting
_wireframeBoxNode.geometry.firstMaterial.doubleSided = YES; // double sided
For a similar effect with SCNCylinder, you might need to pass an array of materials, some with border and some without.
Edit
For High Sierra/iOS 11 and higher, the answer by @mnuages is a simpler/better approach.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With