I've written my own 3D Game Engine (it took me a year) and I wanted to create a Raytracer that runs on my CPU (not the GPU!!)
For now, the ray tracing process is simplified like this:
- Cast a ray for each output pixel.
- If the current ray hits an object, set the output pixel color to "white"
- Otherwise set it to black
To increase the speed of the ray tracer, I added a spherical bounding box to each Entity. If the current ray intersects the bounding box, it will run the intersection tests with each triangle of the Entity.
I am using the quickest methods on ray-triangle-intersection and ray-point-distance but still each ray has to test every single triangle of each Entity that might be intersected.
As a result, it takes me over 5 minutes to render an object (1920x1080) with around 10000 polygons and I think that's not what I want.
Is there any way of reducing the amount of triangles that I need to check?
Greetings, Finn