auto_material and jit.gl.sketch

pelado's icon

I've just written a patch and small article for my website about lighting in
Jitter. The idea is not so much a tutorial as an exploratory approach to
finding out how lighting is tackled in Jitter. However, coming to test the
patch I'm completely stumped by something regarding auto_material and
jit.gl.sketch. If I disable auto_material and draw something in sketch, say
'drawobject gridshape 1', material parameters have no affect on the
lighting/colour of the scene, but altering the colour parameters does. This
is not what I expected and indeed is not what happens with other jitter
objects. Am i missing something totally obvious?

pelado

Here is a patch that shows what I mean

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

Rob Ramirez's icon

hey pelado. you are correct.
for normal gl objects, with lighting_enable 1 and auto_material 0, color attribute will be ignored and mat_diffuse, mat_specular, mat_ambient will be used.

it looks like gl.sketch is ignoring the mat_diffuse and mat_ambient, and just using color even with @auto_material 0. not really sure why this is, but i will try to find out. mean time, using color instead of mat_diffuse has the exact same effect.

also gl.sketch command "glmaterial diffuse 1 1 1 1" should also have the same result as @mat_diffuse 1 1 1 1.

-rob

Rob Ramirez's icon

hey pelado, turns out it was an intentional decision (not a bug) to keep control of material state in gl.sketch with the appropriate gl calls as i described in previous email.

if you run into a problem with this, please let us know, otherwise it probably won't be changing anytime soon.

Dg's icon

Hello,

I can't understand why @inherit_material 1 only works if one gridshape is in my patch.

With 2 gridshape objects the attribut doesn't work?
Strange ...

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


Rob Ramirez's icon

looks like it requires you to either enable inherit_material on both shapes OR @automatic 0 and explicitly bang the the inherited material shape before the non-inherited material shape.

Dg's icon

Yes, it works as you said.
Thank you Rob.