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

pilot of the galaxies v2.1.2

by P1389

Project thumbnail
View Project

Trump & Biden Play Minecraft

by mariohitsBlock

Project thumbnail
View Project

Quantum Science Energy Research Facility

by qserfworks

Project thumbnail
View Project

Numbertubes band 12 (FIXED)

by BlueyPlayer922

Project thumbnail
View Project

Cuphead Rumor Honeybottoms Boss Fight

by 4aidken944

Project thumbnail
View Project

Numbers 0 to Beyond NEVER!!!! [1]

by Universe8

Project thumbnail
View Project

Mac OS 9 Sounds

by childishbeat

Project thumbnail
View Project

Among Us in real life

by FutureTV

Project thumbnail
View Project

FNF vs Bunzo Bunny (Musical Memory)

by chucky_lee

Project thumbnail
View Project

オンラインにゃんこ大戦争/Online Battle Cats

by UXRCF

Project thumbnail
View Project

Uh oh, scratch bugs!

by MaciTheGamerYT

Project thumbnail
View Project

Yeardateblocks Band 360

by AidanScratchMaker

Project thumbnail
View Project

Jenny || Animation? Filler?

by WiserTacoAnimations

Project thumbnail
View Project

Bomb Defusal Manual

by BinDat

Project thumbnail
View Project

偽メメ村用日本語版アモングアスMOD2 v1.8

by fujisan223

Project thumbnail
View Project

The Horde V1.7

by insanetaco2000

Project thumbnail
View Project

Super Scratch fighting! v.1.3

by tonshi

Project thumbnail
View Project

[リアルガチ3D]弾幕

by s00384206

Project thumbnail
View Project

Numberblocks Band Quarters 15 (For HarryTheCreator3000)

by supersonicmikhail720

Project thumbnail
View Project

[ Undertale : Hard Mode ] Endless Breath RESANSTERED (Sansational Finale)

by Sans21121

Project thumbnail
View Project

Geometry Dash Yatagarasu

by iPhone_ATT_TWC115

Project thumbnail
View Project

3d Minecraft raycasting

by daveminon1

Project thumbnail
View Project

Minecraft - sort of. (100% pen, except for the thumbnail - so like, 99.9% pen)

by JackGreenAerth

Project thumbnail
View Project

Circle Wars! Version 1.2

by The_Blue_Snake