soft shadows working better after replacing M_2_PI with 2.0 * M_PI since M_2_PI is 2/pi, not 2*pi...
git-svn-id: svn://anubis/fart/trunk@258 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
parent
57a4e6ed8a
commit
7fdb084aad
@ -232,16 +232,12 @@ Color Scene::computePhong(const refptr<Material> material,
|
|||||||
int jitter_samples = 0, jitter_level = (*it)->getJitter();;
|
int jitter_samples = 0, jitter_level = (*it)->getJitter();;
|
||||||
for (int jitter_index = 0; jitter_index < jitter_level; jitter_index++)
|
for (int jitter_index = 0; jitter_index < jitter_level; jitter_index++)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
double offset = ((double)rand()) / RAND_MAX * M_2_PI;
|
|
||||||
#endif
|
|
||||||
double offset = 0.0;
|
|
||||||
double jitterRadius = jitter_index * lightRadius
|
double jitterRadius = jitter_index * lightRadius
|
||||||
/ (jitter_level - 0.5);
|
/ (jitter_level - 0.5);
|
||||||
for (int i = 0, num = (int) (M_PI * jitter_index) + 1; i < num; i++)
|
for (int i = 0, num = (int) (M_PI * jitter_index) + 1; i < num; i++)
|
||||||
{
|
{
|
||||||
jitter_samples++;
|
jitter_samples++;
|
||||||
double jitter_angle = offset + i * M_2_PI / num;
|
double jitter_angle = i * 2.0 * M_PI / num;
|
||||||
Vector jitterPosition = lightC
|
Vector jitterPosition = lightC
|
||||||
+ lightPlaneX * jitterRadius * cos(jitter_angle)
|
+ lightPlaneX * jitterRadius * cos(jitter_angle)
|
||||||
+ lightPlaneY * jitterRadius * sin(jitter_angle);
|
+ lightPlaneY * jitterRadius * sin(jitter_angle);
|
||||||
|
@ -14,8 +14,8 @@ scene
|
|||||||
|
|
||||||
light
|
light
|
||||||
{
|
{
|
||||||
position <-1, -3, 4>
|
position <-5, -15, 20>
|
||||||
jitter 3
|
jitter 5
|
||||||
}
|
}
|
||||||
|
|
||||||
plane
|
plane
|
||||||
|
Loading…
x
Reference in New Issue
Block a user