Orange: New option "Shadow Bias", to extend the boundary between shadow or

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.
This commit is contained in:
Ton Roosendaal
2005-12-17 14:05:40 +00:00
parent 16aa8ea1b0
commit 128b187db1
9 changed files with 15 additions and 11 deletions

View 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;
}

View File

@@ -31,6 +31,7 @@
*/
struct Group;
struct Base;
void add_selected_to_group(struct Group *group);
void rem_selected_from_group(void);

View 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;

View 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

View 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 */

View 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;

View 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);

View 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;

View 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;
}
}