Skip to content

Commit c5afcec

Browse files
committed
Fixed broken shadows.
1 parent 7b22bda commit c5afcec

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

source/backend/render/trace.cpp

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,11 +1597,11 @@ void Trace::ComputeOneDiffuseLight(LightColour& colour, const LightSource &light
15971597
}
15981598

15991599
ComputeClassicColour(colour, lightColour, layer_pigment_colour, eye.Direction, lightsourceray.Direction, layer_normal, finish, ipoint, relativeIor, attenuation, backside,
1600-
// NK rad - don't compute highlights for radiosity gather rays, since this causes
1601-
// problems with colors being far too bright
1602-
// TODO FIXME radiosity - is this really the right way to do it (speaking of realism)?
1603-
// don't compute highlights for diffuse backside illumination
1604-
(lightsource.Light_Type != FILL_LIGHT_SOURCE) && !eye.IsRadiosityRay() && !backside);
1600+
// NK rad - don't compute highlights for radiosity gather rays, since this causes
1601+
// problems with colors being far too bright
1602+
// TODO FIXME radiosity - is this really the right way to do it (speaking of realism)?
1603+
// don't compute highlights for diffuse backside illumination
1604+
(lightsource.Light_Type != FILL_LIGHT_SOURCE) && !eye.IsRadiosityRay() && !backside);
16051605
}
16061606
}
16071607

@@ -1656,7 +1656,6 @@ void Trace::ComputeFullAreaDiffuseLight(LightColour& colour, const LightColour&
16561656
double jitter_u = (double)u;
16571657
double jitter_v = (double)v;
16581658
bool backside = false;
1659-
LightColour tmpCol;
16601659

16611660
if(lightsource.Jitter)
16621661
{
@@ -1719,11 +1718,11 @@ void Trace::ComputeFullAreaDiffuseLight(LightColour& colour, const LightColour&
17191718
}
17201719

17211720
ComputeClassicColour(colour, attenuatedLightcolour, layer_pigment_colour, eye.Direction, lsr.Direction, layer_normal, finish, ipoint, relativeIor, attenuation, backside,
1722-
// NK rad - don't compute highlights for radiosity gather rays, since this causes
1723-
// problems with colors being far too bright
1724-
// TODO FIXME radiosity - is this really the right way to do it (speaking of realism)?
1725-
// don't compute highlights for diffuse backside illumination
1726-
(lightsource.Light_Type != FILL_LIGHT_SOURCE) && !eye.IsRadiosityRay() && !backside);
1721+
// NK rad - don't compute highlights for radiosity gather rays, since this causes
1722+
// problems with colors being far too bright
1723+
// TODO FIXME radiosity - is this really the right way to do it (speaking of realism)?
1724+
// don't compute highlights for diffuse backside illumination
1725+
(lightsource.Light_Type != FILL_LIGHT_SOURCE) && !eye.IsRadiosityRay() && !backside);
17271726
}
17281727
}
17291728
}
@@ -2273,7 +2272,7 @@ void Trace::ComputeShadowColour(LightColour& colour, const LightSource &lightsou
22732272
if(fabs(resultColour.Weight()) < lightsourceray.GetTicket().adcBailout)
22742273
{
22752274
// close enough to full shadow - bail out to avoid media computations
2276-
resultColour.Clear();
2275+
colour.Clear();
22772276
return;
22782277
}
22792278

@@ -2352,7 +2351,7 @@ void Trace::ComputeDiffuseColour(LightColour& colour, const LightColour& lightCo
23522351
colour += intensity * pigmentColour * lightColour * cs1 * cs2;
23532352
}
23542353
else
2355-
colour += intensity * pigmentColour * lightColour;
2354+
colour += intensity * pigmentColour * lightColour;
23562355
}
23572356

23582357
void Trace::ComputePhongColour(LightColour& colour, const LightColour& lightColour, const AttenuatingColour& pigmentColour,
@@ -2361,7 +2360,6 @@ void Trace::ComputePhongColour(LightColour& colour, const LightColour& lightColo
23612360
{
23622361
double cos_angle_of_incidence, deviation, intensity;
23632362
Vector3d reflectToLight;
2364-
AttenuatingColour cs;
23652363

23662364
cos_angle_of_incidence = -dot(normal, fromEye);
23672365

@@ -2371,7 +2369,7 @@ void Trace::ComputePhongColour(LightColour& colour, const LightColour& lightColo
23712369

23722370
if(deviation > 0.0)
23732371
{
2374-
if((finish->Phong_Size < 60) || (cos_angle_of_incidence > 0.0008)) // rgs
2372+
if((finish->Phong_Size < 60) || (deviation > 0.0008)) // rgs
23752373
{
23762374
intensity = finish->Phong * pow(deviation, (double)finish->Phong_Size);
23772375

0 commit comments

Comments
 (0)