Wierd Lighting problem when importing .asc model

Started by boltimuss, July 07, 2014, 02:01:42 AM

Previous topic - Next topic

boltimuss

First off, thank you so much for JPCT-AE!! It is a god-send. I did not want to have to write my own model importer much less deal with the hassle of creating shaders, etc. I only need to add a pretty cylinder. Anyhow, I'm experiencing a weird lighting problem, and was able to produce it with a Cube. I'll also include some screen shots. In the first screen shot the image shows where the edges of the cube are bright, but when the cube is rotated so that when the face is facing the camera, it grows dark. Am I doing something wrong here? I have confirmed that the same behavior exists if I even use the Primitives.getCube method.

Thanks,

~bolt

[attachment deleted by admin]

EgonOlsen

That's caused by the way in which vertex lighting works. It's based on the vertex normals which are based on the face normals of adjacent faces. A vertex becomes brighter if the angle between the vector from the vertex to the light source and the vertex normal decreases and darker if it increases. Maybe this thread helps: http://www.jpct.net/forum2/index.php/topic,3790.msg26784.html#msg26784

boltimuss

Thanks for the swift response. I had a feeling. I am currently using TrueSpace 3.2 for my modeling. I don't think it can export normals, but since blender can, I'll just use it to export the normals. BTW, I was thinking, if I wrote my own shader to accommodate the lighting, I should be able to work around this shouldn't I?

EgonOlsen

Only if your shader uses per pixel lighting. In that case, the basic "problem" will remain but might be less apparent.