|
Post by aditya on Oct 17, 2024 6:47:48 GMT
Hey guys, I was in the Shadows chapter and came across this issue: I have passed the tests of shadows acne...n have updated the ShadeHit function with IsShadowed...But for some reason the walls, and floor are still having the acne problem. Here is the code for IsShadowed: bool IsShadowed(World w, Entity point) { // Vector from point to light source Entity v = Subtract(w.light.position, point); // Magnitude of that vector and it's direction float distance = Magnitude(v); Entity direction = Normalize(v); // Create a ray from the point to the light source Ray r(point, direction); // Get list of intersections in the path of the ray std::vector<Intersection> intersections = IntersectWorld(w, r); Intersection h = Hit(intersections); if (h.t != INFINITY && h.t < distance) return true; else return false; } Could anyone please help me with this
|
|