Forums > Jitter

auto_material and jit.gl.sketch

September 8, 2008 | 6:36 pm

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

– Pasted Max Patch, click to expand. –

September 8, 2008 | 7:41 pm

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


September 9, 2008 | 12:40 am

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.


October 6, 2008 | 4:29 pm

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 …

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 349 150 68 196617 doesn’t exist;
#P toggle 57 146 15 0;
#P message 57 166 99 196617 inherit_material $1;
#P window linecount 2;
#P newex 36 224 268 196617 jit.gl.gridshape lum @shape torus @position 0 0 -3 @lighting_enable 1 @smooth_shading 1 @auto_material 0;
#P window linecount 1;
#P message 36 268 187 196617 name lum , size 320 240 , depthbuffer 1;
#P user jit.pwindow 35 289 322 242 0 1 0 0 1 1;
#X name lum;
#P newex 36 60 90 196617 t b b erase;
#P toggle 36 22 15 0;
#P newex 36 40 57 196617 qmetro 66;
#P newex 36 93 254 196617 jit.gl.render lum @auto_material 0 @lighting_enable 1;
#P comment 82 147 108 196617 only works if this –>;
#P newex 191 147 158 196617 jit.gl.gridshape lum @scale 0.05;
#P connect 10 0 9 0;
#P connect 7 0 6 0;
#P fasten 9 0 8 0 62 217 41 217;
#P connect 5 0 2 0;
#P fasten 5 2 2 0 121 81 41 81;
#P connect 3 0 5 0;
#P connect 4 0 3 0;
#P window clipboard copycount 12;


October 6, 2008 | 4:39 pm

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.


October 6, 2008 | 6:16 pm

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


Viewing 6 posts - 1 through 6 (of 6 total)