diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h index ba95e2ecbed..8b5afb2e2ba 100644 --- a/source/blender/makesdna/DNA_texture_types.h +++ b/source/blender/makesdna/DNA_texture_types.h @@ -58,6 +58,8 @@ typedef struct MTex { float def_var; float colfac, norfac, varfac; + float dispfac; + short pad1, pad2; } MTex; diff --git a/source/blender/render/intern/source/texture.c b/source/blender/render/intern/source/texture.c index 30b49bbf918..a32ae75ce55 100644 --- a/source/blender/render/intern/source/texture.c +++ b/source/blender/render/intern/source/texture.c @@ -1219,9 +1219,9 @@ void do_material_tex(ShadeInput *shi) if(mtex->maptoneg & MAP_DISPLACE) tex->norfac= -mtex->norfac; else tex->norfac= mtex->norfac; - shi->displace[0]+= Tnor*tex->norfac*tex->nor[0]; - shi->displace[1]+= Tnor*tex->norfac*tex->nor[1]; - shi->displace[2]+= Tnor*tex->norfac*tex->nor[2]; + shi->displace[0]+= 0.1f*Tnor*tex->norfac*tex->nor[0]; + shi->displace[1]+= 0.1f*Tnor*tex->norfac*tex->nor[1]; + shi->displace[2]+= 0.1f*Tnor*tex->norfac*tex->nor[2]; } if(rgbnor & TEX_RGB) { @@ -1230,10 +1230,10 @@ void do_material_tex(ShadeInput *shi) } if(mtex->maptoneg & MAP_DISPLACE) { - factt= (0.5-Tin)*mtex->varfac; facmm= 1.0-factt; + factt= (0.5-Tin)*mtex->dispfac; facmm= 1.0-factt; } else { - factt= (Tin-0.5)*mtex->varfac; facmm= 1.0-factt; + factt= (Tin-0.5)*mtex->dispfac; facmm= 1.0-factt; } if(mtex->blendtype==MTEX_BLEND) { diff --git a/source/blender/renderconverter/intern/convertBlenderScene.c b/source/blender/renderconverter/intern/convertBlenderScene.c index cde2e5554a8..c673859bbbf 100644 --- a/source/blender/renderconverter/intern/convertBlenderScene.c +++ b/source/blender/renderconverter/intern/convertBlenderScene.c @@ -3031,42 +3031,8 @@ void do_displacement(Object *ob, int startface, int numface, int startvert, int float min[3]={1e30, 1e30, 1e30}, max[3]={-1e30, -1e30, -1e30}; float scale[3]={1.0f, 1.0f, 1.0f}, temp[3], xn; int i, texflag=0, flipnorm; - BoundBox *bb; - Mesh *me; - Curve *cu; - MetaBall *mb; Object *obt; - - /* Calculate Texture space scale factor */ - if (ob->type == OB_MESH) { - me=(Mesh *)(ob->data); - if (me->bb == NULL) tex_space_mesh(me); - bb=me->bb; - texflag=me->texflag; - } - else if ((ob->type == OB_CURVE)||(ob->type == OB_SURF)||(ob->type == OB_FONT)) { - cu=(Curve *)(ob->data); - if (cu->bb == NULL) tex_space_curve(cu); - bb=cu->bb; - texflag=cu->texflag; - } - else if (ob->type == OB_MBALL) { /* Metaballs have bb but don't seem to use it */ - mb=(MetaBall *)(ob->data); - if (ob->bb == NULL) ob=find_basis_mball(ob); - if (ob->bb == NULL) tex_space_mball(ob); - bb=ob->bb; - texflag=mb->texflag; - } - else bb=ob->bb; /* Need to test? */ - - /* Relative scale of Data We reat amount of displacement */ - /* the same as other texture coords. Scale with data id AutoTexSpace is on. */ - if ( texflag & 1) { /* Bit 0 = Autotex */ - for(i=0; i<8; i++){ DO_MINMAX(bb->vec[i], min, max); } - VecSubf(scale, max, min); - printf("data scale=%f, %f, %f\n", scale[0], scale[1], scale[2]); - } - + /* Object Size with parenting */ obt=ob; while(obt){ @@ -3216,9 +3182,9 @@ void displace_render_vert(ShadeInput *shi, VertRen *vr, float *scale) //vr->co[0], vr->co[1], vr->co[2]); /* 0.5 could become button once? */ - vr->co[0] += 0.25 * shi->displace[0] * scale[0] ; - vr->co[1] += 0.25 * shi->displace[1] * scale[1] ; - vr->co[2] += 0.25 * shi->displace[2] * scale[2] ; + vr->co[0] += shi->displace[0] * scale[0] ; + vr->co[1] += shi->displace[1] * scale[1] ; + vr->co[2] += shi->displace[2] * scale[2] ; //printf("after co=%f, %f, %f\n", vr->co[0], vr->co[1], vr->co[2]); diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c index b2e10a8320a..d9461134c1b 100644 --- a/source/blender/src/buttons_shading.c +++ b/source/blender/src/buttons_shading.c @@ -1441,10 +1441,10 @@ static void world_panel_mapto(World *wrld) uiDefButS(block, ROW, B_MATPRV, "Add", 1182,130,41,19, &(mtex->blendtype), 9.0, (float)MTEX_ADD, 0, 0, "Sets texture to add the values or colour"); uiDefButS(block, ROW, B_MATPRV, "Sub", 1226,130,40,19, &(mtex->blendtype), 9.0, (float)MTEX_SUB, 0, 0, "Sets texture to subtract the values or colour"); uiBlockBeginAlign(block); - uiDefButF(block, NUMSLI, B_MATPRV, "Col ", 1087,50,179,19, &(mtex->colfac), 0.0, 1.0, 0, 0, "Sets the amount the texture affects colour values"); - uiDefButF(block, NUMSLI, B_MATPRV, "Nor ", 1087,30,179,19, &(mtex->norfac), 0.0, 1.0, 0, 0, "Sets the amount the texture affects normal values"); - uiDefButF(block, NUMSLI, B_MATPRV, "Var ", 1087,10,179,19, &(mtex->varfac), 0.0, 1.0, 0, 0, "Sets the amount the texture affects other values"); - + uiDefButF(block, NUMSLI, B_MATPRV, "Col ", 1087,50,179,19, &(mtex->colfac), 0.0, 1.0, 0, 0, "Sets the amount the texture affects colour values"); + uiDefButF(block, NUMSLI, B_MATPRV, "Nor ", 1087,30,179,19, &(mtex->norfac), 0.0, 1.0, 0, 0, "Sets the amount the texture affects normal values"); + uiDefButF(block, NUMSLI, B_MATPRV, "Var ", 1087,10,179,19, &(mtex->varfac), 0.0, 1.0, 0, 0, "Sets the amount the texture affects other values"); + } static void world_panel_texture(World *wrld) @@ -2137,9 +2137,10 @@ static void material_panel_map_to(Material *ma) uiDefButS(block, ROW, B_MATPRV, "Add", 1182,120,41,18, &(mtex->blendtype), 9.0, (float)MTEX_ADD, 0, 0, "Sets texture to add the values or colour"); uiDefButS(block, ROW, B_MATPRV, "Sub", 1226,120,40,18, &(mtex->blendtype), 9.0, (float)MTEX_SUB, 0, 0, "Sets texture to subtract the values or colour"); uiBlockBeginAlign(block); - uiDefButF(block, NUMSLI, B_MATPRV, "Col ", 1087,50,179,18, &(mtex->colfac), 0.0, 1.0, 0, 0, "Sets the amount the texture affects colour values"); - uiDefButF(block, NUMSLI, B_MATPRV, "Nor ", 1087,30,179,18, &(mtex->norfac), 0.0, 5.0, 0, 0, "Sets the amount the texture affects normal values"); - uiDefButF(block, NUMSLI, B_MATPRV, "Var ", 1087,10,179,18, &(mtex->varfac), 0.0, 1.0, 0, 0, "Sets the amount the texture affects other values"); + uiDefButF(block, NUMSLI, B_MATPRV, "Col ", 1087,70,179,18, &(mtex->colfac), 0.0, 1.0, 0, 0, "Sets the amount the texture affects colour values"); + uiDefButF(block, NUMSLI, B_MATPRV, "Nor ", 1087,50,179,18, &(mtex->norfac), 0.0, 5.0, 0, 0, "Sets the amount the texture affects normal values"); + uiDefButF(block, NUMSLI, B_MATPRV, "Var ", 1087,30,179,18, &(mtex->varfac), 0.0, 1.0, 0, 0, "Sets the amount the texture affects other values"); + uiDefButF(block, NUMSLI, B_MATPRV, "Disp ", 1087,10,179,19, &(mtex->dispfac), 0.0, 1.0, 0, 0, "Sets the amount the texture displaces the surface"); uiBlockEndAlign(block); }