hair and fur

Use this forum for general user support and related questions.
Forum rules
Please upload a testscene that allows developers to reproduce the problem, and attach some images.
User avatar
lacilaci
Donor
Donor
Posts: 1969
Joined: Fri May 04, 2018 5:16 am

hair and fur

Post 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...?
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: hair and fur

Post 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.
User avatar
lacilaci
Donor
Donor
Posts: 1969
Joined: Fri May 04, 2018 5:16 am

Re: hair and fur

Post 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?
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: hair and fur

Post 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
User avatar
lacilaci
Donor
Donor
Posts: 1969
Joined: Fri May 04, 2018 5:16 am

Re: hair and fur

Post 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
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: hair and fur

Post by B.Y.O.B. »

Optimize it :P
I just linked it in case someone comes along who wants to work on it.
User avatar
lacilaci
Donor
Donor
Posts: 1969
Joined: Fri May 04, 2018 5:16 am

Re: hair and fur

Post 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
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: hair and fur

Post 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 ...
User avatar
Sharlybg
Donor
Donor
Posts: 3101
Joined: Mon Dec 04, 2017 10:11 pm
Location: Ivory Coast

Re: hair and fur

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

Portfolio : https://www.behance.net/DRAVIA
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: hair and fur

Post 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.
Post Reply