Arauna ray tracer back

(L) [2006/08/25] [Phantom] [Arauna ray tracer] Wayback!

There are too few pictures on this forum, so here's a new one.


[IMG #1 ]


I finally added back all sorts of features to my ray tracer. Implemented:


- Texture mapping (with bilerp);

- Shadows from multiple light sources;

- Reflections.


More soon.
_________________
--------------------------------------------------------------

Whatever
[IMG #1]:Not scraped: https://web.archive.org/web/20061004001323im_/http://www.bik5.com/cloister.jpg
(L) [2006/08/25] [Ho Ho] [Arauna ray tracer] Wayback!

Looks nice but a bit too dark.


Timings on 3.2G Conroe:

average ~6.5-6FPS

average 8Mray/s

max 17Mray/s when passing the white thing really close.


kdlog:
(L) [2006/08/25] [Phantom] [Arauna ray tracer] Wayback!

Thanks for the action report. 17M is nice (~3.5x what I get here on a Core2Duo).


About the source: I've been struggling with refraction for several days now (all the other things took one day each), and I really want that to work first. Also, under some circumstances, the reflections have artifacts (you may have spotted the occasional dark line of pixels).


Besides that, the code is 'perfect'. I'm especially happy with the way I organized all the tracing code: Separate paths for bih/kd, reflection rays, refraction, shadows and primary rays for various reasons, plus several intersection routines, all __forceinlined.


Ow and the shading code could use sse2.
_________________
--------------------------------------------------------------

Whatever
(L) [2006/08/25] [TomPie] [Arauna ray tracer] Wayback!

Good that there is some movement back to the real roots of ray tracing. We want more than cheap raster graphics [SMILEY Wink].

To convince more than the enthusiasts we have to put back in all the nice (and correct) effects.

Nice image and effects (although a bit too dark in general and too bright at the fountain).


 Tom
(L) [2006/08/25] [TomPie] [Arauna ray tracer] Wayback!

On my Pentium-M 1.5 GHz notebook:


About 1.2 FPS avg., max about 2 FPS

max rays/s: 2872k

min rays/s: 110k
(L) [2006/08/26] [funky] [Arauna ray tracer] Wayback!

(L) [2006/08/26] [Phantom] [Arauna ray tracer] Wayback!

@Funky:


What kind of tay tracer is this? Looking at the noise, it seems to be a path tracer?


@TomPie:


The last Siggraph had several calls for nicer graphics in the RTRT scene. I agreed very much, so I stopped working on raw ray speed and decided to put back some nice features that I once had.


Problem is, a 'bare bones' kd/ray packet/sse2 tracer can be implemented in about 500 lines, while a full featured one requires special paths for about everything. That also means that when you change something, you need to change it in 8 places, and when you look for a specific bit of code, you need to wade through tons of lines. I am only a spare time coder, so focussing on raw ray traversal performance seemed a good idea.


My Arauna tracer tries to solve some of the scope problems using convenient code splits (I actually include .cpp files, since you still want control over code order) and uniform interfaces to the kd traversal code and bih traversal code. This way, kd and bih use the same intersection codes, intersection code is in a separate file, and so are the traversal routines. The core functions for refraction, reflection and shadows are common for all data structures and thus reside in a single source file.


I hope I can have both worlds this way: Quick and easy changes, maintainability, raw performance and a decent feature set. Seems to work so far. Adding diffuse reflections would be a piece of cake for example.
_________________
--------------------------------------------------------------

Whatever
(L) [2006/08/26] [Phantom] [Arauna ray tracer] Wayback!

Looks great. The cruiser is a bit too light though. [SMILEY Smile]
_________________
--------------------------------------------------------------

Whatever
(L) [2006/08/26] [Phantom] [Arauna ray tracer] Wayback!

Here's another one. Refraction is working more or less. Still didn't figure out how to adjust the pluecker test for 16 rays to intersect back facing triangles, so what you see are rays refracted by the first hit only. The bunny is also reflective, so it looks like glass. Index of refraction is 1.1. Ray statistics are correct again, so yes, refraction is *very* expensive. Adding the bunny halves the ray/s figure (though it also adds 60k of triangles, but that doesn't justify the lower speed on it's own).


[IMG #1 ]


I also added a global brightness thingy so it's not so dark anymore. [SMILEY Smile]
_________________
--------------------------------------------------------------

Whatever
[IMG #1]:Not scraped: https://web.archive.org/web/20061004001323im_/http://www.bik5.com/bunny.jpg
(L) [2006/08/26] [TomPie] [Arauna ray tracer] Wayback!

I have been to SIGGRAPH, too. I found it very interesting that people want nice graphics again. That´s the right move..

Your comment on full featured ray tracers brings us back to the discussion of the use of SSE, special paths etc. I guess its a matter of goals. If you want the fastest ray tracer on earth, do all that. If you want a maintainable ray tracer, don´t do all that. Or take a long look at the problem and come up with a good design. Your approach is one way to do it.


I was "non-coding" for some time now. I think I found a nice new problem to start again. Problem is: When to do it. I have a spare slot from 2 to 4 am [SMILEY Cool]


Tom
(L) [2006/08/28] [Phantom] [Arauna ray tracer] Wayback!

It should have (almost) been that simple. I also have some tests against the normal, which I obviously had to swap as well. However, even with these modifications in place, the calculated u and v seem to be incorrect. I'm implementing single-ray traversal for kd and bih now to make debugging easier. I also suspect that single rays are faster for refraction, so I can test that as well.
_________________
--------------------------------------------------------------

Whatever
(L) [2006/09/01] [Phantom] [Arauna ray tracer] Wayback!

Another one:


[IMG #1 ]


It doesn't look much more complicated than the previous ones, but I'm actually quite happy at the moment: Artifacts are gone (you can now view objects from any direction instead of having to carefully find a camera view that doesn't show gaps), recursive reflections are in (check the faint reflection of the sphere in the ground plane), intersecting reflective surfaces work, and last but not least, recursive diffuse reflections.


For this image, I set the max recursion depth to 3, resolution is 800x512, with 2x2 supersampling. Diffuse reflection is done using 16 rays:


- First a normal plane for R is generated: R = Viewdir - 2 * N dot Viewdir * N, U = R cross Viewdir, V = U cross R.

- Sixteen rays are aimed at this plane, starting at the intersection point, distributed over a regular grid offset using the Mersenne twister.

- The distance of this plane along R corresponds to the diffuse-ness.


The average of the 16 rays is added to the color found at the first intersection point.


Right now the diffuse reflection is very expensive; most calculations are done on a per-ray basis. I'll optimize. [SMILEY Smile]


EDIT: The red dot is a bug tracing probe thingy. Please ignore it if you can after reading this.
_________________
--------------------------------------------------------------

Whatever
[IMG #1]:Not scraped: https://web.archive.org/web/20061004001323im_/http://www.bik5.com/diffuse.jpg
(L) [2006/09/01] [olliej] [Arauna ray tracer] Wayback!

Oooh shiny [SMILEY Very Happy]


Of course it must have a low polygon count as raytracing doesn't cope well with geometric complexity [SMILEY Wink]
(L) [2006/09/01] [Ho Ho] [Arauna ray tracer] Wayback!

in the coister model there are 81410 faces and 40973 vertices. I'm not sure if those spheres are in there or not.

81k tris is not that much but not that few either.
_________________
In theory, there is no difference between theory and practice. But, in practice, there is.

Jan L.A. van de Snepscheut
(L) [2006/09/05] [Phantom] [Arauna ray tracer] Wayback!

The sun was shining, so I hopped in my car today and drove to Sponza... Took a picture too:


[IMG #1 ]
_________________
--------------------------------------------------------------

Whatever
[IMG #1]:Not scraped: https://web.archive.org/web/20061004001323im_/http://www.bik5.com/oldcar.jpg
(L) [2006/10/04] [beason] [Arauna ray tracer] Wayback!

Awesome images and speed. I have a really stupid question, and sorry if this is off-topic, but if you don't mind:


How do you render the text overlay? Is that a custom bitmap font or some library..?


Also, I forget.. what is the noise along left column of pixels for again?


Thanks!
(L) [2006/10/04] [tbp] [Arauna ray tracer] Wayback!

Please think of the children and forget about that unreadable - vectorial if i remember - font [SMILEY Wink]


Grab a glyph packer like [LINK http://www.angelcode.com/products/bmfont/] if you're not into writing a quadtree allocator, waste 4k in a read-only section of your binary to stuff that bitmap, then texture/blit/compose text with proper kerning.

Voilà.
_________________
May you live in interesting times.

[LINK https://gna.org/projects/radius/ radius] | [LINK http://ompf.org/ ompf] | [LINK http://ompf.org/wiki/ WompfKi]
(L) [2006/10/05] [toxie] [Arauna ray tracer] Wayback!

Real men design their fonts directly in the source-code as bitmasks or integer-arrays. ;)
_________________
Eat plutonium death you disgusting alien weirdos!
(L) [2006/10/05] [tbp] [Arauna ray tracer] Wayback!

Real Men code a gizmo that automatically produce such [LINK http://cvs.gna.org/cvsweb/radius/src/ressource_console_font.cc?rev=1.1;cvsroot=radius source code], foo.
_________________
May you live in interesting times.

[LINK https://gna.org/projects/radius/ radius] | [LINK http://ompf.org/ ompf] | [LINK http://ompf.org/wiki/ WompfKi]
(L) [2006/10/05] [toxie] [Arauna ray tracer] Wayback!

procedural fonts? ;)

i like my oldskool-demoscene-style-bitmask-fonts.
_________________
Eat plutonium death you disgusting alien weirdos!

back