Page 2 of 5

Re: hair and fur

Posted: Fri Sep 07, 2018 7:06 pm
by B.Y.O.B.
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.

Re: hair and fur

Posted: Fri Sep 07, 2018 11:50 pm
by Sharlybg
Wish you all the possible success avaible :) .

Re: hair and fur

Posted: Sat Sep 08, 2018 5:18 am
by lacilaci
Well, good luck then :D

Re: hair and fur

Posted: Sun Sep 09, 2018 2:00 pm
by B.Y.O.B.
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).

Re: hair and fur

Posted: Sun Sep 09, 2018 2:06 pm
by Sharlybg
You' re pretty fast . Can't wait to test it.

Re: hair and fur

Posted: Sun Sep 09, 2018 2:39 pm
by B.Y.O.B.
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.

Re: hair and fur

Posted: Sun Sep 09, 2018 3:10 pm
by lacilaci
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...)

Re: hair and fur

Posted: Sun Sep 09, 2018 3:44 pm
by B.Y.O.B.
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.

Re: hair and fur

Posted: Sun Sep 09, 2018 4:07 pm
by lacilaci
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.

Re: hair and fur

Posted: Sun Sep 09, 2018 10:03 pm
by B.Y.O.B.
I hate off-by-one errors.