Home > Net >  SceneKit – Make higher resolution in SCNView
SceneKit – Make higher resolution in SCNView

Time:04-18

I am using SceneKit and I hate the resolution of the geometry. I read developer documentation and other websites. I found an Apples image

But couldn't find any information how to do that, only another stupid My geometry renders by default

Is there some one how can help me with this problem?

CodePudding user response:

All the built-in shape geometries have xxxSegmentCount properties. You can increase them to make them smoother. Here's a summary table:

Shape segmentCount properties
SCNPlane widthSegmentCount, heightSegmentCount, cornerSegmentCount
SCNBox widthSegmentCount, heightSegmentCount, lengthSegmentCount, chamferSegmentCount
SCNSphere segmentCount
SCNPyramid widthSegmentCount, heightSegmentCount, lengthSegmentCount
SCNCone radialSegmentCount, heightSegmentCount
SCNCylinder radialSegmentCount, heightSegmentCount
SCNCapsule radialSegmentCount, heightSegmentCount, capSegmentCount
SCNTube radialSegmentCount, heightSegmentCount
SCNTorus pipeSegmentCount, ringSegmentCount

You can't control the segment counts for SCNText and SCNShape, however. Their polygon counts are controlled by SceneKit, but it should always be high enough no matter how zoomed in you are. You shouldn't need to worry about this.

Additional note: The levelOfDetail you found is for setting different geometries to use (perhaps with different segment counts) when the camera is a different distance away from the object, to improve performance.

CodePudding user response:

If you've loaded .dae or .obj models like Utah teapot, you should use the antialiasing mode instance property for smoothing faceted surfaces. You can choose between 4 samples per screen pixel, 2 samples per screen pixel, or none.

var antialiasingMode: SCNAntialiasingMode { get set }

SceneKit can provide antialiasing, which smooths edges in a rendered scene, using a technique called multisampling. Multisampling renders each pixel multiple times and combines the results, creating a higher quality image at a performance cost proportional to the number of samples it uses.

Real code looks like this:

let sceneView = SCNView(frame: .zero)

sceneView.antialiasingMode = .multisampling4X
  • Related