some tuning
This commit is contained in:
@@ -89,7 +89,7 @@ static inline void vnormalize(vec &v) {
|
|||||||
|
|
||||||
__inline
|
__inline
|
||||||
static void
|
static void
|
||||||
ray_plane_intersect(Isect &isect, Ray &ray, const uniform Plane &plane) {
|
ray_plane_intersect(Isect &isect, Ray &ray, const Plane &plane) {
|
||||||
float d = -dot(plane.p, plane.n);
|
float d = -dot(plane.p, plane.n);
|
||||||
float v = dot(ray.dir, plane.n);
|
float v = dot(ray.dir, plane.n);
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ ray_plane_intersect(Isect &isect, Ray &ray, const uniform Plane &plane) {
|
|||||||
|
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
ray_sphere_intersect(Isect &isect, Ray &ray, const uniform Sphere &sphere) {
|
ray_sphere_intersect(Isect &isect, Ray &ray, const Sphere &sphere) {
|
||||||
vec rs = ray.org - sphere.center;
|
vec rs = ray.org - sphere.center;
|
||||||
|
|
||||||
float B = dot(rs, ray.dir);
|
float B = dot(rs, ray.dir);
|
||||||
@@ -182,7 +182,7 @@ orthoBasis(vec basis[3], vec n) {
|
|||||||
|
|
||||||
__inline
|
__inline
|
||||||
static float
|
static float
|
||||||
ambient_occlusion(Isect &isect, const uniform Plane &plane, const uniform Sphere spheres[3],
|
ambient_occlusion(Isect &isect, const Plane &plane, const Sphere spheres[3],
|
||||||
RNGState &rngstate) {
|
RNGState &rngstate) {
|
||||||
float eps = 0.0001f;
|
float eps = 0.0001f;
|
||||||
vec p, n;
|
vec p, n;
|
||||||
@@ -238,8 +238,8 @@ static inline void ao_tiles(
|
|||||||
uniform int nsubsamples,
|
uniform int nsubsamples,
|
||||||
uniform float image[])
|
uniform float image[])
|
||||||
{
|
{
|
||||||
const uniform Plane plane = { { 0.0f, -0.5f, 0.0f }, { 0.f, 1.f, 0.f } };
|
const Plane plane = { { 0.0f, -0.5f, 0.0f }, { 0.f, 1.f, 0.f } };
|
||||||
const uniform Sphere spheres[3] = {
|
const Sphere spheres[3] = {
|
||||||
{ { -2.0f, 0.0f, -3.5f }, 0.5f },
|
{ { -2.0f, 0.0f, -3.5f }, 0.5f },
|
||||||
{ { -0.5f, 0.0f, -3.0f }, 0.5f },
|
{ { -0.5f, 0.0f, -3.0f }, 0.5f },
|
||||||
{ { 1.0f, 0.0f, -2.2f }, 0.5f } };
|
{ { 1.0f, 0.0f, -2.2f }, 0.5f } };
|
||||||
@@ -281,8 +281,8 @@ static inline void ao_tiles(
|
|||||||
|
|
||||||
// Note use of 'coherent' if statement; the set of rays we
|
// Note use of 'coherent' if statement; the set of rays we
|
||||||
// trace will often all hit or all miss the scene
|
// trace will often all hit or all miss the scene
|
||||||
#if 0
|
#if 0
|
||||||
if (isect.hit) {
|
cif (isect.hit) {
|
||||||
ret = ambient_occlusion(isect, plane, spheres, rngstate);
|
ret = ambient_occlusion(isect, plane, spheres, rngstate);
|
||||||
ret *= invSamples * invSamples;
|
ret *= invSamples * invSamples;
|
||||||
res += ret;
|
res += ret;
|
||||||
@@ -294,8 +294,6 @@ static inline void ao_tiles(
|
|||||||
ret *= invSamples * invSamples;
|
ret *= invSamples * invSamples;
|
||||||
res += ret;
|
res += ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user