Page 1 of 5

hair and fur

Posted: Wed Sep 05, 2018 7:29 am
by lacilaci
Is there some tutorial on how to use hair/fur with luxcore?
I mean like practical example, some tips on shader how to get a nice carpet or something furry, how to shade it etc...?

Re: hair and fur

Posted: Wed Sep 05, 2018 6:56 pm
by B.Y.O.B.
There is this wiki page: https://wiki.luxcorerender.org/LuxCoreR ... ir_and_Fur
However it is not very extensive.
lacilaci wrote: Wed Sep 05, 2018 7:29 am some tips on shader how to get a nice carpet or something furry, how to shade it etc...?
I would probably try glossy translucent.

Re: hair and fur

Posted: Thu Sep 06, 2018 5:59 am
by lacilaci
B.Y.O.B. wrote: Wed Sep 05, 2018 6:56 pm There is this wiki page: https://wiki.luxcorerender.org/LuxCoreR ... ir_and_Fur
However it is not very extensive.
lacilaci wrote: Wed Sep 05, 2018 7:29 am some tips on shader how to get a nice carpet or something furry, how to shade it etc...?
I would probably try glossy translucent.
A small carpet with 30K strands takes quite a while to export and eats up all my 32G ram using adaptive triangle ribbon.

Also memory consumption during export for 10K strands was close to 10GB but during rendering it was 6.5 with adaptive triangle ribbon. However using triangle ribbon it was close to 6 and below 4 during rendering. But in the wiki it says adaptive ribbon is better for more strands so it doesn't make sense to me.

And with triangle ribbon I was able to use 30K strands, however it took 16GB ram during export and 8 on rendering.

For comparison a 90K strand carpet in cycles is exported within 5 seconds and takes 2.1GB of memory.

Can I do something with the settings to optimize and speedup the process or is this normal?

Re: hair and fur

Posted: Thu Sep 06, 2018 9:14 am
by B.Y.O.B.
Currently the hair export is mostly copy-pasted from old LuxBlend.
Everything before the tesselation phase is done in Python.
This code could probably get optimized for lower RAM usage.
https://github.com/LuxCoreRender/BlendL ... rt/hair.py

Re: hair and fur

Posted: Thu Sep 06, 2018 10:05 am
by lacilaci
B.Y.O.B. wrote: Thu Sep 06, 2018 9:14 am Currently the hair export is mostly copy-pasted from old LuxBlend.
Everything before the tesselation phase is done in Python.
This code could probably get optimized for lower RAM usage.
https://github.com/LuxCoreRender/BlendL ... rt/hair.py
I'm sorry I really don't know what to do with that .py file :D

Re: hair and fur

Posted: Thu Sep 06, 2018 10:45 am
by B.Y.O.B.
Optimize it :P
I just linked it in case someone comes along who wants to work on it.

Re: hair and fur

Posted: Thu Sep 06, 2018 10:56 am
by lacilaci
B.Y.O.B. wrote: Thu Sep 06, 2018 10:45 am Optimize it :P
I just linked it in case someone comes along who wants to work on it.
:D ok then... Maybe I'll better wait with my carpets and blankets for a native hair primitive :D

Re: hair and fur

Posted: Fri Sep 07, 2018 10:10 am
by B.Y.O.B.
I would like to reduce the amount of memory required by the hair export.
Currently, we use Python lists to store the segments, points etc.
Python lists use doubles as far as I can see.
The cyhair used in LuxCore on the other hand uses floats for everything except segments, which use unsigned shorts.
Since the size of a float is half the size of a double, we are currently using about twice the memory that would be actually required.

One solution I could imagine is to use numpy arrays instead of Python lists, since we can specify the data type of a numpy array.
I tried adding support for numpy arrays to pyluxcore, using <boost/python/numpy.hpp>.
However this requires to link with -lboost_numpy and it seems that the boost in the static Linux build environment I'm using is built without boost_numpy.

Let's see if I can compile boost with boost_numpy ...

Re: hair and fur

Posted: Fri Sep 07, 2018 10:37 am
by Sharlybg
B.Y.O.B. wrote: Fri Sep 07, 2018 10:10 am I would like to reduce the amount of memory required by the hair export.
Currently, we use Python lists to store the segments, points etc.
Python lists use doubles as far as I can see.
The cyhair used in LuxCore on the other hand uses floats for everything except segments, which use unsigned shorts.
Since the size of a float is half the size of a double, we are currently using about twice the memory that would be actually required.

One solution I could imagine is to use numpy arrays instead of Python lists, since we can specify the data type of a numpy array.
I tried adding support for numpy arrays to pyluxcore, using <boost/python/numpy.hpp>.
However this requires to link with -lboost_numpy and it seems that the boost in the static Linux build environment I'm using is built without boost_numpy.

Let's see if I can compile boost with boost_numpy ...
Thanks for this !

Re: hair and fur

Posted: Fri Sep 07, 2018 11:14 am
by B.Y.O.B.
Hm it seems numpy is already built, there is a file "libboost_numpy34.a" in the target-64-sse2/lib folder.
Maybe I have to explicitely link against it somewhere?

edit1: ha, found it. I had to rename libboost_numpy34.a to libboost_numpy.a.
edit2: now it crashes when I try to extract the numpy array from the python object :/
edit3: After initializing numpy it works.