ScratchData LogoScratchData
Back to Scratch-Minion's profile

Ray Tracer with 2 Textured Spheres - 1 Line Challenge

SCScratch-Minion•Created April 13, 2020
Ray Tracer with 2 Textured Spheres - 1 Line Challenge
8
5
75 views
View on Scratch

Instructions

This project modifies my 1 Line Challenge Ray Tracer: https://scratch.mit.edu/projects/383005859/ which has just the green and yellow textured sphere. I thought a more realistic Ray Tracer should have at least two overlapping objects in the picture. The Sphere is coloured using Ray Tracer logic and Ambient, Diffuse (Lambertian) and Specular Lighting. The light source is left, above and in front of the sphere. 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 (which have easier math) but other 3D objects. Ambient light is general background reflected light that even gets into dark places such as under a bed. Diffuse light (also known as Lambertian or matte) is stronger if light shines more "straight on" to a surface. Diffuse light is scattered in all directions and its intensity does not depend on where the viewer is. Specular reflected light produces the highlight on the sphere in the area where the light is reflected almost directly towards the viewer. This project implements Ambient, Diffuse and Specular light like my ray tracer project "Ray Tracer 3" except that that the rays there can strike more spheres: https://scratch.mit.edu/projects/381878751/ Another "1 Line Challenge" project. (over 3 years 8 months after the original challenge). A "1 Line Challenge project". See the "1 Line Challenge" rules in the original project. In "1 Line Challenge" projects, the colour of each pixel on the screen is calculated by one formula in the line "set pen color to …" 1 Line Challenge Studio: https://scratch.mit.edu/studios/2825709/ Scratch-Minion's favourite 1 Line Challenge projects: https://scratch.mit.edu/projects/126161130/ More favourite 1 Line Challenge projects: https://scratch.mit.edu/projects/163476084/

Description

A "1 Line Challenge project". See the "1 Line Challenge" rules in the original project. The first "1 Line Challenge" Raytracer, June 2016, by @Zro716 has a two colour textured sphere: https://scratch.mit.edu/projects/115046800/ @piano_miles has made a couple of 1LC Ray Tracers. The second is lit by two light sources and has quadratic light mixing and a RGB Filmic colourspace: https://scratch.mit.edu/projects/363334189/ https://scratch.mit.edu/projects/364538564/ 1 Line Challenge Studio: https://scratch.mit.edu/studios/2825709/ Scratch-Minion's favourite 1 Line Challenge projects: https://scratch.mit.edu/projects/126161130/ More favourite 1 Line Challenge projects: https://scratch.mit.edu/projects/163476084/

Project Details

Project ID384861675
CreatedApril 13, 2020
Last ModifiedApril 20, 2020
SharedApril 20, 2020
Visibilityvisible
CommentsAllowed

Remix Information

Parent ProjectView Parent
Root ProjectView Root