Raytracing 2D


Version 1.2

  • Raycater Draw mode Menu bug fixed
  • Raycaster Draw mode "Draw All" improved

Version 1.1

  • Added rectangle for moving the whole raycaster
  • Moving on scene now with clicking on the rendered image
  • Added 3 demo scenes
  • Interface improved
  • 2D - 3D render option added
  • Normalize to screen option added
  • Double menu removed


The main goal is to demostrate functionality of raytracing, more about raytracing on http://de.wikipedia.org/wiki/Raytracing and http://de.wikipedia.org/wiki/Raycasting


  • First start by creating a scene, go to Scene -> Demo Scene -> Empty (you can use this anytimeif you want to clear your scene)
  • Continue by adding some objects from Scene -> Add Object -> choose 1 of 4 objects
  • Drag and drop the single filled red point with mouse, to change te position of the raycaster
  • Drag and drop the two red nonfilled points to change the viewport
  • The two big circles (Raycaster in the middle) represents the perspective of view, for most natural render, keep the two circles over each other, so they form one circle
  • The single filled red point, with 8 rays, represents the light, you can change its position by drag and drop
  • By draging the red rectangle, you move the whole raycaster
  • You can move in the scene, by clicking on the 4 rectangle areas in the right render image
  • If you change an option (like "enable Light"), you have to raytrace the whole scene again, by going to Actions -> Raycast
  • If you want to achive a high end render (better resolution), place the viewport behind the object, try the 3 cubes demos

Known bugs

Cause of time shortage, i wasnt able to fix them all, if you can help, pls write me on my email peter.paulis (a*t) gmail (*d*o*t*) com

    The bellow specified errors are caused mostly the are connected to the interface and caused by the NetBeans interface designer (which has many bugs)

  • If the jPanel1 is removed, the canvases keep overpainting the menu, see : canavs overpainting menu image
  • By clicking to menu, it acts, like it was pressed 2 times (adding 2 cubes, rendering 2 times...)
  • Menu overpaints the draw panels, you need to click on the scene, and redraw it
  • Fix bug in menu, when "Raycaster -> Ray Draw Mode -> Draw To First Object" equals "Draw All"

    The bellow specified errors are caused by the data structure representing the object -> first vertex, determine the face color

  • The color of a face is given by the color of the first vertex, so when the ray strikes exectly the 2th vertex, a line of next face color is created, see this image
  • When the light strikes the vertex, which dont clear belong to any side, the vertex is drwen as in light, althrough the face (to which the vertex honors color) is in shadow, see this image

    Other errors

  • Perspective error by turning, thats cause of integer values

To do

  • Fix the above mentioned bugs
  • Create more scene presets (now there is only the "empty" presset)
  • interface improvment


Applet Raytracing 2D Author: Peter Paulis