Raymarch Simple Question
category: code [glöplog]
Hmm, yeh I think you're right. Some bias is needed somewhere.
Will continue playing with it.
Will continue playing with it.
When you cast the shadow ray, move the origin of the ray by a little bit (in the direction of the normal of the surface, or the direction of the ray). That should fix it.
Same is needed if you want to have mirrors...after you reflected the ray, you need to walk some small distance on it. Try it, you only need to put "rayDirection=reflect(rayDirection, normal);" after you found an intersection and calced your pixelColor, then travel a small distance (i use my epsilon=0.001, i also use as a bailout anyway, as in "if(distance<epsilon) HIT!" ) , then do another intersection-test, pixelColor+=mirrorStrength*mirrorPixelColor, et voila, Mirrors! :) While mirrorPixelColor is just another color you calculate like your pixelColor from your first Hit, so you add the color of the mirrored object; mirrorStrength is just sth like 0.25 or 0.5, as you dont want to mirror 100% normally.