'SceneKit – Make higher resolution in SCNView [closed]
I am using SceneKit and I hate the resolution of the geometry. I read developer documentation and other websites. I found an article on the developer documentation. It gave me this image:
But couldn't find any information how to do that, only another stupid article on the developer documentation. I really need a higher resolution – it should be smoothed.
Is there some one how can help me with this problem?
Solution 1:[1]
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.
Solution 2:[2]
If you've loaded low-poly .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, or none. This will help you load more models, while being smoothed, and not exceed 100K polygons limit.
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
Solution 3:[3]
Depending on the geometry you have, you can sub-divide it on the fly.
i.Ex:
node.geometry?.subdivisionlevel = 2
If your initial geometry is of "good" quality, the result can be astunishing. Give it a try.
Note: it will quadruple your vertices with each incrementation of the sudivision integer. A value of 2 will give you 16 times more vertices than the original geometry contains. This also impacts the memory!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Sweeper |
| Solution 2 | |
| Solution 3 | ZAY |


