views:

537

answers:

5

I want to play around with some graphics stuff. Simple animations and things. I want to fool around with raytracing too. I need help finding a library that will help me do these things. I have a few requirements:

  • Must be able to do raytracing
  • Must be for a high level language (python, .NET, etc.). Please no C/C++
  • Must have good documentation, preferably with examples.

Does anyone know of a good library i can use to fool around with?

+5  A: 

Have a look at blender.org - it's an open-source 3d project with python scripting capabilities.

Richard Inglis
+2  A: 

I'm not aware of any libraries that satisfy your request (at least not unless I decide to publish the code for my own tracer...).

Writing a tracer isn't actually that hard anyway. I'd strongly recommend getting hold of a copy of "An Introduction to Ray Tracing" by Glassner. It goes through the actual math in relatively easy to understand terms, and also has a whole section on "how to write a ray tracer".

In any event, a "library" isn't all that much use on its own - pretty much every ray tracer has its own internal libraries but they're specific to the tracer. They typically include:

  1. a base class to represent 3D objects
  2. subclasses of that for each geometric primitive
  3. vector and matrix classes (3D and 4D)
  4. texturing functions and/or classes
  5. light classes of various types (point light, spot light, etc)

For my own tracer I actually used the javax.vecmath packages for #3 above, but had to write my own code for #1 and #2 based on the Glassner book. The whole thing is well under 2k lines of code, and most of the individual classes are about 40 lines long.

Alnitak
+1  A: 
Zhaph - Ben Duguid
A: 

The well developed raytracers that are open source are

For realtime 3D (it will be language dependant of course) there is JMonkeyEngine (Java) not sure whether that meets your "high level language" requirement.

You could consider a 3D game scripting language too, like GameCore or BlitzBasic

Richard Nichols
+4  A: 

First thing that come to my mind is the popular open source P.O.V Raytracer (www.povray.org). POV scenes are defined entirely with script files, and some people made Python code to generate them easily.

http://code.activestate.com/recipes/205451/

http://jabas-unblog.blogspot.com/2007/04/easy-procedural-graphics-python-and-pov.html

Jem