Author Topic: Wierd Lighting problem when importing .asc model  (Read 1959 times)

Offline boltimuss

  • byte
  • *
  • Posts: 2
    • View Profile
Wierd Lighting problem when importing .asc model
« on: July 07, 2014, 02:01:42 am »
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]

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Wierd Lighting problem when importing .asc model
« Reply #1 on: July 07, 2014, 09:54:27 am »
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

Offline boltimuss

  • byte
  • *
  • Posts: 2
    • View Profile
Re: Wierd Lighting problem when importing .asc model
« Reply #2 on: July 07, 2014, 12:36:07 pm »
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?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Wierd Lighting problem when importing .asc model
« Reply #3 on: July 07, 2014, 12:42:30 pm »
Only if your shader uses per pixel lighting. In that case, the basic "problem" will remain but might be less apparent.