[英]SceneKit: Transform texture to fill only part of a sphere
I'm developing an application that uses SceneKit API and I faced the problem that I basically cannot apply a texture to a sphere object and keep texture's pre-defined size. 我正在开发一个使用SceneKit API的应用程序,但遇到的问题是我基本上无法将纹理应用于球体对象并保持纹理的预定义大小。 I'm able to either scale the texture up to the object's surface (default SceneKit's behavior) or repeat it.
我可以将纹理缩放到对象的表面(默认为SceneKit的行为)或重复进行。 But what I want to achieve is similar to the billiard ball:
但是我想要达到的目标类似于台球:
Let's say I have aa .png image of a white circle with the number "13" at the center of it. 假设我有一个白色圆圈的.png图像,其中心是数字“ 13”。 I want to put it like the one on the picture.
我想把它像照片上的一样。 Generally, I want it to be scaled up to a fixed size, not the whole surface.
通常,我希望将其缩放到固定大小,而不是整个表面。
I use material.diffuse.contents
property of SCNGeometry
to set the texture and I found contentsTransform
property in the documentation which can probably help me sort it out but I didn't find an explanation how to use it with the sphere object. 我使用
SCNGeometry
material.diffuse.contents
属性设置纹理,并在文档中找到contentsTransform
属性,该属性可能可以帮助我对其进行分类,但没有找到关于如何将其与sphere对象一起使用的说明。
Is it something that is possible with pure SceneKit? 使用纯SceneKit可以做到吗? Any help would be very appreciated.
任何帮助将不胜感激。
You need a preliminarily modelled geometry (polygonal sphere in your case) and its
UV Mapped texture
that's made in 3D modelling software (Autodesk Maya for instance).您需要一个初步建模的几何体(在您的情况下为多边形球体)及其在3D建模软件(例如Autodesk Maya)中制作的
UV Mapped texture
。
Watch this short movie to find out how to get UV-mapped texture. 观看这部短片 ,了解如何获得UV贴图。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.