** Use Turbo Mode (<Shift> key + Green Flag) ** The scene is redrawn 3 times in improving resolution. This project adds texture to the spheres and casts shadows compared to my previous Ray Tracer: https://scratch.mit.edu/projects/389235995/ A "Ray Tracer" traces rays from the viewer through each pixel on the screen and calculates which object it hits first in 3D space (ie. which object is closest). The pixel is coloured with the colour of that object. More advanced Ray Tracers add different types of lighting, shadows and reflections of other objects. They also include not just spheres and planes (which have easier math) but other 3D objects. In this project the lighting has 3 components: - Ambient Light - general background reflected light that even gets into dark places such as under a bed - Diffuse Light - sphere lighting that is stronger if the light shines more "straight on" towards the sphere. (Diffuse Light Intensity does not depend where the viewer is) - Specular Reflected Light - the highlight produced when light is reflected off a sphere almost directly towards the viewer. Ray Tracing math at: https://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-sphere-intersection https://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-plane-and-ray-disk-intersection * I haven't written code in my Distance to Plane custom block to check the denominator is not zero.
** TurboWarp is faster to see the best resolution! https://turbowarp.org/389568035?turbo My Ray Tracer studio: https://scratch.mit.edu/studios/26312219/ A Ray Tracing studio with many fancier examples: https://scratch.mit.edu/studios/25849210/ Ray Tracing math at: https://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-sphere-intersection https://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-plane-and-ray-disk-intersection * I haven't written code in my Distance to Plane custom block to check the denominator is not zero.