Home > database >  Swift SceneKit Diffuse color doesn't change anything
Swift SceneKit Diffuse color doesn't change anything

Time:07-04

I have a 3D model in .obj form and a corresponding .mtl file.

I dragged them both into xcode and converted the .obj model to a .scn file.

Xcode loads the file correctly and also applies the material. So in diffuse there is a color. (See image below) The problem is: The model stays white, except if I add an emission color. (See the two attached images - one with and one without emission color - once the model is visible and the other time not)

How do I apply the material color correctly?

enter image description here

enter image description here

CodePudding user response:

Assuming the first image shows the result you don't want and the second image is a result more or less good, I can tell you this: The emission color of the first image is set to a pure white, which means, the emission is set to its maximum, what makes it almost invisible on white backgrounds. the second image just has some emission (a gray color) and so the geometry becomes better visible.

If your geometry is not a lamp and neither a light source, set the emission color to UIColor.black, and your object should be just fine.

  • Related