Testing commit for the studio; a bump-correction factor for when images
get sampled on larger distance. It actually just flattens bump when the sampled area is (much) larger than pixel size, to prevent weird things like: current render: http://www.blender.org/bf/b1.jpg distance corrected: http://www.blender.org/bf/b2.jpg (image based on Alexander file :) Tested on env's dinos too... seems to work, but we'll see.
This commit is contained in:
@@ -778,6 +778,7 @@ int imagewraposa(Tex *tex, Image *ima, float *texvec, float *dxt, float *dyt, Te
|
||||
|
||||
/* choice: */
|
||||
if(tex->imaflag & TEX_MIPMAP) {
|
||||
float bumpscale;
|
||||
|
||||
dx= minx;
|
||||
dy= miny;
|
||||
@@ -786,6 +787,10 @@ int imagewraposa(Tex *tex, Image *ima, float *texvec, float *dxt, float *dyt, Te
|
||||
|
||||
pixsize = 1.0f/ (float) MIN2(ibuf->x, ibuf->y);
|
||||
|
||||
bumpscale= pixsize/maxd;
|
||||
if(bumpscale>1.0f) bumpscale= 1.0f;
|
||||
else bumpscale*=bumpscale;
|
||||
|
||||
curmap= 0;
|
||||
previbuf= ibuf;
|
||||
while(curmap<BLI_ARRAY_NELEMS(ima->mipmap) && ima->mipmap[curmap]) {
|
||||
@@ -853,6 +858,8 @@ int imagewraposa(Tex *tex, Image *ima, float *texvec, float *dxt, float *dyt, Te
|
||||
texres->ta= dy*texres->ta+ dx*texr.ta;
|
||||
}
|
||||
}
|
||||
texres->nor[0]*= bumpscale;
|
||||
texres->nor[1]*= bumpscale;
|
||||
}
|
||||
else {
|
||||
maxx= fx+minx;
|
||||
|
||||
Reference in New Issue
Block a user