PDA

View Full Version : bump conversion problem......


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(&params->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

Puppet
January 8th, 2006, 21:22
I suppose you don't need convert anything at all.
Just use:

state->normal = *mi_eval_vector(&params->bumpMap);

That's all. It's easy way to support bump in any shader in maya.
For example, I do it in my p_MegaTK shader.

But sometimes you may get some problem beside terminator, but it's another problem (for mr bump too) :)

1armedScissor
January 8th, 2006, 23:44
Thanks alot puppet I appreciate the speedy response! I'm curious though as to what types of problems this brings up. What are the problems with respect to the terminator as well?