3

I am creating a model of Saturn and I'm having problems when creating the rings. I found this asset

enter image description here

but when I try to set it as a diffuse, it projects like this

enter image description here

How can I control the way a texture projects over a geometry?

Cristian Pena
  • 2,139
  • 1
  • 19
  • 31

3 Answers3

2

I found the solution. By replacing the cylinder with a torus and rotating the image 90 degrees, XCode did the mapping itself.

enter image description here

But there must be a better way.

Cristian Pena
  • 2,139
  • 1
  • 19
  • 31
  • The best way is really what works best for you without jumping to more hoops. Personally I’d prefer to use the way I described in lthe ast sentence of my answer, i,e. get a texture of the complete rings rather than a section that is repeated. The cylinder is on top (and bottom) mapped like a regular plane and therefor a simple square texture (of the right size) will do. That said, your solution is totally acceptable. – Xartec Oct 07 '17 at 18:04
  • how are you controlling the height of this torus? I'm getting a gigantic torus surrounding the whole sphere, instead of a flat ring like yours – mehulmpt Mar 23 '19 at 12:49
  • how did you do that ? I used Tube But still having problem like yours – Saeed Rahmatolahi Apr 08 '19 at 16:31
1

This isn’t specifically a SceneKit or IOS issue, the same would apply in any 3D package.

You can control the way a texture projects over a geometry by using UV mapping. In practice that means you map the vertices and faces of the model on to the texture in software such a Blender. The texture you use now is meant to be tiled but because the lines on the texture are perfectly straight it will never look optimal.

To save yourself some trouble, use a texture that shows the entire ring from the top/above.

Xartec
  • 2,369
  • 11
  • 22
  • I can see that UV mapping is a constant. How can I use it to achieve the desired projection? – Cristian Pena Oct 05 '17 at 09:07
  • Basically every vertex in the model has a UV coordinate on a normalized scale that represents a position in the texture you use. So all UV coords are between 0,0 and 1,1. The primitives included in scenekit like the SCNCylinder and SCNTorus generate these UV coords automatically. If you want to use different UV coordinates (and thus project the texture differentlly on the model) you will have to use a third party package to map the vertices of the model to a 2D texture. – Xartec Oct 07 '17 at 17:54
  • that's solve my problem (using 3d Model of Saturn Ring) – Saeed Rahmatolahi May 10 '19 at 13:27
1

I think the best way is to use SCNTube.

Yerbol
  • 405
  • 3
  • 6