UV rendering error: the third value of a UV texture coordinate should be
set to zero always, this enables 3d textures to work uniform with UV.

Also fixed: UV pass output for non_OSA is now equal to OSA, meaning only
used UV face values are in such passes.
This commit is contained in:
Ton Roosendaal 2007-01-15 11:41:10 +00:00
parent 2170b007f0
commit a8a339b26e
2 changed files with 9 additions and 7 deletions

@ -404,7 +404,7 @@ static void add_filt_passes(RenderLayer *rl, int curmask, int rectx, int offset,
break; break;
case SCE_PASS_UV: case SCE_PASS_UV:
/* box filter only, gauss will screwup UV too much */ /* box filter only, gauss will screwup UV too much */
if(shi->uv[0].uv[2]!=0.0f) { if(shi->totuv) {
float mult= (float)count_mask(curmask)/(float)R.osa; float mult= (float)count_mask(curmask)/(float)R.osa;
fp= rpass->rect + 3*offset; fp= rpass->rect + 3*offset;
fp[0]+= mult*(0.5f + 0.5f*shi->uv[0].uv[0]); fp[0]+= mult*(0.5f + 0.5f*shi->uv[0].uv[0]);
@ -481,10 +481,12 @@ static void add_passes(RenderLayer *rl, int offset, ShadeInput *shi, ShadeResult
col= shr->nor; col= shr->nor;
break; break;
case SCE_PASS_UV: case SCE_PASS_UV:
uvcol[0]= 0.5f + 0.5f*shi->uv[0].uv[0]; if(shi->totuv) {
uvcol[1]= 0.5f + 0.5f*shi->uv[0].uv[1]; uvcol[0]= 0.5f + 0.5f*shi->uv[0].uv[0];
uvcol[2]= 1.0f; uvcol[1]= 0.5f + 0.5f*shi->uv[0].uv[1];
col= uvcol; uvcol[2]= 1.0f;
col= uvcol;
}
break; break;
case SCE_PASS_VECTOR: case SCE_PASS_VECTOR:
col= shr->winspeed; col= shr->winspeed;

@ -691,7 +691,7 @@ void shade_input_set_shade_texco(ShadeInput *shi)
suv->uv[0]= -1.0f + 2.0f*(l*uv3[0]-u*uv1[0]-v*uv2[0]); suv->uv[0]= -1.0f + 2.0f*(l*uv3[0]-u*uv1[0]-v*uv2[0]);
suv->uv[1]= -1.0f + 2.0f*(l*uv3[1]-u*uv1[1]-v*uv2[1]); suv->uv[1]= -1.0f + 2.0f*(l*uv3[1]-u*uv1[1]-v*uv2[1]);
suv->uv[2]= 1.0f; /* texture.c assumes there are 3 coords, also to indicate it is real UV for passes */ suv->uv[2]= 0.0f; /* texture.c assumes there are 3 coords */
if(shi->osatex) { if(shi->osatex) {
float duv[2]; float duv[2];
@ -727,7 +727,7 @@ void shade_input_set_shade_texco(ShadeInput *shi)
suv->uv[0]= 2.0f*(u+.5f); suv->uv[0]= 2.0f*(u+.5f);
suv->uv[1]= 2.0f*(v+.5f); suv->uv[1]= 2.0f*(v+.5f);
suv->uv[2]= 0.0f; /* texture.c assumes there are 3 coords, also to indicate it is no real UV for passes */ suv->uv[2]= 0.0f; /* texture.c assumes there are 3 coords */
if(mode & MA_FACETEXTURE) { if(mode & MA_FACETEXTURE) {
/* no tface? set at 1.0f */ /* no tface? set at 1.0f */