1armedScissor
January 8th, 2006, 16:42
I'm attempting to write a shader that will accept the outNormal of a maya bump2d node as the input for it's bump map.
I can't seem to figure out though how to use this data properly within the shader. I'm bringing the vector data in and then converting it from world space to camera space, and then in order for the lighting to be calculated properly I'm assuming that I need to change the state->normal based on the new bump information.
Is this correct? Do I modify the state->normal with this information and if so how? Or do I simply use the bump information instead?
// this is the input on the shader, where I
//connect the out normal of the bump 2d node in maya
miVector bumpMap;
// then I evaluate the bumpMap
bumpMap = *mi_eval_vector(¶ms->bumpMap);
// then I convert the bumpMap to camera space
mi_vector_to_camera(state, &bumpMap, &bumpMap);
//then I convert my state->normal to the bumpMap
state->normal = bumpMap;
Then after this I go through a simple light loop that does lambertian shading, but the results aren't correct and I'm pretty sure it has to do with what I'm doing to the state->normal.
Any and all ideas would be greatly appreciated. Thanks
I can't seem to figure out though how to use this data properly within the shader. I'm bringing the vector data in and then converting it from world space to camera space, and then in order for the lighting to be calculated properly I'm assuming that I need to change the state->normal based on the new bump information.
Is this correct? Do I modify the state->normal with this information and if so how? Or do I simply use the bump information instead?
// this is the input on the shader, where I
//connect the out normal of the bump 2d node in maya
miVector bumpMap;
// then I evaluate the bumpMap
bumpMap = *mi_eval_vector(¶ms->bumpMap);
// then I convert the bumpMap to camera space
mi_vector_to_camera(state, &bumpMap, &bumpMap);
//then I convert my state->normal to the bumpMap
state->normal = bumpMap;
Then after this I go through a simple light loop that does lambertian shading, but the results aren't correct and I'm pretty sure it has to do with what I'm doing to the state->normal.
Any and all ideas would be greatly appreciated. Thanks