GRP1 discussion

Programming topics can be found here.
User avatar
122675
Posts: 25
Joined: Mon Sep 30, 2013 9:48 am
Contact:

Re: GRP1 discussion

Post by 122675 » Sat Oct 12, 2013 12:44 pm

Nice! I just added bilinear filtering for textures and normal maps, it looks pretty cool. What I'm going to do next is fix my BVH because I had some problems with certain meshes. I'm not sure yet what cool features I will add after that :P
Tom Veltmeijer

bikker
Posts: 67
Joined: Fri Sep 27, 2013 12:40 pm

Re: GRP1 discussion

Post by bikker » Sat Oct 12, 2013 5:34 pm

Check out these papers if you want some extra spice in your BVH code:

"Ray Tracing Deformable Scenes using Dynamic Bounding Volume Hierarchies"
http://graphics.stanford.edu/~boulos/papers/togbvh.pdf
Start at 3.2 (and stop at 4.0), as BVH construction is covered in a better paper. Difficulty: quite doable. Main idea is to trace a bundle of rays, and to visit a BVH node if at least one ray in the bundle intersects it. Keeping track of the first 'active' ray gets you an 'early accept' in many cases. 'Early reject' is much harder; this requires culling the BVH node against planes bounding the ray bundle. Calculating the planes is non-trivial. Ray tracing is however already much faster if you only do the 'early accept'.

"On Fast Construction of SAH-based Bounding Volume Hierarchies"
http://www.sci.utah.edu/~wald/Publicati ... tbuild.pdf
State of the art BVH construction using binning. This lets you build a million-triangle scene in less than a second. Difficulty: also quite doable. Main idea is to not split halfway, but using the surface area heuristic (which is quite intuitive and easy to implement). Then, try N planes along each axis to find the plane with the lowest cost. Apart from that idea, the paper contains tons of implementation details, which you might appreciate.

"Large Ray Packets for Real-time Whitted-style Ray Tracing"
http://www.cs.berkeley.edu/~ravir/whitted.pdf
State of the art BVH traversal, with algorithms based on Wald's original ray packet traversal. Lots of implementation details.

Note that for path tracing, ray bundles do not get you any performance benefits. In that scenario, basic single ray traversal gets you close to optimal performance. For longer paths, single ray traversal is always the fastest solution, unless you want to try something extreme:

"Improving Data Locality for Efficient In-Core Path Tracing"
http://igad.nhtv.nl/~bikker/files/cgf_article.pdf
Gains are minimal, but at least it proves that you can outperform single ray traversal. It also details how bad packets really are for path tracing, and why.

Also note that packet traversal is really a CPU-only thing; on GPUs the hardware automatically benefits from 'ray coherence' (rays travelling in roughly the same direction), and the impact of divergence (as in path tracing) is far less severe. For path tracing, GPUs tend to outperform the CPU by a factor 10, while for Whitted-style ray tracing, CPUs pretty much keep up with everything but a Titan. Details on that in my thesis:
http://igad.nhtv.nl/~bikker/files/thesis_jbikker.pdf

bikker
Posts: 67
Joined: Fri Sep 27, 2013 12:40 pm

Re: GRP1 discussion

Post by bikker » Sat Oct 12, 2013 5:49 pm

If you want to try something completely different, consider doing some post processing.

A basic bloom filter over your image makes bright lights appear much nicer, and also gets rid of the aliasing of light sources. Basic idea: copy your image to a new float buffer, subtract (rgb = 1,1,1) (the range you would normally clamp against), blur this image (box filter will do, Gaussian blur is nicer), and add the result back to your rendered image. Instant win.

Vignetting simulates the effect that most cameras give you an image with slightly darkened borders. Keep it subtle.

Chromatic aberration simulates the effect that most cameras have problems keeping r/g/b together near the edge of the image. By separating them slightly (I said SLIGHTLY) you increase the realism of your image.

Brightness and contrast controls are easy to add, and let you finetune the appearance of your floating point image without affecting the pixel data. More advanced are coulorizing tricks, e.g. the one where you plot a bar of an rgb cube at the top of your screen, export the rendered image to a bitmap file, import it in photoshop, alter rgb, and save the resulting modified color cube data. This data can then be used to replicate the same color adjustments in your renderer without going to photoshop.

There's more, but I'll leave that as an exercise to the reader.

Some links:
http://the-witness.net/news/2012/08/fun ... r-grading/
http://www.udellgames.com/posts/dreamlike-shaders/
http://www.luxrender.net/wiki/Lens_effects

Feel free to share more. These generally apply not just to ray tracers, obviously.

User avatar
122675
Posts: 25
Joined: Mon Sep 30, 2013 9:48 am
Contact:

Re: GRP1 discussion

Post by 122675 » Sat Oct 12, 2013 7:01 pm

Thank you for the inspiration, Jacco. I will try all of these :)
Tom Veltmeijer

120448
Posts: 11
Joined: Mon Sep 30, 2013 1:00 pm

Re: GRP1 discussion

Post by 120448 » Sat Oct 12, 2013 7:26 pm

Thanks Jacco! I will also try some of these features.
Marc Peyré
Programmer - 2nd year
http://twirlbound.com

120527
Posts: 1
Joined: Sat Sep 28, 2013 4:20 pm

Re: GRP1 discussion

Post by 120527 » Sat Oct 12, 2013 8:13 pm

Because I restarted my raytracer anyway last weekend (I had a horrible release mode slowdown which I couldn't fix) I have also switched to pathtracing. Here's the Stanford Dragon in glass in my pathtracer:

Image

He's hard to see, I guess I could have chosen a better background!
Rick van Meer | 2GA-2PR

121176
Posts: 6
Joined: Sat Sep 28, 2013 2:47 pm

Re: GRP1 discussion

Post by 121176 » Sat Oct 12, 2013 9:36 pm

Here's an image of my current pathtracer; a glass camaro, I couldn't help myself:
Image

I think I'm going to do some post processing next, thanks for that idea :)
Ted de Munnik
2GA-1PR

User avatar
122675
Posts: 25
Joined: Mon Sep 30, 2013 9:48 am
Contact:

Re: GRP1 discussion

Post by 122675 » Sat Oct 12, 2013 10:29 pm

Nice work, guys! The images are really starting to get cool now.
Tom Veltmeijer

bikker
Posts: 67
Joined: Fri Sep 27, 2013 12:40 pm

Re: GRP1 discussion

Post by bikker » Sat Oct 12, 2013 11:31 pm

Awesome stuff! Glad you guys are having fun. :)

User avatar
122675
Posts: 25
Joined: Mon Sep 30, 2013 9:48 am
Contact:

Re: GRP1 discussion

Post by 122675 » Sun Oct 13, 2013 2:24 pm

I sort of fixed my BVH, so time to do those cool things Jacco recommended. First on the list: bloom :D
I'm only using a single box blur and it's already quite slow, will have to do some optimizations later.

Image
Tom Veltmeijer

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest