anthor
October 14th, 2005, 23:12
Hi All -
I want to call a light shader to get the illumination color/intensity. I want to do it without using mi_sample_light.
Seems like I should be able to, but my shader is crashing XSI.
Here's what I have done:
#Defined some variables..
miColor light_color;
int num_lights, light_type, light_master_tag, light_inst_tag, light_shader_tag;
void shader_params;
Then I pull a list of the lights that I have previously stored in a miQ_FUNC_USERPTR
and iterate on them.
I stored inthe usrptr the:
light instance tag
light master tag
With the master tag I get the shader tag like this:
mi_query(miQ_LIGHT_SHADER, state, light_master_tag, &light_shader_tag); //seems to work!
it returns a nice tag value.
If I try to call the shader with it, like this:
mi_call_shader(&light_color, miSHADER_LIGHT, state, light_shader_tag); // this crashed....
it hangs.
If I instead also get the shader parameters like this:
mi_query(miQ_FUNC_PARAM, state, light_shader_tag, &shader_params);
and then use mi_call_shader_x like this:
mi_call_shader_x(&light_color,miSHADER_LIGHT,state,light_shader_tag,&shader_params);
it also crashes.
Now, I know I'm supposed to just use the sample_light loop, but I'm learning here and I want to be able to call a light shader.
Does anybody know what I am not understanding?
Thanks!
ATR
I want to call a light shader to get the illumination color/intensity. I want to do it without using mi_sample_light.
Seems like I should be able to, but my shader is crashing XSI.
Here's what I have done:
#Defined some variables..
miColor light_color;
int num_lights, light_type, light_master_tag, light_inst_tag, light_shader_tag;
void shader_params;
Then I pull a list of the lights that I have previously stored in a miQ_FUNC_USERPTR
and iterate on them.
I stored inthe usrptr the:
light instance tag
light master tag
With the master tag I get the shader tag like this:
mi_query(miQ_LIGHT_SHADER, state, light_master_tag, &light_shader_tag); //seems to work!
it returns a nice tag value.
If I try to call the shader with it, like this:
mi_call_shader(&light_color, miSHADER_LIGHT, state, light_shader_tag); // this crashed....
it hangs.
If I instead also get the shader parameters like this:
mi_query(miQ_FUNC_PARAM, state, light_shader_tag, &shader_params);
and then use mi_call_shader_x like this:
mi_call_shader_x(&light_color,miSHADER_LIGHT,state,light_shader_tag,&shader_params);
it also crashes.
Now, I know I'm supposed to just use the sample_light loop, but I'm learning here and I want to be able to call a light shader.
Does anybody know what I am not understanding?
Thanks!
ATR