hair and fur

Use this forum for general user support and related questions.
User avatar
B.Y.O.B.
Developer
Developer
Posts: 2962
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: hair and fur

Post by B.Y.O.B. » Mon Sep 17, 2018 10:22 am

lacilaci wrote:
Sun Sep 16, 2018 8:39 pm
so i guess alpha v4?
Yes.

Everything I mentioned so far is implemented now, I'm currently trying to add one last feature that could be useful.
Support LuxCoreRender project with salts and bounties

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

Re: hair and fur

Post by B.Y.O.B. » Mon Sep 17, 2018 10:47 am

Different root and tip colors, baked into vertex colors (they are multipliers and interpolated over the length of each hair).
Attachments
2018-09-17_12-45-42.png
2018-09-17_12-50-14.png
with vertex color layer
Support LuxCoreRender project with salts and bounties

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

Re: hair and fur

Post by B.Y.O.B. » Mon Sep 17, 2018 2:46 pm

I'm finally done.

A test with 10000 hairs * 10 children * (2^5 + 1) points = 3,200,000 points:

Old:

Code: Select all

[Plane: ParticleSystem] Exporting hair
[LuxCore][26.161] Refining 100000 strands
[LuxCore][26.884] Strands mesh: 2133333 triangles
[LuxCore][27.365] Refining time: 1.2 secs
[SDL][27.369] Texture definition: 140050749790216
[SDL][27.369] Reading texture map: /tmp/tmpwc8palj5.jpg
[SDL][27.456] Material definition: Surface_Material__002_140050781808648
[SDL][27.458] Scene objects count: 1
[Plane: ParticleSystem] Hair export finished (20.579 s)
New:

Code: Select all

[Plane: ParticleSystem] Exporting hair
Changing resolution to RENDER took 1.523 s
Collecting Blender hair information took 5.661 s
[LuxCore][9.987] Removed 1 invalid points
Preparing strands took 0.097 s
[LuxCore][10.004] Refining 100000 strands
[LuxCore][10.636] Strands mesh: 6399996 triangles
[LuxCore][10.986] Refining time: 0.981 secs
[SDL][10.987] Texture definition: 139725391321096
[SDL][10.987] Reading texture map: /tmp/tmpumpaoxqy.jpg
[SDL][11.084] Material definition: Surface_Material__002_139725440133128
[SDL][11.085] Scene objects count: 1
[Plane: ParticleSystem] New Hair export finished (8.361 s)
The memory spike during the hair export is gone completely, and the export is faster.
There are new features, like the ability to only define UV coordinates for the hair without defining vertex colors. This is the new default behaviour since it saves memory and most people don't use vertex colors (it is not intuitive).
The user interface should now be easier to understand, the descriptions were improved and extended.

Also, the hair is no longer defined as an instanced mesh.
This means that rendering is faster.
However, the accelerator will use more memory if the mesh is not instanced. In the test above, the whole Blender process used 1.1 GiB with hair as instance and 1.7 GiB with non-instanced hair.
So the extra speed (930k Samples/sec vs. 770k Samples/sec) comes with a cost in memory.

I think I will add an option to enable instancing for hair, to save memory.
Support LuxCoreRender project with salts and bounties

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

Re: hair and fur

Post by lacilaci » Mon Sep 17, 2018 3:06 pm

That is some great improvement!

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

Re: hair and fur

Post by B.Y.O.B. » Mon Sep 17, 2018 3:08 pm

B.Y.O.B. wrote:
Mon Sep 17, 2018 2:46 pm
Also, the hair is no longer defined as an instanced mesh.
This means that rendering is faster.
However, the accelerator will use more memory if the mesh is not instanced. In the test above, the whole Blender process used 1.1 GiB with hair as instance and 1.7 GiB with non-instanced hair.
So the extra speed (930k Samples/sec vs. 770k Samples/sec) comes with a cost in memory.

I think I will add an option to enable instancing for hair, to save memory.
Note: this only concerns Embree (CPU rendering) from what I could see in my tests, so the option will only be available if CPU rendering is selected.
Support LuxCoreRender project with salts and bounties

acasta69
Developer
Developer
Posts: 194
Joined: Tue Jan 09, 2018 3:45 pm

Re: hair and fur

Post by acasta69 » Wed Sep 19, 2018 1:07 pm

Now I have a Windows build with the new hair support. I tried to render the scene linked before by lacilaci, but hair is not rendered and I get this message:

Code: Select all

[Exporter] create_session
[SDL][11.216] Camera type: perspective
[SDL][11.216] Camera position: Point[1.44414, -0.914483, 0.491676]
[SDL][11.216] Camera target: Point[1.43705, -0.90897, 0.487281]
[SDL][11.216] Camera clipping plane disabled
Unpacking image "productimage-picture-30716-diamond-grid-368.jpg" to temp file "
C:\Users\xxx\AppData\Local\Temp\tmpu8_ji3io.jpg"
[Plane: ParticleSystem] Exporting hair
Changing resolution to RENDER took 0.011 s
WARNING: [Plane: ParticleSystem] 'NoneType' object has no attribute 'source'
Traceback (most recent call last):
  File "C:\Users\xxx\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\BlendLuxCore\export\hair.py", line 176, in convert_hair
    image_filename = ImageExporter.export(settings.image, settings.image_user, scene)
  File "C:\Users\xxx\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\BlendLuxCore\export\image.py", line 43, in export
    if image.source == "GENERATED":
AttributeError: 'NoneType' object has no attribute 'source'
[SDL][11.357] Texture definition: 246930504
[SDL][11.357] Reading texture map: C:\Users\xxx\AppData\Local\Temp\tmpu8_ji3io.jpg
[SDL][11.497] Material definition: Surface_Material__002_247016120
[SDL][11.497] Scene objects count: 1
Any idea what this means? Some problem with data packed in blend file, or what else?
Support LuxCoreRender project with salts and bounties

Windows 10 64 bits, i7-4770 3.4 GHz, RAM 16 GB, GTX 970 4GB v382.05

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

Re: hair and fur

Post by B.Y.O.B. » Wed Sep 19, 2018 3:11 pm

It was an oversight from me (i.e. a bug), I fixed it. Thanks for the report :)
Support LuxCoreRender project with salts and bounties

Post Reply