Share your repls and programming experiences

← Back to all posts
Ray Marching Renderer
01000001 (2)

This is a 3D renderer I wrote from scratch which uses tuples to represent Vector3s. It's not incredible, but I think it's interesting. I took on this project because I wanted to learn python, and this is actually my first program in python, and on replit. Enjoy!

Features:
Lighting
Shadows
Light Colour
Glow
Glow Colour

Extra notes:
If you go into the code and change blendObjects to True, the objects will be blended together. You can adjust how much with the smoothing variable

lightDirection is the opposite to the actual direction of the light

closestDistance is how close the ray gets to an object before returning the pixel data.

you can add in a custom distance function (e.g. def cubeDF(size, ray):)and plug it into distance4 in the main distance function or create distance5 for example and adding your variable into the min function. if object blending is enabled it's a bit more complicated but I'm sure you can figure it out ;)

Enjoy!