
3 Tetrahedra Compound - a Ray Tracer
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

the egg but I edited it
by theImaginegirl

BazMannBach's Russian Alphabet Lore TVOKids Updated remake
by wasted2841

Fidget spinner!
by BrilliantStar114

AY in Spot the Sneak: GD Lobotomy Edition [ Remix #1 - 2 Difficulties ] remix
by cybeville

fish color change
by Fizzel_top_hat

AYS|Bowser's Big Blast|DELUXE| remix
by -tunes-175

Super Mario 2D Universe Screenshot
by zmanbonus

sussy school grounds 4
by prosonicgamer

Sphere Crash - mobile
by -eblock-

アニメ FOURVERSE 第38話「裏切者」
by kesikesi_gomugomu

Dunk Shot v1.1 [Collab w/ RacingAce]
by kevin_eleven_1234

Alien Upgrade defense v1.1
by Railgunking2

Add A button to beat up scratch cat! (16D
by xanderafa

[201] Beat up Sonic Definitive Edition
by Pigmaster99

Miner Cat 4 (Scratch version)
by cat_fairy

Beat Up Princess Twilight Sparkle V2.6
by minecraftfurby

Beat Up Sonic ExtremeCore Editon
by JonDoe128

The Scratchers Movie Remastered DVD Menu (0)
by milli14

Tower Battles
by ROBLOX_GAMERzUwU

ZERO TIME TRIO
by ZERO722

Plans for Barney Error 1
by Dusty8686

Beat up X Button
by crazycrazybaby17

Incredibox - Sprunki bonus W.I.P
by davidgiraldomera45

False Reset: Undyne The Undying
by Cashcampbell