diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index a0a7c178521..e25a8a7f13c 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -336,6 +336,7 @@ void default_tex(Tex *tex) tex->noisesize= 0.25; tex->noisedepth= 2; tex->turbul= 5.0; + tex->nabla= 0.025; // also in do_versions tex->bright= 1.0; tex->contrast= tex->filtersize= 1.0; tex->rfac= 1.0; diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 3c87de94b5f..140a48acef2 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -4589,6 +4589,14 @@ static void do_versions(Main *main) } } } + if(main->versionfile <= 235) { + Tex *tex= main->tex.first; + + while(tex) { + if(tex->nabla==0.0) tex->nabla= 0.025; + tex= tex->id.next; + } + } /* don't forget to set version number in blender.c! */ } diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h index 00e57f5e082..e6586936f9c 100644 --- a/source/blender/makesdna/DNA_texture_types.h +++ b/source/blender/makesdna/DNA_texture_types.h @@ -149,7 +149,7 @@ typedef struct Tex { float cropxmin, cropymin, cropxmax, cropymax; short xrepeat, yrepeat; short extend, len; - float checkerdist, pad; + float checkerdist, nabla; short frames, offset, sfra, fie_ima; float norfac, *nor; diff --git a/source/blender/render/intern/source/texture.c b/source/blender/render/intern/source/texture.c index 6bd6042aebf..9e791fc5809 100644 --- a/source/blender/render/intern/source/texture.c +++ b/source/blender/render/intern/source/texture.c @@ -194,6 +194,36 @@ void end_render_textures() /* ------------------------------------------------------------------------- */ +/* this allows colorbanded textures to control normals as well */ +static void tex_normal_derivate(float fac, Tex *tex) +{ + if (tex->flag & TEX_COLORBAND) { + float col[4]; + if (do_colorband(tex->coba, fac, col)) { + float fac0, fac1, fac2, fac3; + + fac0= (col[0]+col[1]+col[2]); + do_colorband(tex->coba, tex->nor[0], col); + fac1= (col[0]+col[1]+col[2]); + do_colorband(tex->coba, tex->nor[1], col); + fac2= (col[0]+col[1]+col[2]); + do_colorband(tex->coba, tex->nor[2], col); + fac3= (col[0]+col[1]+col[2]); + + tex->nor[0]= 0.3333*(fac0 - fac1); + tex->nor[1]= 0.3333*(fac0 - fac2); + tex->nor[2]= 0.3333*(fac0 - fac3); + + return; + } + } + tex->nor[0]= fac - tex->nor[0]; + tex->nor[1]= fac - tex->nor[1]; + tex->nor[2]= fac - tex->nor[2]; +} + + + static int blend(Tex *tex, float *texvec) { float x, y, t; @@ -240,9 +270,6 @@ static int blend(Tex *tex, float *texvec) /* ------------------------------------------------------------------------- */ /* ************************************************************************* */ -/* clouds, wood & marble updated to do proper bumpmapping */ -/* 0.025 seems reasonable value for offset */ -#define B_OFFS 0.025 /* newnoise: all noisebased types now have different noisebases to choose from */ @@ -253,9 +280,11 @@ static int clouds(Tex *tex, float *texvec) if (tex->nor!=NULL) { // calculate bumpnormal - tex->nor[0] = Tin - BLI_gTurbulence(tex->noisesize, texvec[0] + B_OFFS, texvec[1], texvec[2], tex->noisedepth, (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis); - tex->nor[1] = Tin - BLI_gTurbulence(tex->noisesize, texvec[0], texvec[1] + B_OFFS, texvec[2], tex->noisedepth, (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis); - tex->nor[2] = Tin - BLI_gTurbulence(tex->noisesize, texvec[0], texvec[1], texvec[2] + B_OFFS, tex->noisedepth, (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis); + tex->nor[0] = BLI_gTurbulence(tex->noisesize, texvec[0] + tex->nabla, texvec[1], texvec[2], tex->noisedepth, (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis); + tex->nor[1] = BLI_gTurbulence(tex->noisesize, texvec[0], texvec[1] + tex->nabla, texvec[2], tex->noisedepth, (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis); + tex->nor[2] = BLI_gTurbulence(tex->noisesize, texvec[0], texvec[1], texvec[2] + tex->nabla, tex->noisedepth, (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis); + + tex_normal_derivate(Tin, tex); rv += 2; } @@ -304,9 +333,11 @@ static int wood(Tex *tex, float *texvec) Tin = wood_int(tex, texvec[0], texvec[1], texvec[2]); if (tex->nor!=NULL) { /* calculate bumpnormal */ - tex->nor[0] = Tin - wood_int(tex, texvec[0] + B_OFFS, texvec[1], texvec[2]); - tex->nor[1] = Tin - wood_int(tex, texvec[0], texvec[1] + B_OFFS, texvec[2]); - tex->nor[2] = Tin - wood_int(tex, texvec[0], texvec[1], texvec[2] + B_OFFS); + tex->nor[0] = wood_int(tex, texvec[0] + tex->nabla, texvec[1], texvec[2]); + tex->nor[1] = wood_int(tex, texvec[0], texvec[1] + tex->nabla, texvec[2]); + tex->nor[2] = wood_int(tex, texvec[0], texvec[1], texvec[2] + tex->nabla); + + tex_normal_derivate(Tin, tex); rv += 2; } @@ -339,9 +370,12 @@ static int marble(Tex *tex, float *texvec) if (tex->nor!=NULL) { /* calculate bumpnormal */ - tex->nor[0] = Tin - marble_int(tex, texvec[0] + B_OFFS, texvec[1], texvec[2]); - tex->nor[1] = Tin - marble_int(tex, texvec[0], texvec[1] + B_OFFS, texvec[2]); - tex->nor[2] = Tin - marble_int(tex, texvec[0], texvec[1], texvec[2] + B_OFFS); + tex->nor[0] = marble_int(tex, texvec[0] + tex->nabla, texvec[1], texvec[2]); + tex->nor[1] = marble_int(tex, texvec[0], texvec[1] + tex->nabla, texvec[2]); + tex->nor[2] = marble_int(tex, texvec[0], texvec[1], texvec[2] + tex->nabla); + + tex_normal_derivate(Tin, tex); + rv += 2; } @@ -467,18 +501,20 @@ static float mg_mFractalOrfBmTex(Tex *tex, float *texvec) else mgravefunc = mg_fBm; - Tin = mgravefunc(texvec[0], texvec[1], texvec[2], tex->mg_H, tex->mg_lacunarity, tex->mg_octaves, tex->noisebasis); + Tin = tex->ns_outscale*mgravefunc(texvec[0], texvec[1], texvec[2], tex->mg_H, tex->mg_lacunarity, tex->mg_octaves, tex->noisebasis); if (tex->nor!=NULL) { + float offs= tex->nabla/tex->noisesize; // also scaling of texvec + /* calculate bumpnormal */ - tex->nor[0] = Tin - mgravefunc(texvec[0] + B_OFFS, texvec[1], texvec[2], tex->mg_H, tex->mg_lacunarity, tex->mg_octaves, tex->noisebasis); - tex->nor[1] = Tin - mgravefunc(texvec[0], texvec[1] + B_OFFS, texvec[2], tex->mg_H, tex->mg_lacunarity, tex->mg_octaves, tex->noisebasis); - tex->nor[2] = Tin - mgravefunc(texvec[0], texvec[1], texvec[2] + B_OFFS, tex->mg_H, tex->mg_lacunarity, tex->mg_octaves, tex->noisebasis); + tex->nor[0] = tex->ns_outscale*mgravefunc(texvec[0] + offs, texvec[1], texvec[2], tex->mg_H, tex->mg_lacunarity, tex->mg_octaves, tex->noisebasis); + tex->nor[1] = tex->ns_outscale*mgravefunc(texvec[0], texvec[1] + offs, texvec[2], tex->mg_H, tex->mg_lacunarity, tex->mg_octaves, tex->noisebasis); + tex->nor[2] = tex->ns_outscale*mgravefunc(texvec[0], texvec[1], texvec[2] + offs, tex->mg_H, tex->mg_lacunarity, tex->mg_octaves, tex->noisebasis); + + tex_normal_derivate(Tin, tex); rv += 2; } - Tin *= tex->ns_outscale; - BRICON; return rv; @@ -495,18 +531,20 @@ static float mg_ridgedOrHybridMFTex(Tex *tex, float *texvec) else mgravefunc = mg_HybridMultiFractal; - Tin = mgravefunc(texvec[0], texvec[1], texvec[2], tex->mg_H, tex->mg_lacunarity, tex->mg_octaves, tex->mg_offset, tex->mg_gain, tex->noisebasis); + Tin = tex->ns_outscale*mgravefunc(texvec[0], texvec[1], texvec[2], tex->mg_H, tex->mg_lacunarity, tex->mg_octaves, tex->mg_offset, tex->mg_gain, tex->noisebasis); if (tex->nor!=NULL) { + float offs= tex->nabla/tex->noisesize; // also scaling of texvec + /* calculate bumpnormal */ - tex->nor[0] = Tin - mgravefunc(texvec[0] + B_OFFS, texvec[1], texvec[2], tex->mg_H, tex->mg_lacunarity, tex->mg_octaves, tex->mg_offset, tex->mg_gain, tex->noisebasis); - tex->nor[1] = Tin - mgravefunc(texvec[0], texvec[1] + B_OFFS, texvec[2], tex->mg_H, tex->mg_lacunarity, tex->mg_octaves, tex->mg_offset, tex->mg_gain, tex->noisebasis); - tex->nor[2] = Tin - mgravefunc(texvec[0], texvec[1], texvec[2] + B_OFFS, tex->mg_H, tex->mg_lacunarity, tex->mg_octaves, tex->mg_offset, tex->mg_gain, tex->noisebasis); + tex->nor[0] = tex->ns_outscale*mgravefunc(texvec[0] + offs, texvec[1], texvec[2], tex->mg_H, tex->mg_lacunarity, tex->mg_octaves, tex->mg_offset, tex->mg_gain, tex->noisebasis); + tex->nor[1] = tex->ns_outscale*mgravefunc(texvec[0], texvec[1] + offs, texvec[2], tex->mg_H, tex->mg_lacunarity, tex->mg_octaves, tex->mg_offset, tex->mg_gain, tex->noisebasis); + tex->nor[2] = tex->ns_outscale*mgravefunc(texvec[0], texvec[1], texvec[2] + offs, tex->mg_H, tex->mg_lacunarity, tex->mg_octaves, tex->mg_offset, tex->mg_gain, tex->noisebasis); + + tex_normal_derivate(Tin, tex); rv += 2; } - Tin *= tex->ns_outscale; - BRICON; return rv; @@ -518,18 +556,20 @@ static float mg_HTerrainTex(Tex *tex, float *texvec) { int rv=0; /* return value, int:0, col:1, nor:2, everything:3 */ - Tin = mg_HeteroTerrain(texvec[0], texvec[1], texvec[2], tex->mg_H, tex->mg_lacunarity, tex->mg_octaves, tex->mg_offset, tex->noisebasis); + Tin = tex->ns_outscale*mg_HeteroTerrain(texvec[0], texvec[1], texvec[2], tex->mg_H, tex->mg_lacunarity, tex->mg_octaves, tex->mg_offset, tex->noisebasis); if (tex->nor!=NULL) { + float offs= tex->nabla/tex->noisesize; // also scaling of texvec + /* calculate bumpnormal */ - tex->nor[0] = Tin - mg_HeteroTerrain(texvec[0] + B_OFFS, texvec[1], texvec[2], tex->mg_H, tex->mg_lacunarity, tex->mg_octaves, tex->mg_offset, tex->noisebasis); - tex->nor[1] = Tin - mg_HeteroTerrain(texvec[0], texvec[1] + B_OFFS, texvec[2], tex->mg_H, tex->mg_lacunarity, tex->mg_octaves, tex->mg_offset, tex->noisebasis); - tex->nor[2] = Tin - mg_HeteroTerrain(texvec[0], texvec[1], texvec[2] + B_OFFS, tex->mg_H, tex->mg_lacunarity, tex->mg_octaves, tex->mg_offset, tex->noisebasis); + tex->nor[0] = tex->ns_outscale*mg_HeteroTerrain(texvec[0] + offs, texvec[1], texvec[2], tex->mg_H, tex->mg_lacunarity, tex->mg_octaves, tex->mg_offset, tex->noisebasis); + tex->nor[1] = tex->ns_outscale*mg_HeteroTerrain(texvec[0], texvec[1] + offs, texvec[2], tex->mg_H, tex->mg_lacunarity, tex->mg_octaves, tex->mg_offset, tex->noisebasis); + tex->nor[2] = tex->ns_outscale*mg_HeteroTerrain(texvec[0], texvec[1], texvec[2] + offs, tex->mg_H, tex->mg_lacunarity, tex->mg_octaves, tex->mg_offset, tex->noisebasis); + + tex_normal_derivate(Tin, tex); rv += 2; } - Tin *= tex->ns_outscale; - BRICON; return rv; @@ -544,10 +584,14 @@ static float mg_distNoiseTex(Tex *tex, float *texvec) Tin = mg_VLNoise(texvec[0], texvec[1], texvec[2], tex->dist_amount, tex->noisebasis, tex->noisebasis2); if (tex->nor!=NULL) { + float offs= tex->nabla/tex->noisesize; // also scaling of texvec + /* calculate bumpnormal */ - tex->nor[0] = Tin - mg_VLNoise(texvec[0] + B_OFFS, texvec[1], texvec[2], tex->dist_amount, tex->noisebasis, tex->noisebasis2); - tex->nor[1] = Tin - mg_VLNoise(texvec[0], texvec[1] + B_OFFS, texvec[2], tex->dist_amount, tex->noisebasis, tex->noisebasis2); - tex->nor[2] = Tin - mg_VLNoise(texvec[0], texvec[1], texvec[2] + B_OFFS, tex->dist_amount, tex->noisebasis, tex->noisebasis2); + tex->nor[0] = mg_VLNoise(texvec[0] + offs, texvec[1], texvec[2], tex->dist_amount, tex->noisebasis, tex->noisebasis2); + tex->nor[1] = mg_VLNoise(texvec[0], texvec[1] + offs, texvec[2], tex->dist_amount, tex->noisebasis, tex->noisebasis2); + tex->nor[2] = mg_VLNoise(texvec[0], texvec[1], texvec[2] + offs, tex->dist_amount, tex->noisebasis, tex->noisebasis2); + + tex_normal_derivate(Tin, tex); rv += 2; } @@ -610,13 +654,17 @@ static float voronoiTex(Tex *tex, float *texvec) } if (tex->nor!=NULL) { + float offs= tex->nabla/tex->noisesize; // also scaling of texvec + /* calculate bumpnormal */ - voronoi(texvec[0] + B_OFFS, texvec[1], texvec[2], da, pa, tex->vn_mexp, tex->vn_distm); - tex->nor[0] = Tin - sc * fabs(tex->vn_w1*da[0] + tex->vn_w2*da[1] + tex->vn_w3*da[2] + tex->vn_w4*da[3]); - voronoi(texvec[0], texvec[1] + B_OFFS, texvec[2], da, pa, tex->vn_mexp, tex->vn_distm); - tex->nor[1] = Tin - sc * fabs(tex->vn_w1*da[0] + tex->vn_w2*da[1] + tex->vn_w3*da[2] + tex->vn_w4*da[3]); - voronoi(texvec[0], texvec[1], texvec[2] + B_OFFS, da, pa, tex->vn_mexp, tex->vn_distm); - tex->nor[2] = Tin - sc * fabs(tex->vn_w1*da[0] + tex->vn_w2*da[1] + tex->vn_w3*da[2] + tex->vn_w4*da[3]); + voronoi(texvec[0] + offs, texvec[1], texvec[2], da, pa, tex->vn_mexp, tex->vn_distm); + tex->nor[0] = sc * fabs(tex->vn_w1*da[0] + tex->vn_w2*da[1] + tex->vn_w3*da[2] + tex->vn_w4*da[3]); + voronoi(texvec[0], texvec[1] + offs, texvec[2], da, pa, tex->vn_mexp, tex->vn_distm); + tex->nor[1] = sc * fabs(tex->vn_w1*da[0] + tex->vn_w2*da[1] + tex->vn_w3*da[2] + tex->vn_w4*da[3]); + voronoi(texvec[0], texvec[1], texvec[2] + offs, da, pa, tex->vn_mexp, tex->vn_distm); + tex->nor[2] = sc * fabs(tex->vn_w1*da[0] + tex->vn_w2*da[1] + tex->vn_w3*da[2] + tex->vn_w4*da[3]); + + tex_normal_derivate(Tin, tex); rv += 2; } diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c index b42f0b1eee9..f14269cd1b4 100644 --- a/source/blender/src/buttons_shading.c +++ b/source/blender/src/buttons_shading.c @@ -376,14 +376,14 @@ static void drawcolorband_cb(void) buttons_active_id(&id, &idfrom); if( GS(id->name)==ID_TE) { Tex *tex= (Tex *)id; - drawcolorband(tex->coba, 12,145,300,30); + drawcolorband(tex->coba, 10,145,300,30); } else if( GS(id->name)==ID_MA) { Material *ma= (Material *)id; if(ma->ramp_show==0) - drawcolorband(ma->ramp_col, 12,110,300,30); + drawcolorband(ma->ramp_col, 10,110,300,30); else - drawcolorband(ma->ramp_spec, 12,110,300,30); + drawcolorband(ma->ramp_spec, 10,110,300,30); } } @@ -895,6 +895,7 @@ static void texture_panel_wood(Tex *tex) /* newnoise: noisebasis menu */ uiDefBut(block, LABEL, 0, "Noise Basis", 10, 30, 150, 19, 0, 0.0, 0.0, 0, 0, ""); uiDefButS(block, MENU, B_TEXPRV, noisebasis_menu(), 10, 10, 150, 19, &tex->noisebasis, 0,0,0,0, "Sets the noise basis used for turbulence"); + uiDefButF(block, NUM, B_NOP, "Nabla: ", 160, 10, 150, 19, &tex->nabla, 0.001, 0.1, 1, 0, "Defines size of derivative offset used for calculating normal"); } @@ -907,12 +908,12 @@ static void texture_panel_stucci(Tex *tex) uiSetButLock(tex->id.lib!=0, "Can't edit library data"); uiBlockBeginAlign(block); - uiDefButS(block, ROW, B_TEXPRV, "Plastic", 10, 180, 75, 19, &tex->stype, 2.0, 0.0, 0, 0, "Uses standard stucci"); - uiDefButS(block, ROW, B_TEXPRV, "Wall In", 85, 180, 75, 19, &tex->stype, 2.0, 1.0, 0, 0, "Creates Dimples"); - uiDefButS(block, ROW, B_TEXPRV, "Wall Out", 160, 180, 75, 19, &tex->stype, 2.0, 2.0, 0, 0, "Creates Ridges"); + uiDefButS(block, ROW, B_TEXPRV, "Plastic", 10, 180, 100, 19, &tex->stype, 2.0, 0.0, 0, 0, "Uses standard stucci"); + uiDefButS(block, ROW, B_TEXPRV, "Wall In", 110, 180, 100, 19, &tex->stype, 2.0, 1.0, 0, 0, "Creates Dimples"); + uiDefButS(block, ROW, B_TEXPRV, "Wall Out", 210, 180, 100, 19, &tex->stype, 2.0, 2.0, 0, 0, "Creates Ridges"); - uiDefButS(block, ROW, B_TEXPRV, "Soft noise", 10, 160, 112, 19, &tex->noisetype, 12.0, 0.0, 0, 0, "Generates soft noise"); - uiDefButS(block, ROW, B_TEXPRV, "Hard noise", 122, 160, 113, 19, &tex->noisetype, 12.0, 1.0, 0, 0, "Generates hard noise"); + uiDefButS(block, ROW, B_TEXPRV, "Soft noise", 10, 160, 150, 19, &tex->noisetype, 12.0, 0.0, 0, 0, "Generates soft noise"); + uiDefButS(block, ROW, B_TEXPRV, "Hard noise", 160, 160, 150, 19, &tex->noisetype, 12.0, 1.0, 0, 0, "Generates hard noise"); uiBlockBeginAlign(block); uiDefButF(block, NUM, B_TEXPRV, "NoiseSize :", 10, 110, 150, 19, &tex->noisesize, 0.0001, 2.0, 10, 0, "Sets scaling for noise input"); @@ -922,6 +923,7 @@ static void texture_panel_stucci(Tex *tex) /* newnoise: noisebasis menu */ uiDefBut(block, LABEL, 0, "Noise Basis", 10, 30, 150, 19, 0, 0.0, 0.0, 0, 0, ""); uiDefButS(block, MENU, B_TEXPRV, noisebasis_menu(), 10, 10, 150, 19, &tex->noisebasis, 0,0,0,0, "Sets the noise basis used for turbulence"); + uiDefButF(block, NUM, B_NOP, "Nabla: ", 160, 10, 150, 19, &tex->nabla, 0.001, 0.1, 1, 0, "Defines size of derivative offset used for calculating normal"); } @@ -934,12 +936,12 @@ static void texture_panel_marble(Tex *tex) uiSetButLock(tex->id.lib!=0, "Can't edit library data"); uiBlockBeginAlign(block); - uiDefButS(block, ROW, B_TEXPRV, "Soft", 10, 180, 75, 18, &tex->stype, 2.0, 0.0, 0, 0, "Uses soft marble"); - uiDefButS(block, ROW, B_TEXPRV, "Sharp", 85, 180, 75, 18, &tex->stype, 2.0, 1.0, 0, 0, "Uses more clearly defined marble"); - uiDefButS(block, ROW, B_TEXPRV, "Sharper", 160, 180, 75, 18, &tex->stype, 2.0, 2.0, 0, 0, "Uses very clearly defined marble"); + uiDefButS(block, ROW, B_TEXPRV, "Soft", 10, 180, 100, 18, &tex->stype, 2.0, 0.0, 0, 0, "Uses soft marble"); + uiDefButS(block, ROW, B_TEXPRV, "Sharp", 110, 180, 100, 18, &tex->stype, 2.0, 1.0, 0, 0, "Uses more clearly defined marble"); + uiDefButS(block, ROW, B_TEXPRV, "Sharper", 210, 180, 100, 18, &tex->stype, 2.0, 2.0, 0, 0, "Uses very clearly defined marble"); - uiDefButS(block, ROW, B_TEXPRV, "Soft noise", 10, 160, 112, 19, &tex->noisetype, 12.0, 0.0, 0, 0, "Generates soft noise"); - uiDefButS(block, ROW, B_TEXPRV, "Hard noise", 122, 160, 113, 19, &tex->noisetype, 12.0, 1.0, 0, 0, "Generates hard noise"); + uiDefButS(block, ROW, B_TEXPRV, "Soft noise", 10, 160, 150, 19, &tex->noisetype, 12.0, 0.0, 0, 0, "Generates soft noise"); + uiDefButS(block, ROW, B_TEXPRV, "Hard noise", 160, 160, 150, 19, &tex->noisetype, 12.0, 1.0, 0, 0, "Generates hard noise"); uiBlockBeginAlign(block); uiDefButF(block, NUM, B_TEXPRV, "NoiseSize :", 10, 110, 150, 19, &tex->noisesize, 0.0001, 2.0, 10, 0, "Sets scaling for noise input"); @@ -950,6 +952,7 @@ static void texture_panel_marble(Tex *tex) /* newnoise: noisebasis menu */ uiDefBut(block, LABEL, 0, "Noise Basis", 10, 30, 150, 19, 0, 0.0, 0.0, 0, 0, ""); uiDefButS(block, MENU, B_TEXPRV, noisebasis_menu(), 10, 10, 150, 19, &tex->noisebasis, 0,0,0,0, "Sets the noise basis used for turbulence"); + uiDefButF(block, NUM, B_NOP, "Nabla: ", 160, 10, 150, 19, &tex->nabla, 0.001, 0.1, 1, 0, "Defines size of derivative offset used for calculating normal"); } @@ -974,6 +977,7 @@ static void texture_panel_clouds(Tex *tex) /* newnoise: noisebasis menu */ uiDefBut(block, LABEL, 0, "Noise Basis", 10, 30, 150, 19, 0, 0.0, 0.0, 0, 0, ""); uiDefButS(block, MENU, B_TEXPRV, noisebasis_menu(), 10, 10, 150, 19, &tex->noisebasis, 0,0,0,0, "Sets the noise basis used for turbulence"); + uiDefButF(block, NUM, B_NOP, "Nabla: ", 160, 10, 150, 19, &tex->nabla, 0.001, 0.1, 1, 0, "Defines size of derivative offset used for calculating normal"); } @@ -1013,6 +1017,7 @@ static void texture_panel_musgrave(Tex *tex) /* noisebasis menu */ uiDefBut(block, LABEL, 0, "Noise Basis", 10, 30, 150, 19, 0, 0.0, 0.0, 0, 0, ""); uiDefButS(block, MENU, B_TEXPRV, noisebasis_menu(), 10, 10, 150, 19, &tex->noisebasis, 0,0,0,0, "Sets the noise basis used for turbulence"); + uiDefButF(block, NUM, B_NOP, "Nabla: ", 160, 10, 150, 19, &tex->nabla, 0.001, 0.1, 1, 0, "Defines size of derivative offset used for calculating normal"); } @@ -1039,7 +1044,9 @@ static void texture_panel_distnoise(Tex *tex) uiDefButS(block, MENU, B_TEXPRV, noisebasis_menu(), 10, 80, 150, 19, &tex->noisebasis, 0,0,0,0, "Sets the noise basis which does the distortion"); /* noisebasis to distort */ uiDefButS(block, MENU, B_TEXPRV, noisebasis_menu(), 160, 80, 150, 19, &tex->noisebasis2, 0,0,0,0, "Sets the noise basis to distort"); + uiBlockEndAlign(block); + uiDefButF(block, NUM, B_NOP, "Nabla: ", 10, 50, 150, 19, &tex->nabla, 0.001, 0.1, 1, 0, "Defines size of derivative offset used for calculating normal"); } @@ -1053,30 +1060,32 @@ static void texture_panel_voronoi(Tex *tex) /* color types */ uiBlockBeginAlign(block); - uiDefButS(block, ROW, B_TEXPRV, "Int", 10, 180, 50, 18, &tex->vn_coltype, 1.0, 0.0, 0, 0, "Only calculate intensity"); - uiDefButS(block, ROW, B_TEXPRV, "Col1", 60, 180, 50, 18, &tex->vn_coltype, 1.0, 1.0, 0, 0, "Color cells by position"); - uiDefButS(block, ROW, B_TEXPRV, "Col2", 110, 180, 50, 18, &tex->vn_coltype, 1.0, 2.0, 0, 0, "Same as Col1 + outline based on F2-F1"); - uiDefButS(block, ROW, B_TEXPRV, "Col3", 160, 180, 50, 18, &tex->vn_coltype, 1.0, 3.0, 0, 0, "Same as Col2 * intensity"); + uiDefButS(block, ROW, B_TEXPRV, "Int", 10, 180, 75, 18, &tex->vn_coltype, 1.0, 0.0, 0, 0, "Only calculate intensity"); + uiDefButS(block, ROW, B_TEXPRV, "Col1", 85, 180, 75, 18, &tex->vn_coltype, 1.0, 1.0, 0, 0, "Color cells by position"); + uiDefButS(block, ROW, B_TEXPRV, "Col2", 160, 180, 75, 18, &tex->vn_coltype, 1.0, 2.0, 0, 0, "Same as Col1 + outline based on F2-F1"); + uiDefButS(block, ROW, B_TEXPRV, "Col3", 235, 180, 75, 18, &tex->vn_coltype, 1.0, 3.0, 0, 0, "Same as Col2 * intensity"); uiBlockEndAlign(block); /* distance metric */ sprintf(dm_menu, "Distance Metric %%t|Actual Distance %%x%d|Distance Squared %%x%d|Manhattan %%x%d|Chebychev %%x%d|Minkovsky 1/2 %%x%d|Minkovsky 4 %%x%d|Minkovsky %%x%d", TEX_DISTANCE, TEX_DISTANCE_SQUARED, TEX_MANHATTAN, TEX_CHEBYCHEV, TEX_MINKOVSKY_HALF, TEX_MINKOVSKY_FOUR, TEX_MINKOVSKY); - uiDefBut(block, LABEL, 0, "Distance Metric", 10, 160, 200, 19, 0, 0, 0, 0, 0, ""); - uiDefButS(block, MENU, B_TEXPRV, dm_menu, 10, 140, 200, 19, &tex->vn_distm, 0,0,0,0, "Sets the distance metric to be used"); + uiDefBut(block, LABEL, 0, "Distance Metric", 10, 160, 150, 19, 0, 0, 0, 0, 0, ""); + uiDefButS(block, MENU, B_TEXPRV, dm_menu, 10, 140, 150, 19, &tex->vn_distm, 0,0,0,0, "Sets the distance metric to be used"); if (tex->vn_distm==TEX_MINKOVSKY) - uiDefButF(block, NUMSLI, B_TEXPRV, "Exp: ", 10, 120, 200, 19, &tex->vn_mexp, 0.01, 10.0, 10, 0, "Sets minkovsky exponent"); + uiDefButF(block, NUMSLI, B_TEXPRV, "Exp: ", 10, 120, 150, 19, &tex->vn_mexp, 0.01, 10.0, 10, 0, "Sets minkovsky exponent"); uiBlockBeginAlign(block); - uiDefButF(block, NUM, B_TEXPRV, "iScale: ", 10, 95, 100, 19, &tex->ns_outscale, 0.01, 10.0, 10, 0, "Scales intensity output"); - uiDefButF(block, NUM, B_TEXPRV, "Size: ", 110, 95, 100, 19, &tex->noisesize, 0.0001, 2.0, 10, 0, "Sets scaling for noise input"); + uiDefButF(block, NUM, B_TEXPRV, "iScale: ", 160, 140, 150, 19, &tex->ns_outscale, 0.01, 10.0, 10, 0, "Scales intensity output"); + uiDefButF(block, NUM, B_TEXPRV, "Size: ", 160, 120, 150, 19, &tex->noisesize, 0.0001, 2.0, 10, 0, "Sets scaling for noise input"); + uiBlockBeginAlign(block); + uiDefButF(block, NUM, B_NOP, "Nabla: ", 160, 70, 150, 19, &tex->nabla, 0.001, 0.1, 1, 0, "Defines size of derivative offset used for calculating normal"); /* weights */ uiBlockBeginAlign(block); - uiDefButF(block, NUMSLI, B_TEXPRV, "W1: ", 10, 70, 200, 19, &tex->vn_w1, -2.0, 2.0, 10, 0, "Sets feature weight 1"); - uiDefButF(block, NUMSLI, B_TEXPRV, "W2: ", 10, 50, 200, 19, &tex->vn_w2, -2.0, 2.0, 10, 0, "Sets feature weight 2"); - uiDefButF(block, NUMSLI, B_TEXPRV, "W3: ", 10, 30, 200, 19, &tex->vn_w3, -2.0, 2.0, 10, 0, "Sets feature weight 3"); - uiDefButF(block, NUMSLI, B_TEXPRV, "W4: ", 10, 10, 200, 19, &tex->vn_w4, -2.0, 2.0, 10, 0, "Sets feature weight 4"); + uiDefButF(block, NUMSLI, B_TEXPRV, "W1: ", 10, 70, 150, 19, &tex->vn_w1, -2.0, 2.0, 10, 0, "Sets feature weight 1"); + uiDefButF(block, NUMSLI, B_TEXPRV, "W2: ", 10, 50, 150, 19, &tex->vn_w2, -2.0, 2.0, 10, 0, "Sets feature weight 2"); + uiDefButF(block, NUMSLI, B_TEXPRV, "W3: ", 10, 30, 150, 19, &tex->vn_w3, -2.0, 2.0, 10, 0, "Sets feature weight 3"); + uiDefButF(block, NUMSLI, B_TEXPRV, "W4: ", 10, 10, 150, 19, &tex->vn_w4, -2.0, 2.0, 10, 0, "Sets feature weight 4"); } @@ -1434,7 +1443,7 @@ static void texture_panel_texture(MTex *mtex, Material *ma, World *wrld, Lamp *l sprintf(textypes, "Texture Type %%t|None %%x%d|Image %%x%d|EnvMap %%x%d|Clouds %%x%d|Marble %%x%d|Stucci %%x%d|Wood %%x%d|Magic %%x%d|Blend %%x%d|Noise %%x%d|Plugin %%x%d|Musgrave %%x%d|Voronoi %%x%d|DistortedNoise %%x%d", 0, TEX_IMAGE, TEX_ENVMAP, TEX_CLOUDS, TEX_MARBLE, TEX_STUCCI, TEX_WOOD, TEX_MAGIC, TEX_BLEND, TEX_NOISE, TEX_PLUGIN, TEX_MUSGRAVE, TEX_VORONOI, TEX_DISTNOISE); uiDefBut(block, LABEL, 0, "Texture Type", 160, 150, 140, 20, 0, 0.0, 0.0, 0, 0, ""); - uiDefButS(block, MENU, B_TEXTYPE, textypes, 160, 130, 140, 20, &tex->type, 0,0,0,0, "Select texture type"); + uiDefButS(block, MENU, B_TEXTYPE, textypes, 160, 125, 140, 25, &tex->type, 0,0,0,0, "Select texture type"); } else {