SceneKit adaptive subdivision

Viewed 115

I'm having trouble trying to implement adaptive subdivision in SceneKit. The results I'm expecting should be similar to what's seen in the 2017 SceneKit demo for WWDC of the Fox mesh. I would like it to work in ARKit. Do I have to specify my pointOfView.camera as any factor in the process of initializing the subdivision, or do I have to calculate the length away from the camera to model at all times adjusting my subdivisionLevel in a SceneKit renderer delegate method?

let tessellator = SCNGeometryTessellator()
tessellator.edgeTessellationFactor = 3.0
tessellator.insideTessellationFactor = 3.0
newNode.geometry?.tessellator = tessellator
tessellator.smoothingMode = .pnTriangles
tessellator.isAdaptive = true
tessellator.maximumEdgeLength = 50
        
modelNode.geometry?.wantsAdaptiveSubdivision = true
modelNode.geometry?.subdivisionLevel = 1

See Apple documentation or the video (at 23:00).

0 Answers
Related