hair and fur

Use this forum for general user support and related questions.
User avatar
lacilaci
Donor
Donor
Posts: 1637
Joined: Fri May 04, 2018 5:16 am

hair and fur

Post by lacilaci » Wed Sep 05, 2018 7:29 am

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...?

User avatar
B.Y.O.B.
Developer
Developer
Posts: 2997
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: hair and fur

Post by B.Y.O.B. » 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.
Support LuxCoreRender project with salts and bounties

User avatar
lacilaci
Donor
Donor
Posts: 1637
Joined: Fri May 04, 2018 5:16 am

Re: hair and fur

Post by lacilaci » Thu Sep 06, 2018 5:59 am

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?

User avatar
B.Y.O.B.
Developer
Developer
Posts: 2997
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: hair and fur

Post by B.Y.O.B. » 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
Support LuxCoreRender project with salts and bounties

User avatar
lacilaci
Donor
Donor
Posts: 1637
Joined: Fri May 04, 2018 5:16 am

Re: hair and fur

Post by lacilaci » Thu Sep 06, 2018 10:05 am

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

User avatar
B.Y.O.B.
Developer
Developer
Posts: 2997
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: hair and fur

Post by B.Y.O.B. » 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.
Support LuxCoreRender project with salts and bounties

User avatar
lacilaci
Donor
Donor
Posts: 1637
Joined: Fri May 04, 2018 5:16 am

Re: hair and fur

Post by lacilaci » Thu Sep 06, 2018 10:56 am

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

User avatar
B.Y.O.B.
Developer
Developer
Posts: 2997
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: hair and fur

Post by B.Y.O.B. » 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 ...
Support LuxCoreRender project with salts and bounties

User avatar
Sharlybg
Donor
Donor
Posts: 1525
Joined: Mon Dec 04, 2017 10:11 pm
Location: Ivory Coast

Re: hair and fur

Post by Sharlybg » Fri Sep 07, 2018 10:37 am

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 !
Support LuxCoreRender project with salts and bounties

Portfolio : https://www.behance.net/DRAVIA

User avatar
B.Y.O.B.
Developer
Developer
Posts: 2997
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: hair and fur

Post by B.Y.O.B. » Fri Sep 07, 2018 11:14 am

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.
Support LuxCoreRender project with salts and bounties

Post Reply