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
Spiffy.exe Jumpscare
by lateone1
Beat up Nano
by crazycrazybaby17
KyleWare TWISTED remix
by SRash75
Scratch Day 2025 in □□
by 1296-cat
proof im real c coil remix
by C_Coil
Star wars Battlefront
by Aperture_Innovations
Pseudorandom Number Generator
by -Rex-
Cloud Platformer Multiplayer Fun v1.42
by griffpatch
My talking Pinki remix
by Mateo03212018
chat room DA OSU
by robolae
After 1NV - 1TG Was Canned (Ep 3): WOPPAR!
by obocCONTINUED
Dandy's World: in The Mother Goose Sing Along Video Experience! (1993) End Credits
by PeppaDoesScratch
Fidget spinner 5.0
by Straw_Guy
Scratch 3.0 Platformer
by theSparky
Geometry Dash Sonic Wave Rebirth
by star7755
ink!flowey v6.33
by 2345632
beat up the scratch cat 2 v2.2
by astrocreeper30
B-Ttale espe fight!
by bouningen-kun
Artistic Text V2
by W2KFisback
beat up scratch cat 2! but you can see the world record holder
by JD1311114
Baserun's Beat up Pico
by newmyles
My Whiz Kid Reimagined: Animations and Sounds (fixed)
by hjjghjjg
Spiffy Pictures.EXE Buttons I,J,K,L,M AND N Fixed remix
by yenmuturises
Windows Vista Crazy Error
by Nicolasf1109scratch