** Use Turbo Mode (<Shift> key + Green Flag) ** The scene is redrawn 3 times in improving resolution. * Reflections in Ray Tracing are difficult for me! How should I combine direct light and reflected light? In this project I added 25% ambient reflected light and had the light source "straight on" to the scene so that the spheres reflected in each other. * I still need to make improvements - the same as for my first Ray Tracer with Reflections project: https://scratch.mit.edu/projects/390390900/ My algorithm is limited as I have not used coefficients for ambient, diffuse and reflected strengths for each RGB colour component for each object (sphere/plane). My algorithm is in the custom block: "Combine Primary Ray and Reflected Ray Colours". I use 25% ambient reflected light, diffuse reflected light intensity decreases with distance, and total RGB components cannot exceed 255. This project adds reflections to my previous project: 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 much faster to see the best resolution! https://turbowarp.org/391101389?turbo My Ray Tracer studio: https://scratch.mit.edu/studios/26312219/ 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.