Ray-tracer improvements (aka “Did you know our engine has ray-tracer?”)

Posted on

ray_tracer_textures
ray_tracer_smooth_1
ray_tracer_smooth_normals

I was playing with the ray-tracer inside Castle Game Engine this weekend. Although the focus of our engine is real-time rendering (not a software ray-tracer), but there is a distinct pleasure when you’re able to generate pretty images without the help of OpenGL:)

New ray-tracer features:

  • It can now use smooth normal vectors.
  • Classic ray-tracer supports now 2D textures, with bilinear or nearest filtering.
  • It looks at Background.skyColor.

You can try it out e.g. using view3dscene Ctrl + R (“Display -> RayTrace!” menu item). From code, you can use the CastleRayTracer unit.

The ray-tracer in CGE is still just a toy subproject for me. Our ray-tracer does not try to compete with professional, full-featured ray-tracing renderers existing today. But it is a nice demo that, using Castle Game Engine API, you can take a scene and create a decent ray-tracer, because

  1. All the necessary information about the 3D scene is available,
  2. You have a fast structure (octree) to perform ray collisions.

I hope that you enjoy it!:) If anyone here is interested in putting more work into this way of rendering (we have classic ray-tracer and a path-tracer), if you dream about creating a real, full-featured physically-based solution, than please join the development of CGE! I would happily see someone extend the CGE ray-tracer to render some really cool stuff! 🙂

An old gallery of images is here.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.