Wednesday, October 19, 2011

Scaling Normal Maps in Slim

v1 is the normal map input.
v2 is our multiplier

1. get individual channels first
float red = comp(v1,0);

2. since normal maps have R and G values ranged between 0.5 and 1 lets subtract 0.5 from it so that it ranges from 0 to 0.5
float red1 = red - 0.5

3. multiply red1 with v2 to scale our red and green values and then add 0.5 to have our range back at 0.5 to 1

result = (red1*v2)+0.5;

float red = comp(v1,0)-0.5;
float green = comp(v1,1)-0.5;
float red1 = (red*v2)+0.5;
float green1= (green*v2)+0.5;
result = color(red1,green1,1);


Drake said...

I'm really curious to know the reason behind for this stuff~

Kaisun(Julio) Chou said...

we're testing our zbrush to renderman pipeline and we just needed a control to scale our normal maps since renderman doesn't have this node built in.

Kaisun(Julio) Chou said...

its like a bump depth control, but for normal maps.

Post a Comment