简体   繁体   English

SceneKit:更改着色器参数对对象无效

[英]SceneKit: Changing shader parameters have no effect on object

I have created an object on Maya and exported to a dae file. 我在Maya上创建了一个对象,并导出到dae文件。 That object is a cylinder wrapped in a texture. 该对象是包裹在纹理中的圆柱体。 The shader, created on maya and imported into SceneKit is a Phong with the following characteristics: 在Maya上创建并导入到SceneKit的着色器是具有以下特征的Phong:

在此处输入图片说明

I add an omni light to the scene with the following parameters: 我使用以下参数向场景添加了全向灯光:

在此处输入图片说明 在此处输入图片说明

The cylinder appears blown by the light, over iluminated. 汽缸似乎被灯光吹过,亮了。 But just that cylinder. 但是只是那个圆柱体。 The other objects in the scene appear fine. 场景中的其他对象看起来很好。

When I try to change any parameter on the light and on the object's shader I see changes on interface builder preview but no effect when I run the application on the iPhone. 当我尝试更改灯光和对象的着色器上的任何参数时,我会看到界面生成器预览上的更改,但是在iPhone上运行该应用程序时没有任何效果。 Yes, I have tried to clean Xcode cache and removing the app from the iPhone before buids. 是的,我曾尝试清理Xcode缓存并在解决之前从iPhone中删除该应用程序。 No change. 没变。

Any ideas? 有任何想法吗?

The default rendering API for the iPhone is Metal. iPhone的默认渲染API是Metal。 Try switching it to OpenGL. 尝试将其切换为OpenGL。 In Interface Builder, select your SCNView and you'll see a popup for "Rendering API". 在Interface Builder中,选择您的SCNView,您将看到“ Rendering API”的弹出窗口。 Or you can add the PrefersOpenGL key with a bool value of YES to your Info.plist: https://developer.apple.com/library/ios/qa/qa1904/_index.html 或者,您可以将布尔值为YES的PrefersOpenGL键添加到Info.plist中: https : //developer.apple.com/library/ios/qa/qa1904/_index.html

Here's the Interface Builder control. 这是Interface Builder控件。 Select your SCNView: 选择您的SCNView:

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM