## Blender HAIR for Lux

Discussion related to the 'LuxBlend' Blender 2.4+ python exporter script.

Moderators: Ratow, SATtva, coordinators

### Re: Blender HAIR for Lux

e_Jackson
Why do you think hair/strands will have the same origin by chance ?
The Psys itself generates the pathes individually and as long as we don´t use branching ( it won´t, as long
we don´t use child-particles that allow for it )
the risk is small to get the described situation , right ?

Jens

jensverwiebe

Posts: 2124
Joined: Wed Apr 02, 2008 4:34 pm

### Re: Blender HAIR for Lux

@jensverwiebe:

Sorry if my post was misleading, I tried to say something different. In my drawing B_1 B_2 B_3 is polyline which connects consecutive vertices in a hair path, A_1 A_2 A_3 and C_1 C_2 C_3 are boundaries of a "shell" which should be produced by exporter.
Dade recentely have answered my question: we can use some elements (cylinders and/or cones, or other shapes) to form shell and cap the ends of consecutive elements by spheres. Now I remember that an analogical idea was used in some Povray sample scenes.

BTW if we use cylinders + cones + spheres to produce hair paths we don't need to use conic sections --- all caps of cylinders/cones should be orthogonal to their axes.
e_jackson

Posts: 58
Joined: Thu Jul 03, 2008 5:44 pm
Location: Kyiv, Ukraine

### Re: Blender HAIR for Lux

Shall i do a try generating in Exporter?

something like:
Code: Select all
ID = lux.getNextFreeID()lux.paramsClearAll()lux.startGeometry()lux.startCurveMesh(CID, len(path))for vertex in path:lux.addVertex(vertex[0], vertex[1], vertex[2])lux.endCurveMesh(self.materialMap[pmaterial], strandSTART, strandEND)lux.endGeometry()

???

Jens

jensverwiebe

Posts: 2124
Joined: Wed Apr 02, 2008 4:34 pm

### Re: Blender HAIR for Lux

Hi,

e_jackson wrote:BTW if we use cylinders + cones + spheres to produce hair paths we don't need to use conic sections --- all caps of cylinders/cones should be orthogonal to their axes.

That's a very good point you're making, using spheres at junctions will ease the process a lot, however if using cones, you'll have to compute a small delta to get smooth normals at the outer edge (normals won't be smooth at the inner edge, but using cones+cylinders+spheres you can't do anything about it).
Another approach could be to export nurbs patches, this way we would avoid discontinuities both in the surface and in the normal orientation. The nurbs patch is not much used currently though so I don't know how it behaves.

Jeanphi
jeanphi

Posts: 6569
Joined: Mon Jan 14, 2008 7:21 am

### Re: Blender HAIR for Lux

This is awesome

Right now what I have been doing is converting the particle sim into a wire-frame and extruding the edges and then extruding the plane a bit, it makes a cube shape which I set to smooth, it works for hair if you don't get to close, heh, but having a "real" solution would be great.

I will try and test some of this as it becomes more mature.

Thanks for working on this Jens
www.carbonflux.org - photographing the imagination.

Carbonflux

Posts: 1394
Joined: Thu Aug 07, 2008 7:22 pm
Location: Seattle, WA, USA.

### Re: Blender HAIR for Lux

Hi everyone!

I have the first (very basical) draft for hair export from Blender to Luxrender using cylinders and spheres as elements to build hair from.
Hair_export_1-st_draft.tar.bz2

No GUI, no materials, even no hair thickness control, but it works .
Sorry, I didn't find a primitive for truncated cone in Luxrender SDL, so I didn't use cones.
e_jackson

Posts: 58
Joined: Thu Jul 03, 2008 5:44 pm
Location: Kyiv, Ukraine

### Re: Blender HAIR for Lux

hey e_jackson

Works nicely

I will think about full implementation tonight.
Btw: nice workaround for the multiple p-sys-bug

Made tests with 1000´s of strands too, has reasonable export-times ( again )

Jens

jensverwiebe

Posts: 2124
Joined: Wed Apr 02, 2008 4:34 pm

### Re: Blender HAIR for Lux

Hi,

Can someone look at the cone shape and modify it so that it accepts 2 radii? It shouldn't be that hard but you'll have to mess with the parameterization of the cone.

Jeanphi
jeanphi

Posts: 6569
Joined: Mon Jan 14, 2008 7:21 am

### Re: Blender HAIR for Lux

Forgot to emphasize:

API for reading out strand-diameters is introduced in Blender 2.49b !!!
So thats the minimum version !!!!

For older versions there is the fallback to 0.001

Jens

jensverwiebe

Posts: 2124
Joined: Wed Apr 02, 2008 4:34 pm

### Re: Blender HAIR for Lux

jeanphi wrote:Can someone look at the cone shape and modify it so that it accepts 2 radii? It shouldn't be that hard but you'll have to mess with the parameterization of the cone.

Working on it: http://www.luxrender.net/mantis/view.php?id=654