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

1k Block Demo

by jfs22

Project thumbnail
View Project

Five Nights At Scratch

by phillipsgames

Project thumbnail
View Project

対戦型 シューティング「Charg Shoht!」ver.9

by nori38

Project thumbnail
View Project

[スクリプト演奏] bling-bang-bang-born_Creepy Nuts

by qoochaen

Project thumbnail
View Project

Beat Up Evilbross 2 V0.3

by meowflash

Project thumbnail
View Project

Beat Up Talking Ben 2 (Birthday Special)

by JonDoe128

Project thumbnail
View Project

Spiffy Pictures.EXE Buttons G

by DavidJabezScratch

Project thumbnail
View Project

アニメ FOURVERSE 第37話「渡る地獄は鬼ばかり」

by kesikesi_gomugomu

Project thumbnail
View Project

Beat Up masha (2)

by pmz34

Project thumbnail
View Project

Ultra Numberblocks Night 2020 (With Old Five Mod)

by AbedinIsBack

Project thumbnail
View Project

Ball Physics Ball-to-ball collisions - Attempt 1

by Haluria_games

Project thumbnail
View Project

talking tom and ben news HD

by Jose52theNauttp

Project thumbnail
View Project

Beat Up Dark Snapchat

by BentleeFan77

Project thumbnail
View Project

Appel Awakening v1.5

by swskrei

Project thumbnail
View Project

sky ボールころころ25 superhardmode! finalstage1

by skyblueball2

Project thumbnail
View Project

VALORANT 2D [NEW MAP] #games #all

by high_digital

Project thumbnail
View Project

The MouseHeadz + 11 MouseHeadz YES LOL + Talking Tom & Friends (fixed) remix copyedremix3

by scratch_master2015

Project thumbnail
View Project

Numberblocks Band Halves (Version 2 + For MrBond)

by atakan9

Project thumbnail
View Project

SCRATCH- DOORS #all #games

by Fluffypalz

Project thumbnail
View Project

The Backrooms - NextBot Chase V.1.7.2

by ScratchMyArm097

Project thumbnail
View Project

Ball insanity (Remix)

by minecraftbauer

Project thumbnail
View Project

EmeraldKart | Alpha 3 #games #scratch #racing

by AlexStudiosinc

Project thumbnail
View Project

Scratch Marble Race (v1.5)

by bigg_froggee

Project thumbnail
View Project

逃走中

by torikoma