Page 2 of 2

Re: Hair intersection : approaches ?

Posted: Thu Feb 13, 2014 4:41 pm
by Dade
Blender Cycles has native support for hair/strand primitives (but it works more or less only on the CPU, not with CUDA).

Re: Hair intersection : approaches ?

Posted: Thu Feb 13, 2014 6:19 pm
by Dietger
Dade wrote:Having another ray/primitive intersection, aside from ray/triangle, is particularly GPU-unfriendly.
I am curios to know why you think this is much worse on the GPU then CPU. Do you have any experience trying this?

I admit to never have tried it myself, but my gut feeling is that it can't be that bad. I agree that merging triangle and curve primitives into one acceleration structure is probably not all that GPU friendly due to divergence and the overall more complicated traversal code. But when storing the two primitive types in separate hierarchies and traversing both one after the other, first triangles and then curves, I would expect things to be not all that bad. If the scene contains no hairs or most rays miss the hair all together, there is only the small overhead of traversing the very top of the curve hierarchy, so no real harm done. If the scene contains a lot of hair the extra ray-curve traversal and intersection cost will reduce performance, but that is to be expected as the scene complexity just went up massively. Also, by first tracing against the triangles the remaining ray segment is cut down and only curves that are likely to be the closest hit are tested. It might be more expensive then tessellation, but I would expect that the memory savings and increased quality would warrant the (limited) performance cost. But maybe I am wrong :D

Dietger

Re: Hair intersection : approaches ?

Posted: Thu Feb 13, 2014 7:26 pm
by lion
https://www.shadertoy.com/view/ldsGWB
Here example of complex "not triangle" intersection test.

Re: Hair intersection : approaches ?

Posted: Fri Feb 14, 2014 6:57 am
by spectral
lion wrote:https://www.shadertoy.com/view/ldsGWB
Here example of complex "not triangle" intersection test.
Sure, it is nice and impressive...

I have also think to use distance functions (https://www.shadertoy.com/view/XsfGWN), but the problem is that it require an accurate grid settings... it is not really fine for production stuffs...

Re: Hair intersection : approaches ?

Posted: Fri Feb 14, 2014 10:07 pm
by darkhorse64
I suggest that you look at RAY TRACING FOR CURVES PRIMITIVE from Koji Nakamaru & Yoshio Ohno. It comes with detailed pseudo code. I implemented their algoritm into my own renderer and it does the job.
You could also take a look at the Embree renderer. Intel folks are currently implementing hair rendering.

Re: Hair intersection : approaches ?

Posted: Mon Mar 10, 2014 3:31 am
by bachi
Here are two recent papers on hair rendering, both of them can be implemented on GPU
http://fileadmin.cs.lth.se/graphics/res ... 012/hairy/
http://kunzhou.net/2013/fur-rendering-tvcg.pdf

Both of them intersect the hairs with an aggregate of rays(the former use line and the latter use cone) instead of the traditional point sampling, in order to increase sampling efficiency. And I think this would be an interesting line of research.

Re: Hair intersection : approaches ?

Posted: Mon Mar 10, 2014 8:05 am
by spectral
Thanks,

I know the Kunzhou work... but not the other one, will read it asap ;-)