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

Pac-Man Arcade Edition

by lark2121

Project thumbnail
View Project

Talking tom and ben news remix remix-2 remix-3 remix remix remix

by everton_trader

Project thumbnail
View Project

I SHOW SPEED

by teamwolfmc93

Project thumbnail
View Project

all Talking Tom And Ben News HD V5 remix 2 remix remix

by everton_trader2

Project thumbnail
View Project

talking tom and ben news 8 but chocolate

by mibros77

Project thumbnail
View Project

The Sandbox

by -Yodasaurus-

Project thumbnail
View Project

Numberblocks Band 1-100 Quintillion (Part F:1Quintillion-100 Quintillion) remix

by Be-tchans

Project thumbnail
View Project

Trick

by Chacha88_

Project thumbnail
View Project

VR GAME

by gobro64

Project thumbnail
View Project

Beat up the app!

by kimileejo

Project thumbnail
View Project

Five dank nights at memes

by Cool_Awesomenes

Project thumbnail
View Project

Stickman Prison Escape

by SamsEpicGames_-12

Project thumbnail
View Project

Geometry Dash | A Platformer

by YungSky

Project thumbnail
View Project

Add a button to beat up Barney because why not?

by ty_says_hi

Project thumbnail
View Project

Ash Man AI Creation

by TwinDemise

Project thumbnail
View Project

Angry Birds Classic V.3

by ignaciofajardo23

Project thumbnail
View Project

Numberblocks Basics All Jumpscares (NEO)

by happy122111

Project thumbnail
View Project

Five Nights at Endros 2 v1.1.1

by EnderGamer7777

Project thumbnail
View Project

3Dマリオカートスペシャル モバイル対応 マイクロビット対応 3D Mario Kart SP mobile compatible Micro:bit compatible ver.3.1.0

by harukimario

Project thumbnail
View Project

As Told By Ginger

by aallyssion9875

Project thumbnail
View Project

Beat Up Talking Ben (FULL VERSION) [2]

by JPPORTUGAL

Project thumbnail
View Project

SUPER CAT SKY DX

by tomo119

Project thumbnail
View Project

beat up Greg Heffly but with big chungus in da backround

by potatoguy585

Project thumbnail
View Project

Interactive Spanish Alphabet Lore My Version

by aboodisthebes