hair and fur

Use this forum for general user support and related questions.
User avatar
B.Y.O.B.
Developer
Developer
Posts: 2756
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 7:06 pm

I think I'll create a DefineBlenderStrands() function in pyluxcoreforblender that will do the heavy computations in C++.
Unfortunately I will have to iterate over each hair in Python because I need to call some Blender functions to get e.g. the coordinates of each hair segment. But I will try to do only the absolutely necessary stuff in Python and pass the data over to C++ as numpy arrays.
This should save both memory and computation time.
Wish me luck.
Support LuxCoreRender project with salts and bounties

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

Re: hair and fur

Post by Sharlybg » Fri Sep 07, 2018 11:50 pm

Wish you all the possible success avaible :) .
Support LuxCoreRender project with salts and bounties

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

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

Re: hair and fur

Post by lacilaci » Sat Sep 08, 2018 5:18 am

Well, good luck then :D

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

Re: hair and fur

Post by B.Y.O.B. » Sun Sep 09, 2018 2:00 pm

I'm making progress.
Just rendered the first hair generated by the new code (contains bugs though).
10k hairs are exported pretty fast (final numbers + comparison when everything's working again).
Attachments
2018-09-09_15-58-31.png
Support LuxCoreRender project with salts and bounties

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

Re: hair and fur

Post by Sharlybg » Sun Sep 09, 2018 2:06 pm

You' re pretty fast . Can't wait to test it.
Support LuxCoreRender project with salts and bounties

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

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

Re: hair and fur

Post by B.Y.O.B. » Sun Sep 09, 2018 2:39 pm

By the way, lacilaci, can you send me a file that produces results like you posted earlier in the thread?
Because I only get a few MB RAM usage here even with 100,000 hairs.
Would be good if I could stress-test the new code with your scene. I only need the object with hair, not the full scene.
Support LuxCoreRender project with salts and bounties

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

Re: hair and fur

Post by lacilaci » Sun Sep 09, 2018 3:10 pm

B.Y.O.B. wrote:
Sun Sep 09, 2018 2:39 pm
By the way, lacilaci, can you send me a file that produces results like you posted earlier in the thread?
Because I only get a few MB RAM usage here even with 100,000 hairs.
Would be good if I could stress-test the new code with your scene. I only need the object with hair, not the full scene.
Here,

In this testscene I get ~15GB at end of export and ~5.5GB during rendering with 20K strands.

Just increase hair count to 20K+ and hit render. (I had to set particle count to 10 for upload cause for some reason with increasing particle count file size increases too, even if they aren't visible in viewport...)
Attachments
hair.blend
(1.56 MiB) Downloaded 58 times

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

Re: hair and fur

Post by B.Y.O.B. » Sun Sep 09, 2018 3:44 pm

Thanks for the file.

I had suspected that you were using children, otherwise the insane memory requirements don't make sense.

With 20k strands times 30 children we get 600k actual strands.
Steps are set to 5, however the actual number of steps is computed as 2^steps (Blender does this for some reason), so we have 2⁵ = 32 segments per strand.
This makes 600,000 * 33 = 19,800,000 points.
The points alone take 19,800,000 * 3 * 4 Bytes = 237,600,000 Bytes = 237.6 MB. (Each point is x, y, z coordinates as 4 Byte floats)

Just some calculations so we know where we're standing.

By the way, in your file you have set the Color Export Mode to "UV Texture Map".
What this does is it copies the texture color to the vertex color of the hair vertex (see the tooltip of this option).
However, in your material, you are not using the vertex color at all.
So all of this color information per vertex is also wasted space, equal to the points calculation I did above because colors are also 3 floats of 4 Bytes each. So you have about 237 MB wasted on color information that you are not using.
Support LuxCoreRender project with salts and bounties

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

Re: hair and fur

Post by lacilaci » Sun Sep 09, 2018 4:07 pm

I did 90K 10children 3steps with cycles and it was ~2.2GB so I thought those numbers are fine.
But if it matters it was in blender 2.8.

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

Re: hair and fur

Post by B.Y.O.B. » Sun Sep 09, 2018 10:03 pm

I hate off-by-one errors.
Attachments
2018-09-10_00-02-17.png
Support LuxCoreRender project with salts and bounties

Post Reply