PDA

View Full Version : dont calculate shadows


Osaires
January 12th, 2007, 13:03
Hi, i want to make a simple diffuse shader that dosn't calculate shadows.

I should say that i'm a totaly beginer and dont know much about writing shaders.

Ok so i'm lookin at the soruce codes for the baseLambert shader, and frome what i get it must be somthing in this line that calculate the shadow,

while (mi_sample_light(&color, &dir, &dot_nl, state,

please help me out, i realy want to learn :)

dlanier
January 12th, 2007, 13:10
Hi,

Go on ftp://ftp.mentalimages.com and download the public source code of basic shaders.

More especially : ftp://ftp.mentalimages.com/pub/shaders

Regards,

Puppet
January 12th, 2007, 13:16
what i get it must be somthing in this line that calculate the shadow
No.

You should disable shadow in options before call mi_sample_light loop.

For example like this:
miOptions *orig_options = (miOptions *)(state->options); //save pointer to original options
miOptions m_options = *state->options; //copy original options
state->options = &m_options; //link new options to state

m_options.shadow = 0; //edit new options

for &#40;n=0; n < n_l; n++, light++&#41;
&#123;
&#46;&#46;&#46;
while &#40;mi_sample_light&#40;&color, &dir, &dot_nl, state, *light, &samples&#41;&#41;
&#123;
&#46;&#46;&#46;
&#125;
&#46;&#46;&#46;
&#125;

state->options = orig_options; //restore pointer to original options

Osaires
January 12th, 2007, 13:41
Thanks, that makes sense.

and i guesing by doing it this way i could make a shader that you could pass other shaders trough this shader to disable shadows.