diff options
author | Ton Roosendaal <ton@blender.org> | 2003-08-11 22:18:11 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2003-08-11 22:18:11 +0400 |
commit | 159f53f0a07b7519795b0bd6ac63e8fc05bceca9 (patch) | |
tree | 62fec7908ee795829b9be096aae7668714fa0ffd | |
parent | 2289f3abb60c4dc66cfe6008f80f7bfc6783f906 (diff) |
- increased toon value 'size' to 3.14 for diff, and 1.53 for spec, as in
tuhopuu (as max for buttons)
- Sun lamps now do toon specularity too
Hemi lamps dont do any other shader than the old ones still... the
implimentation of it in Tuhopuu is disputable, will solve this for 2.29
-rw-r--r-- | source/blender/render/intern/source/pixelshading.c | 22 | ||||
-rw-r--r-- | source/blender/render/intern/source/rendercore.c | 22 | ||||
-rw-r--r-- | source/blender/src/buttons.c | 4 |
3 files changed, 23 insertions, 25 deletions
diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c index 337f6ffcd0a..c9ddd8d189c 100644 --- a/source/blender/render/intern/source/pixelshading.c +++ b/source/blender/render/intern/source/pixelshading.c @@ -1204,15 +1204,12 @@ void shadeLampLusFloat() if(ma->spec!=0.0 && !(lar->mode & LA_NO_SPEC)) { - if(lar->type==LA_SUN || lar->type==LA_HEMI) { - if(lar->type==LA_SUN) { - lv[2]-= 1.0; - } - else { - lv[0]+= view[0]; - lv[1]+= view[1]; - lv[2]+= view[2]; - } + if(lar->type==LA_HEMI) { + /* hemi uses no spec shaders (yet) */ + + lv[0]+= view[0]; + lv[1]+= view[1]; + lv[2]+= view[2]; Normalise(lv); @@ -1221,9 +1218,7 @@ void shadeLampLusFloat() if(lar->type==LA_HEMI) { t= 0.5*t+0.5; } - /* watch it: shadfac and lampdist used below */ - /* sun and hemi use no shaders */ t= ma->spec*spec(t, ma->har); isr+= t*(lar->r * ma->specr); isg+= t*(lar->g * ma->specg); @@ -1232,7 +1227,10 @@ void shadeLampLusFloat() else { /* specular shaders */ float specfac; - + + /* we force a different lamp vector for sun light */ + if(lar->type==LA_SUN) lv[2]-= 1.0; + if(ma->spec_shader==MA_SPEC_PHONG) specfac= Phong_Spec(vn, lv, view, ma->har); else if(ma->spec_shader==MA_SPEC_COOKTORR) diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index 34a1436c514..936f91bdccd 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -1827,15 +1827,12 @@ void shade_lamp_loop() if(ma->spec!=0.0 && !(lar->mode & LA_NO_SPEC)) { - if(lar->type==LA_SUN || lar->type==LA_HEMI) { - if(lar->type==LA_SUN) { - lv[2]-= 1.0; - } - else { - lv[0]+= view[0]; - lv[1]+= view[1]; - lv[2]+= view[2]; - } + if(lar->type==LA_HEMI) { + /* hemi uses no spec shaders (yet) */ + + lv[0]+= view[0]; + lv[1]+= view[1]; + lv[2]+= view[2]; Normalise(lv); @@ -1844,7 +1841,7 @@ void shade_lamp_loop() if(lar->type==LA_HEMI) { t= 0.5*t+0.5; } - /* sun and hemi use no shaders */ + t= ma->spec*spec(t, ma->har); isr+= t*(lar->r * ma->specr); isg+= t*(lar->g * ma->specg); @@ -1853,7 +1850,10 @@ void shade_lamp_loop() else { /* specular shaders */ float specfac; - + + /* we force a different lamp vector for sun light */ + if(lar->type==LA_SUN) lv[2]-= 1.0; + if(ma->spec_shader==MA_SPEC_PHONG) specfac= Phong_Spec(vn, lv, view, ma->har); else if(ma->spec_shader==MA_SPEC_COOKTORR) diff --git a/source/blender/src/buttons.c b/source/blender/src/buttons.c index 19ca0ec3c41..7737bc61515 100644 --- a/source/blender/src/buttons.c +++ b/source/blender/src/buttons.c @@ -4243,7 +4243,7 @@ void matbuts(void) if(ma->diff_shader==MA_DIFF_ORENNAYAR) uiDefButF(block, NUM, B_MATPRV, "Rough:", 200, 70, 95,18, &(ma->roughness), 0.0, 3.14, 0, 0, "Oren Nayar Roughness"); else if(ma->diff_shader==MA_DIFF_TOON) { - uiDefButF(block, NUM, B_MATPRV, "Size:", 200, 70, 95,18, &(ma->param[0]), 0.0, 1.0, 0, 0, "Size of diffuse toon area"); + uiDefButF(block, NUM, B_MATPRV, "Size:", 200, 70, 95,18, &(ma->param[0]), 0.0, 3.14, 0, 0, "Size of diffuse toon area"); uiDefButF(block, NUM, B_MATPRV, "Smooth:", 200, 50, 95,18, &(ma->param[1]), 0.0, 1.0, 0, 0, "Smoothness of diffuse toon area"); } @@ -4253,7 +4253,7 @@ void matbuts(void) if(ma->spec_shader==MA_SPEC_BLINN) uiDefButF(block, NUM, B_MATPRV, "Refr:", 295, 50, 90,18, &(ma->refrac), 1.0, 10.0, 0, 0, "Refraction index"); if(ma->spec_shader==MA_SPEC_TOON) { - uiDefButF(block, NUM, B_MATPRV, "Size:", 295, 70, 90,18, &(ma->param[2]), 0.0, 1.0, 0, 0, "Size of specular toon area"); + uiDefButF(block, NUM, B_MATPRV, "Size:", 295, 70, 90,18, &(ma->param[2]), 0.0, 1.53, 0, 0, "Size of specular toon area"); uiDefButF(block, NUM, B_MATPRV, "Smooth:", 295, 50, 90,18, &(ma->param[3]), 0.0, 1.0, 0, 0, "Smoothness of specular toon area"); } |