简体   繁体   English

设备和模拟器上的底纹不同

[英]Shading different on device and simulator

I have a GLKViewController embedded in a regular view controller displaying a spinning 3D model of one of my company's products. 我有一个GLKViewController嵌入在常规视图控制器中,该控制器显示我公司产品之一的旋转3D模型。 I am using the same code in a different app to display another model and I have no problems with that one. 我在不同的应用程序中使用相同的代码来显示另一种模型,但是我没有遇到任何问题。

For some reason, when I run my current app on the simulator I get perfectly fine smooth shading as expected, but when I run on a device (I have tested on both an iPad 3 and iPad 4), I get what appears to be cell-shading, as though the lighting values are more discrete. 出于某种原因,当我在模拟器上运行当前的应用程序时,可以按预期获得完美的平滑阴影,但是当我在设备上运行(我已经在iPad 3和iPad 4上进行了测试)时,我得到的似乎是单元-阴影,好像照明值更加离散。

The real confusion is that this only happens when running on a device, and only to this particular model, not any of the others I have used. 真正的困惑是,这仅在设备上运行时才会发生,并且仅针对该特定模型,而不是我使用过的其他模型。

在模拟器中运行在设备上运行

Is there a known bug in GLSL that could cause this behavior? GLSL中是否存在可能导致此问题的已知错误?

EDIT 编辑

Interestingly enough, during my debugging, if I change 有趣的是,在调试期间,如果我更改

gl_FragColor = vec4(ambientColor.rgb + diffuseReflection + specularReflection, 1.0);

to

gl_FragColor = vec4(diffuseReflection, 1.0);

I get my desired output, but when I output each component, the remaining components all show up as just black, which shouldn't cause that strange shading behavior. 我得到了想要的输出,但是当我输出每个组件时,其余的组件全部显示为黑色,这不会引起奇怪的阴影行为。

Have you checked the filenames of your vertex and fragment shaders? 您是否检查了顶点着色器和片段着色器的文件名?

If you have a file named: "vertexShader.vert" and try and reference it using "VertexShader.vert" (note the capitalisation), this will work on the Simulator, but not on the device. 如果您有一个名为“ vertexShader.vert”的文件,并尝试使用“ VertexShader.vert”(请注意大写字母)对其进行引用,则该文件将在模拟器上起作用,但在设备上不起作用。

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

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