[Bf-cycles] Cycles Strand Rendering

Brecht Van Lommel brechtvanlommel at pandora.be
Fri Oct 26 18:41:41 CEST 2012


Hi Stuart,

Great results! We'd be happy to have you contributing, I don't have
time to work on hair currently and it would be great if someone else
can pick it up and something working.

Regarding the implementation, I think ideally we should be directly
raytracing some curve primitive. This would be a bezier curve with a
thickness parameter for each control point.

Those curves could be rendered as cylinders or as flat planes with a
normal pointing in the incoming ray direction. The former looks great
when zoomed i but might be slower to raytrace, and if you're far away,
rendering with the true normals of the cylinder will take too many
samples to converge. Flat planes work just fine for typical thin
hair/fur rendering when combined a hair shader that takes this into
account, is what is used typically in films I think. The distinction
here might be mostly in how you compute the normal though, maybe the
ray intersection would be (nearly) the same.

>From what I can tell, you rendered it as line segments, which would be
fine as a first step, at some later point this could be made more
memory efficient as bezier curves with control points. Line/curve
segments would be primitives in the BVH just like triangles, which I
guess is what you did.

Much of the kernel code still assumes everything to be triangles, so
probably that needs some works to work for both types of primitives.
There would probably need to be attributes per hair/curve for
texturing. I guess the u value in KernelData would indicate the
position along the curve and dPdu the tangent along the curve.

I don't know how hard it is to get hair out of the particle system in
Blender currently. If there's some data not accessible through the API
it should be added.

As for shaders and lighting, that's of a whole complicated topic on
it's own. The easiest fit is the tangent/specular shader, which gives
those typical highlights and works well for dark hair. For lighter
hair you need a sort of "diffuse" component, which comes from multiple
scattering through the hair. This can be done with brute force
raytracing but probably that will be too slow in most cases. There's
cheap but limited tricks to approximate this with a typical diffuse
BSDF and fake normals, and more complicated ones like dual scattering
that try to give you a good approximation of the scattering. For short
fur there's again other tricks taking the surface normal into account.

But anyway, of course we don't need all those things things
immediately. If there's code to correctly export hair from Blender as
triangles that's already a great start and would merit inclusion by
itself. If we have it exported as line segments, have those included
in the BVH, and raytraced as primitives in the kernel, that's even
better. A tangent shader for hair also should fit fine, can be a
simple one to start with and more complicated ones can be added later.

Thanks,
Brecht.

On Fri, Oct 26, 2012 at 5:12 PM, Stuart Broadfoot
<gbroadfoot at hotmail.com> wrote:
> Hi,
>    I’m very interested in getting involved with cycles development and don’t
> really know what the correct procedure is. I have recently been trying to
> get strand rendering enabled within cycles with a tiny bit of progress. I
> posted some examples of my progress on BlenderArtist here
> http://blenderartists.org/forum/showthread.php?216113-Brecht-s-easter-egg-surprise-Modernizing-shading-and-rendering&p=2230429#post2230429.
> It’s still incredibly early but I wanted to check whether Brecht would be
> happy with me working on it, what the procedure is and if there were any
> preferences for how hair should be implemented within cycles. What I have
> done so far is quite buggy but I am happy to share details. It’s not really
> ready for a patch to be posted on the tracker, but I can create a quick one
> if Brecht wants to look over it.
>
> Best,
> Stuart
>
> _______________________________________________
> Bf-cycles mailing list
> Bf-cycles at blender.org
> http://lists.blender.org/mailman/listinfo/bf-cycles
>


More information about the Bf-cycles mailing list