3 Tetrahedra Compound - a Ray Tracer

3 Tetrahedra Compound - a Ray Tracer

by Scratch-Minion

👁 33 ❤️ 5 ⭐ 6 🔄 0
Created: May 13, 2021 Last modified: Sep 13, 2021 Shared: Sep 13, 2021

Description

Raytraced Intersecting Polyhedra studio: https://scratch.mit.edu/studios/30286682/ https://en.wikipedia.org/wiki/Compound_of_three_tetrahedra The Cartesian coordinates of a hexagonal antiprism, centered on the origin and having edge length 2, are: (±1, ±√3, √2) (±2, 0, √2) (±√3, ±1, −√2) (0, ±2, −√2) My Ray Tracing Projects studio: https://scratch.mit.edu/studios/26312219/ Ray Madness - a super raytracing & raycasting studio: https://scratch.mit.edu/studios/25849210/

Instructions

* Project runs much faster in TurboWarp: https://turbowarp.org/530291133?turbo * Else use Turbo Mode! (<Shift> key + Green Flag) Press <1> to view in best resolution (slow) Press <2> for medium resolution (slowish) Press <5> for low resolution (fast) like starting picture The 3 differently coloured tetrahedra intersect each other so that each triangle face is partially in front of and partially behind several other triangle faces. This makes the object hard to draw. It is easier to raytrace to each point on the screen and find the closest of the 12 triangles that make up the 3 tetrahedra compound and colour the point to match. Compound of 3 Tetrahedra: https://en.wikipedia.org/wiki/Compound_of_three_tetrahedra The Cartesian coordinates of a hexagonal antiprism, centered on the origin and having edge length 2, are: (±1, ±√3, √2) (±2, 0, √2) (±√3, ±1, −√2) (0, ±2, −√2) 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. For a ray to each (x,y) point on the screen, the code checks if and where the ray intersects each of the triangles that make up the 3 Tetrahedra Compound. The Z Intersect coordinate is calculated for each triangle intersection. The (x,y) point on the screen is coloured with the colour of the triangle with its Z Intersect coordinate closest to the viewer. My Ray Tracing Projects studio: https://scratch.mit.edu/studios/26312219/ Ray Madness - a super raytracing & raycasting studio: https://scratch.mit.edu/studios/25849210/

Project Details

Visibility
Visible
Comments
Enabled

More Cool Projects

Project thumbnail
View Project

Matematix’s SESNL Band but it’s Bren319’s Kazakh Alphabet Lore

by BackpackLeon

Project thumbnail
View Project

V 1 Tom and ben news remix-2 remix

by Olek32167xv

Project thumbnail
View Project

My NEW Russian Alphabet Lore

by jackmonkey15

Project thumbnail
View Project

Mii Gallery

by gannongamescom

Project thumbnail
View Project

Numberblocks Basics 7 Sprites, Gen 4.6 Styled

by Jason3424Maker-Newer

Project thumbnail
View Project

Angry Birds (Gamer Bird Edition) (New Angry Birds Scratch Game Coming soon)

by GameConsole2329

Project thumbnail
View Project

sprunki oc om nom

by OmNomChohPan

Project thumbnail
View Project

【五~七段】太鼓の達人 段位道場 ニジイロver. v2.3.3

by Kuppi-scratch

Project thumbnail
View Project

My Talking Friends By Disney Junior

by Alfie0209

Project thumbnail
View Project

sonic the hedgehog level creator

by SonicPRO889

Project thumbnail
View Project

Mappy Remix

by IsaacF2000

Project thumbnail
View Project

Wobbly Pen Demo

by RobFarley74

Project thumbnail
View Project

Mario buys a toaster

by GaleemDharkon

Project thumbnail
View Project

Optimized Shooter Test

by prodforer

Project thumbnail
View Project

タコスクリッカー ver1.4

by yuppinn1

Project thumbnail
View Project

Beat up Edward DLC

by gavinandrei23

Project thumbnail
View Project

Purple {A PLATFORM}#games

by Computer___Program

Project thumbnail
View Project

Super Mario All-Stars - Super Mario Bros. 3 remix remix remix

by AllyScratcher2016

Project thumbnail
View Project

リアルタイム地震ビューアー v1.3.1 JQuakeに接続できるか

by asagaonohirugao

Project thumbnail
View Project

Stay Put Survival: The Expansion Update

by OopsieDaisy_

Project thumbnail
View Project

Blue Mist Plus - 90s jumpscares

by Jharring20

Project thumbnail
View Project

Literally every GoAnimate OS video ever

by FNABBB

Project thumbnail
View Project

G,T,M,A,F EAS alarms has a remix remix

by Diegol112345_alt2

Project thumbnail
View Project

Endless extended letters and sounds remix with ultra

by JasonNy33