I'm working on a raytracer and I don't want reinvent the wheel when it comes to file formats for 3D scenes. I also want to be able to test my program with scenes made by others. I'm a programmer not a 3D modeller.
Is there a 3D scene format specific or well-suited for raytracing?
The Fundamentals: Ray Tracing Versus Rasterization Rasterization is an object-based approach to scene rendering. Each object is painted with color first, then logic is applied to show only the pixels that are closest to the eye. By contrast, ray tracing colors the pixels first, then identifies them with objects later.
Monte Carlo ray tracing (MCRT) is a fundamental simulation method for central receiver systems(CRSs). MCRT is an effective method to describe the radiative flux distribution on the receiver surface reflected by either a single heliostat or all heliostats in a heliostat field.
Ray tracing makes it possible to determine the quality of the rendered image for image-forming systems, the distribution of light for illuminations systems, and much more.
When I wrote my ray tracer, I wrote an exporter for Blender (it's free). Blender itself can load dozens of formats, then a simple 20 line python script will give you the points you need.
The super nice feature is that within Blender you can convert all the model's faces to triangles. Most ray tracers will only work with triangles (or convert polygons to triangles internally). So having Blender do the heavy work of crunching those polygons is super nice.
To start with 20 lines of code will allow you to export just the polygons. From there, you can extend it to output materials, normals, etc. I like this method, because I can get the data I want in the format I want, but still have the option of importing more complex models.
Other methods will work, but you first have to figure out how to parse a file, then get it in the format you want. I'd rather code a ray tracer than a parser.
There really isn't a format specific to ray tracing (unless you count PovRay format). Ray tracing is a method of rendering images, which can be applied to any scene. People modeling scenes will be using the modeling software of their choice and save usually in the default format of the modeler.
It looks like you don't have any requirements to load a particular format (or you wouldn't be asking) so I'm guessing you just want to be able to import various geometry from around the net for testing. If that's the case, check out the ompf forum at: http://ompf.org/ They have a section with links to freely available scenes. You can get a feel for what's common there.
Another option is utilize the Open Asset Import Library: http://assimp.sourceforge.net/
this can import a large number of file formats for you. It loads them all into an internal data structure, which you can then process as you see fit. It uses a BSD license so it should be reasonably license compatible with whatever you're doing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With