DrawPoly not drawing correctly with scene lights

On 28/06/2014 at 18:42, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   14 
Platform:   Windows  ;   Mac OSX  ; 
Language(s) :     C++  ;

I have set the drawing to be performed taking into account the scene lights, with:


For the DrawPoly command, I use the normals that I get from the Phong tag, with:

SVector* smooth_n;   
BaseTag* phongtag = op->GetTag(Tphong,0L);   
if (phongtag)   

If i is the index of the face that I get the coordinates of, I get the normals of the points of the polygon with:

if (phongtag)   

However, the polygons are drawn with the correct color but with the incorrect shading (illumination).
How can I set the normals to make it display correctly?

p.s. By the way, if there is no Phong tag, I simply use the normal of the face with:

N = CalcFaceNormal(pt_list, pol);   

and fill the normals array with:


But this also produces erroneous shading.

On 29/06/2014 at 12:01, xxxxxxxx wrote:

Here is a video showing what is going on:


On 29/06/2014 at 16:39, xxxxxxxx wrote:


I had my calculations in camera space, with:


but I had to make them in object space, with:

bd->SetMatrix_Matrix(NULL, op->GetMg(), 0);