Questions tagged [scngeometry]
21 questions
3
votes
1 answer
physically based lighting on custom SCNGeometry Node
Question
How do you define the material on a custom geometry from vertex data, so that it renders the same as 'typical' SCNNodes?
Details
In this scene there are
A directional light
A red sphere using physicallybased lighting model
A blue sphere…

tospig
- 7,762
- 14
- 40
- 79
3
votes
0 answers
ARSCNPlaneGeometry update and re-calculate texture coordinates, instead of stretching them
I'm having a problem on the texture coordinates of planes geometries being updated by ARKit. Texture images get stretched, I want to avoid that.
Right now I'm detecting horizontal and vertical walls and applying a texture to them. It's working like…

c4b4d4
- 964
- 12
- 32
2
votes
1 answer
How do you properly subclass SCNGeometry with your own sources and elements?
Trying to create my own custom SCNGeometry subclass similar to how the framework has SCNBox, SCNPyramid, SCNCapsule, etc. I've already built up my source and element arrays, but the following is a convenience initializer, not a designated…

Mark A. Donohoe
- 28,442
- 25
- 137
- 286
2
votes
1 answer
Why does SCNNode .flattenedClone() either crash or make performance worse?
I'm attempting to add around 4.5k SCNNode objects to a scene. Their geometries are one of two SCNPlanes, whose materials are rendered by CALayers (but I don't think that matters, the CALayerDelegates are only called once each, so that doesn't seem…

Robert Atkins
- 23,528
- 15
- 68
- 97
2
votes
1 answer
SceneKit Custom Geometry Shape not showing up
I am pretty new to Swift, and SceneKit, and my current problem is that the custom shape I am trying to create is not showing up, even though the primitive shapes in the framework show up fine.
I have been following the tutorial from…

Anh Trần
- 83
- 1
- 1
- 7
1
vote
1 answer
SceneKit selectively color a face by a certain index
My objective: given some index i and some UIColor c, make the face at that index turn into that color.
let vertices = // all of my vertices in the format of SCNVector3
let vertexSource = SCNGeometrySource(data: verticesData,
…

7ball
- 2,183
- 4
- 26
- 61
1
vote
0 answers
Scenekit - Crash when rendering custom SCNGeometry polygon
I get the following error message when trying to render some polygons from a large amount of SCNVector3 positions. I really need to render polygons and I don't know why this is happening. If anyone know another way to render polygons I'll be glad to…

wonder
- 71
- 6
0
votes
0 answers
Scenekit: Dynamic Modification of Geometries
For my 3D game about a spaceship flying in a cave, I need to modify the geometries that the cave is built from. As stated in earlier posts, the cave is constructed from circular shapes by putting one shape behind another to create a tube-like…

ULI
- 41
- 7
0
votes
1 answer
Swift: how to use the SCNGeometrySources from one node, to create another independent copy of that node?
I am trying to change the color of selected vertices of an imported .usdz model. My (naive?) approach is to make a copy of the geometry of the original model by extracting the SCNGeometrySources for the .vertex, .normal and .color…

JWBR
- 11
- 1
- 2
0
votes
0 answers
How to extract the vertices and indices from an SCNShape
I am able to successfully create and SCNShape with the following command:
let shape = SCNShape(path: path, extrusionDepth: 0)
where path is an NSBezierPath. I know this is successful because I can add it to an SCNNode and it draws…

Andrew
- 521
- 7
- 18
0
votes
0 answers
How and why I can not save a custom SCNnode using NSKeyedArchiver
i have the following custom class "RBTerrain" of type SCNnode (find it online). I use this to create a custom terrain on my SCNScene.
This class allow my to create a custom geometry for Terrain SCNNode.
I want to save this SCNnode using…

Damiano Miazzi
- 1,514
- 1
- 16
- 38
0
votes
2 answers
Save and reuse a SCNGeometry for future use
For my Scenekit project I found online a class called Terrain witch randomly generete some non regular terrain to be display in my game.
The code generate every time a very well done terrain SCNGeometry using some sort of noise generator.(it…

Damiano Miazzi
- 1,514
- 1
- 16
- 38
0
votes
1 answer
How to show 3D path between two SCNVector3 points
I want to show 3D path between two SCNVector3 points and want to achieve like below screenshot in iOS Swift. from below code shows only simple line between points
let indices: [Int32] = [0, 1]
let source = SCNGeometrySource(vertices: [vector1,…

Zealous System
- 2,080
- 11
- 22
0
votes
2 answers
Wrong vertex data when getting sources from SCNNode geometry
I'm using the code below inside a SCNGeometry extension to get the vertex data, and a similar one for .normals, my objective is to create a cloned mesh from the original node to colorize each vertex, but when I try to create another node with those…

Rodrigo González
- 11
- 2
0
votes
1 answer
Extract faces information from SCNGeometry in SceneKit
I want to extract faces information from a SCNNode geometry just like we can extract vertices information from geometry sources. Any idea on how that can be achieved?

Mahnoor Khan
- 25
- 4