New shape: Prizm

Hi, I'm extending the engine with the Prizm shape. But I ran into problems rendering the prizm. I got general prizm form, but shaded and lit areas are not quite reflecting the light source. For example, I added a box and my prizm to a scene. This scene renders shade on the bottom of a box and lit top of the box, but my prizm is lit on the bottom and shaded on the top. I know my normals are ok, and I suspect that prizm trimesh is not defined properly? Could anyone explain to me how I can fix the issue?



  Thank you,

  Dmitri.



Here is the source code:



package

Are there any guru's interested in this topic?

  1. Display your normals by hitting [n] and compare them (esp. the direction) to normals of other shapes.
  2. Check the winding of your triangles to match the normals. You can do that by appying a cullstate with CULL_BACK.

Hey, irrisor, thanks for suggestion.

The normals are fine. The back culling did not reveal anything useful. I am attaching screen shots which will explain my problem. You can see properly lit box, and sort of inversly lit prizm.

Textured:



Wireframe: