|
|
On 6/19/24 18:16, William F Pokorny wrote:
> I'll look at this tomorrow.
In source/core/lighting/photons.cpp there are two methods:
void PhotonTrace::addSurfacePhoton()
void PhotonMediaFunction::addMediaPhoton()
which have code like:
if ((photonLight->Fade_Power > 0.0) &&
(fabs(photonLight->Fade_Distance) > gkMinIsectDepthReturned))
{
Attenuation = 2.0 /
(1.0 + pow(threadData->photonDepth /
photonLight->Fade_Distance, photonLight->Fade_Power)
);
}
else
Attenuation = 1;
In both methods, the code needs to be something like:
if (photonLight->Fade_Power > 0.0)
{
if (fabs(photonLight->Fade_Distance) >= gkMinIsectDepthReturned)
{
Attenuation = 2.0 /
(1.0 + powf(threadData->photonDepth /
photonLight->Fade_Distance,
photonLight->Fade_Power
)
);
}
else if (threadData->photonDepth >= gkMinIsectDepthReturned)
{
Attenuation =
powf(threadData->photonDepth,-photonLight->Fade_Power);
}
else
{
Attenuation = 0.0;
}
}
else if (photonLight->Fade_Power == 0)
{
Attenuation = 1;
}
else
{
Attenuation = 0.0;
}
Bill P.
Aside: I moved pow to powf as the latter often much faster and float
accuracy is fine for attenuation. It might be official releases are
already running 'pow()' with floats without code that forces it.
Post a reply to this message
|
|