View Full Version : Spot Info and LW10 Documentation

03-15-2011, 04:46 PM
I wanted to dive back into experimenting with optimized reflection blur, but since lightwiki is on the blink and and I can't get to the blur document I decided to recreate it from scratch.

Trouble is, I can't remember precisely how Spot Info's "Sampled Rays" output works and the LW10 documentation doesn't even list it.

Bad documentation! Bad!

Does anyone have any knowledge on what information that output generates?

03-16-2011, 06:14 AM
'Sampled rays' is a integer output, which you can feed into a node system which works with conditionals, such as a logic node or a gradient. In the case of bounces it's information about the recursion of the ray: the number of times it has bounced.

If you look at your own node flow here http://www.newtek.com/forums/showthread.php?t=98938&highlight=reflection+blur&page=2 - you can see how sampled rays and or 'bounces' (I have failed to find any difference, so I just use bounces, since it refers to a ray's recursion level). What the logic in this piece is 'if [a] is greater than [b] true = 0 false = blur amount.

Make sure to specify a number of bounces, equalling the number of times you want it to bounce and make sure it's a whole (integer) number. Basically, after a number of bounces, you are changing the reflection blur to zero.

Beyond that I have no ideas what the differences are between the various pink connectors, though the only 2 which will be relevant to this tutorial are 'bounces' and 'sampled rays' as both work for this.

03-16-2011, 10:35 AM
I remembered how bounces worked from when I originally read the lightwiki page (with bounce 0 being a camera ray).

I vaguely remember something about sample rays indicating if the ray was a single ray or part of a bundle of rays but can't quite remember what the exact nature of that outputs output is (are?).

If I recall correctly, it was used thusly: If a ray is a single ray, use multiple blur reflection samples in the material, otherwise use a single ray. The logic I'm trying right now in my material experiments is to use multiple blur reflection samples if the spot info sample rays is zero, and only one reflection sample if sampled rays is greater than zero.

Does that sound right?

03-17-2011, 07:10 PM
I don't think I did anything so specific, because I don't think you have that kind of controll in the current system. Even if you have zero reflection blur, LW still multisamples a reflection ray, but it's faster than when multisampling spread rays (blurry reflections). it's why I kept the quality quite low (zero) but that then sometimes means you have to take more AA samples. I don't think LW has enough control over the AA samples/multisampling, to play clever games.

You also have to remember that nothing is free. Even reducing the sample radius like that still has an overhead, as some maths is being done, to work out what a ray should be doing at a given depth.

It also has a further problem too: if you view the blurry material through a transparent surface, that's still counted as a 'bounce' for the purposes of ray depth, so you need a minimum of 2 in the depth (camera ray and then 2 rays for the 2 sides of the glass). otherwise it won't be blurry, when viewed behind the glass. That's an inherent issue with this method over a per-surface depth calculation, because any ray for this is calculated from the point of view of the camera, not from the point of view of the surface.

03-17-2011, 07:48 PM
Yep, I'm aware of the trade-offs. I'm trying to find a way to make physically-realistic materials that aren't too slow, will then make a fast approximation using standard shaders, and have both versions available!

Tonight I'm going to try out the effects of dividing the blurry sample ray count by 2^bounce, so each bounce halves the number of rays used. Should work well on rough surfaces, although there's still the serious aliasing that will cause when seen in a reflection or refraction.

Another idea: Use the physically-accurate material for bounce 0, and the simplified faster version for all other bounces.

I'm also pondering using the ray length and camera FOV to drive the octaves in fractal textures, reducing the visual complexity of the texture as the distance increases. This might be a workable way to cut down on the number of AA passes needed, especially if the surfaces in question are using the fractal noise nodes as bump maps.