issue with jit.gl.light

fraction's icon

Hi,
i cant understand what's going on with jit.gl.light. The issue is little in gl2, but get worse with gl3.
Let's say we have 2 simple objects in poly_mode 1 1, placed on the same 'plan'. They dont react similarly to the light as soon the jit.gl.node in which they rendered has rotated.

Max Patch
Copy patch and select New From Clipboard in Max.

I dont understand the reason. Both objects are initialized with the same parameters, besides their shape, but as they are in wireframe, i would expect they react the same way with the light, while we can see that they behave as if they were "upside down".

any idea?

Rob Ramirez's icon

I think the easiest fix for this is to enable back face culling (@cull_face 1), which you should do regardless for any objects that don't need back faces. You can even do it on the gl.node to apply to all sub-objects. Please let me know if that doesn't do the trick.

fraction's icon

Hi Rob,
thanks.

@cull_face 1 doesn't change anything, and there's still a problem and anyways i need the under face. I have tried different thing (gridmode 0, 1, whit jit.gl.material etc), and it doesnt fix that issue.

Everything works fine When jit.gl.node has none rotatexyz.
But as soon you rotate the node, the light will have a strange behavior, and light up the two objects differently, one staying in the dark, while the other will get light, etc. That's really strange.

Rob Ramirez's icon

ah ok I think the behavior difference is due to the 0 z scaling on the circle. is there a reason that is scaled to 0, and does setting it to non-zero give you more what you're after?

fraction's icon

ha yes that works! i left 0 for z because it's just a circle without z, so i didn't think it was relevant to give it a value.
i just learned a thing :)