Share this post

Link to post

Share on other sites

it looks like your light source is intersecting the sphere, and that the light itself has an actual size (and isn't an infinitely small point) which is good, but you're not handling the intersection case properly - or aren't preventing intersections from occuring in the first place.

where maxDist is length of ray (t) from each surface point to the light. The reason why I have to stop the ray when it reaches the light is because if the ray is coming from behind the light, and the occluder is on the other side of the light, if I don't stop the ray, it will overshoot and still capture the occluder. Here is what happens when I remove the "break":

[attachment=16761:givoxshadows3.jpg]

So the break function prevents this from happening; however, it creates another artifact, which is the sudden changes in lighting, like so:

[attachment=16762:givoxshadows4.jpg]

I have now figured out what causes this. It only occurs at locations where the distance from the surface point to the occluder is equal to the distance from the surface point to the light (maxDist). On one side of these points, t < maxDist, thus this side is darker. On the other side, t >= maxDist so this side is lighter.

Now I just wish I could figure out how to get it to gradually fade between lighting intensities. Please provide any advice or thoughts if you have any.

Share this post

Link to post

Share on other sites

I've seemed to have minimized the problem by reducing the softness of the penumbras via changing this formula:

5.0*mDist/clamp(t,0.0,5.0)

50.0*mDist/clamp(t,0.0,5.0);

The issue still exists but only when the light is right on the surface of an object.

Now what I'm trying to do is to attach the raymarched shadows to the rasterized objects in the scene. At the moment I'm just testing with a simple box and a sphere, later on I will raymarch more complex objects like the buddha through use of a volume texture.

Right now though, my problem is that the shadow-casting objects themselves are also occluded by their own shadows - i.e. incorrect self-shadowing:

[attachment=16821:givoxshadows5.jpg]

Notice how both the sphere and box are both much darker when they should be lit directly by the light.

Share on other sites

I had to slightly reduce the size of the signed distance version of the models so that the light-facing surface of the rasterized models were not shadowed by the signed distance objects.

Now all I have to do is to figure out a fast way of shadowing more complex objects like the buddha. I have heard that you can voxelize that model into a 3D texture and then raymarch. I have previously cone-traced this model to produce shadows but they were ugly due to the low-res 3d texture. If I increase the resolution then it becomes too expensive.

Alternatively, a volume rendering approach involves taking the difference between the front and back faces to get the ray-march directions, but for shadow ray-marching the direction is known because it is always in the direction of the light.