Skip to content

My first modular Ray tracing engine made for numworks calculator

Notifications You must be signed in to change notification settings

legoman0701/Numworks-Modular-Raytracing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Numworks-Modular-Raytracing

My first modular Ray tracing engine made for numworks calculator

Table of Contents

Credit

Blender Support

Template to add object manually

Somes images

For The futur

Huge thanks to Sebastian Lague https://www.youtube.com/watch?v=Qz0KTGYJtUk&t=1418s

to cs.princeton.edu https://www.cs.princeton.edu/courses/archive/fall00/cs426/lectures/raycast/sld017.htm

to antonako and idmean https://stackoverflow.com/a/6178290

and to Ray Tracing in One Weekend https://raytracing.github.io

Blender Support

To convert a blender scene into the raytracer I made a python script (its bad).

First to optimize the rendering engine if the object has sphere in its name is will be considered as a sphere with a fixed radius and nothing else

And if it has plane it will be considered as an infinite plane and nothing else

The spcript take 1 material per object and all the materials need to be just a Principled BSDF attached to a material output

Next all the meshes in your scene need to be tris not quad to convert them you can use the triangulate modifier: First add the modifier the object

image

Then apply it

image

Next, you need to select all the object in the scene and then run the script

image

The output of the script will be in a file named ‘scene.txt’.

image

Just copy the content of the file in the appropriate part of the code

Template to add object manually

mesh

{

    'type': 'mesh',
    'mesh': mesh,
    'position': (-0.91, -5.46, 22.11),
    'color': (1, 1, 1),
    'metallic': 0,
    'roughness': 1,
    'specular': 0,
    'emmisiveColor': (1, 1, 1),
    'emmisiveStrenght': 0
},

sphere

{
    'type': 'sphere',
    'position': (-1, 0, -7),
    'radius': 1,
    'color': (0, 1, 0),
    'metallic': 0,
    'roughness': 1,
    'specular': 0,
    'emmisiveColor': (1, 1, 1),
    'emmisiveStrenght': 0
},

plane

{
    'type': 'plane',
    'position': (0, -5.46001, 0),
    'normal': (0, 1, 0),
    'size': 5,
    'color': (1, 1, 1),
    'metallic': 0,
    'roughness': 1,
    'specular': 0,
    'emmisiveColor': (1, 1, 1),
    'emmisiveStrenght': 0
},

Somes images ! Some of these images and time might be outdated !

pc-11m 43s numworks n110 ~32h 10m 19s

image

pc-5m 12s numworks n110 ~12h 43m 6s

image

pc-30m 15s numworks n110 ~3j 1h 59m 11s

image

pc-20m 24s numworks n110 ~2j 1h 53m 42s

image

image

The numworks n110 take roughly 146,75 the time of my computer

For The futur

For the future of this project, I would like to add glass support and fix the glitches with the mesh and planes

Some’s optimization

And convert this code to C++ to make it into a Numworks app to run faster but i dont C how to do it (sorry)

(Sorry for bad English)