Orange: New option "Shadow Bias", to extend the boundary between shadow or
authorTon Roosendaal <ton@blender.org>
Sat, 17 Dec 2005 14:05:40 +0000 (14:05 +0000)
committerTon Roosendaal <ton@blender.org>
Sat, 17 Dec 2005 14:05:40 +0000 (14:05 +0000)
no shadow a little bit. Uses same threshold function as the "Bias" button.
(That latter still works, and will use an automatic bias value based on the
geometry, to prevent terminator errors in raytracing).

Anyhoo, with this manual bias you can get rid of terminator problems for
weird diffuse shaders now as well (like tangent or fresnel).

Committed a few more files than needed, that's just code cleanup.

source/blender/blenloader/intern/readfile.c
source/blender/include/BIF_editgroup.h
source/blender/makesdna/DNA_material_types.h
source/blender/makesdna/DNA_object_types.h
source/blender/render/intern/source/rendercore.c
source/blender/render/intern/source/shadbuf.c
source/blender/src/buttons_shading.c
source/blender/src/editscreen.c
source/blender/src/editview.c

index 103a9f23de1cc4ca2dc228287eb2fa097f7506ce..5c0843b1873b117e95a341ed90c5c7a12a326397 100644 (file)
@@ -3198,7 +3198,6 @@ static void lib_link_group(FileData *fd, Main *main)
                        }
                        if(add_us) group->id.us++;
                        rem_from_group(group, NULL);    /* removes NULL entries */
-                       
                }
                group= group->id.next;
        }
index e86bd962a6ce9760223d06d4881a4363eedeca52..63399be30d87f23501754b7ff2a64f39aaf9b352 100644 (file)
@@ -31,6 +31,7 @@
  */
 
 struct Group;
+struct Base;
 
 void add_selected_to_group(struct Group *group);
 void rem_selected_from_group(void);
index 9991148ad3d119dca6be770cee643e98aa16e747..8e150b10a823912dd00c1501c878a5d76729d857 100644 (file)
@@ -85,7 +85,7 @@ typedef struct Material {
        short flarec, starc, linec, ringc;
        float hasize, flaresize, subsize, flareboost;
        float strand_sta, strand_end, strand_ease;
-       float pad1;
+       float sbias;                    /* shadow bias */
        
        /* for buttons and render*/
        char rgbsel, texact, pr_type, pad;
index 88075e718debd30215be51b7e6e6731238e50df4..50243c268877b4e05f90ae8e002459c771d4c3e8 100644 (file)
@@ -326,7 +326,6 @@ extern Object workob;
 #define BA_HAS_RECALC_DATA     8
 
 #define BA_DO_IPO                      32
-#define OB_GONNA_MOVE          32
 
 #define BA_FROMSET                     128
 #define OB_DO_IMAT                     256
index 1a2f942fd2abafd03b85a3170878522c23b0934a..739b4a4757fb70b436d12c9ac277904ad4d559fc 100644 (file)
@@ -1658,6 +1658,12 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
                        else
                                phongcorr= 0.0;
                }
+               else if(ma->sbias!=0.0f) {
+                       if(inp>ma->sbias)
+                               phongcorr= (inp-ma->sbias)/(inp*(1.0-ma->sbias));
+                       else
+                               phongcorr= 0.0;
+               }
                else phongcorr= 1.0;
                
                /* diffuse shaders */
index c942232bebba0ddfef6d879a49cfbbfab0a2ab4a..9ff3c104d0ac01486b27566e12fe890379676ebf 100644 (file)
@@ -443,7 +443,7 @@ float testshadowbuf(struct ShadBuf *shb, float *rco, float *dxco, float *dyco, f
        int xs,ys, zs, bias;
        short a,num;
        
-       /* if(inp <= 0.0) return 1.0; */
+       if(inp <= 0.0) return 0.0;
 
        /* rotate renderco en osaco */
        siz= 0.5*(float)shb->size;
index 27504e1d2e03e0cfa309235c1e6dbc14345f99d2..f12707d7ac457a83334de2bcb978d4bfa3da7393 100644 (file)
@@ -3168,9 +3168,10 @@ static void material_panel_shading(Material *ma)
                        uiDefButF(block, NUMSLI, B_MATPRV, "rms:",     90, 100,150,19, &(ma->rms), 0.0, 0.4, 0, 0, "Sets the standard deviation of surface slope");             
                /* default shading variables */
                uiBlockBeginAlign(block);
-               uiDefButF(block, NUMSLI, B_DIFF, "Translucency ",       9,30,301,19, &(ma->translucency), 0.0, 1.0, 100, 2, "Amount of diffuse shading of the back side");
+               uiDefButF(block, NUMSLI, B_DIFF, "Tralu ",      9,30,150,19, &(ma->translucency), 0.0, 1.0, 100, 2, "Translucency, amount of diffuse shading of the back side");
+               uiDefButF(block, NUMSLI, B_DIFF, "SBias ",      159,30,151,19, &(ma->sbias), 0.0, 0.25, 10, 2, "Shadow bias, to prevent terminator problems on shadow boundary");
                uiDefButF(block, NUMSLI, B_MATPRV, "Amb ",              9,10,150,19, &(ma->amb), 0.0, 1.0, 0, 0, "Sets the amount of global ambient color the material receives");
-               uiDefButF(block, NUMSLI, B_MATPRV, "Emit ",             160,10,150,19, &(ma->emit), 0.0, 1.0, 0, 0, "Sets the amount of light the material emits");
+               uiDefButF(block, NUMSLI, B_MATPRV, "Emit ",             159,10,151,19, &(ma->emit), 0.0, 1.0, 0, 0, "Sets the amount of light the material emits");
                uiBlockEndAlign(block);
 
                uiBlockSetCol(block, TH_BUT_SETTING1);
index b95fc9f11bda1316f1d6a12059229b18b3a13f72..d703e1a53c8f994a14cb43c4c6108bf4525eabd5 100644 (file)
@@ -401,6 +401,7 @@ void scrarea_do_headdraw(ScrArea *area)
                case SPACE_NLA:         nla_buttons();          break;
                case SPACE_TIME:        time_buttons(area);     break;
                }
+               uiClearButLock();
 
                //glScissor(area->winrct.xmin, area->winrct.xmax, area->winx, area->winy);
                area->head_swap= WIN_BACK_OK;
index 458be9a0897ec394a613321bfe4070644dfc4627..73fff83f98dd9e65a846ff4005075d32ad5204a6 100644 (file)
@@ -1026,8 +1026,6 @@ static unsigned int samplerect(unsigned int *buf, int size, unsigned int dontdo)
 }
 #endif
 
-#define SELECTSIZE     51
-
 void set_active_base(Base *base)
 {
        Base *tbase;
@@ -1035,6 +1033,7 @@ void set_active_base(Base *base)
        BASACT= base;
        
        if(base) {
+               
                /* signals to buttons */
                redraw_test_buttons(base->object);
                
@@ -1060,13 +1059,11 @@ void set_active_object(Object *ob)
 {
        Base *base;
        
-       base= FIRSTBASE;
-       while(base) {
+       for(base= FIRSTBASE; base; base= base->next) {
                if(base->object==ob) {
                        set_active_base(base);
                        return;
                }
-               base= base->next;
        }
 }