Style Sheets very long render time with instances and packed disks

   3415   2   1
User Avatar
Member
22 posts
Joined: June 2006
Offline
I have a setup constructed this way:

polygons –> packed disks –> instance SOP –> delay load (render)

I'm instancing 9 different bgeo sequences (100 frames each) stored on Disk over a template point cloud using Instance SOP and using a Delay Load shader for rendering.

Everything works great if I don't use Style Sheets.
Render time per frame ~5 minutes, super fast (and above all, as I would expect, the render time is independent from the geometry since I'm using instances).

As soon as I create a style sheet on the object, suddenly the render time sky rockets to ~30 minutes to 8+ hours, and many frames just error out and never even get to start the render.

So I recreated a simple setup to document this behavior:

- Template points : ~ 400 points (20x20 grid)
- 9 Geometry Sequences (cached on disk):
each one is : ~200 polys at frame 1 constantly growing to ~600.000 polys at frame 100

Then using Instance SOP I instance randomly one of the 9 geometry sequence on to the template grid, (via s@instancepath).

This is what the render looks like (no_style_sheet.png attached)

Then I assigned a simple Style Sheet set on the object. (with_style_sheet.png attached)

STYLE SHEET DISABLED (Green Mantra Shader applied):
Render Time:
Frame 001 : 18“
Frame 025 : 19”
Frame 050 : 19“
Frame 075 : 19”
Frame 100 : 18“

STYLE SHEET ENABLED (see style.png attached)
Render Time:
Frame 001 : 40” (2x slower)
Frame 025 : 1' 15“ (4x slower)
Frame 050 : 2' 20” (4.2x slower)
Frame 075 : 3' 54“ (12x slower)
Frame 100 : 6' 20” (21x slower)

From what I understood from the manual :

..Stylesheets can let you change looks without having to edit the geometry or regenerate the scene description (IFD) file. This may be useful for studios working with huge scenes, where a quick tweak with a stylesheet might be faster than regenerating a huge IFD.

Apart from the render time which becomes unmanageable very soon, the big problem I see is that the setup with Style Sheet is no longer independent from the geometry instances. It almost feels like, suddenly we loose all the benefit of instancing, pretty much like if the geometry is unpacked and then rendered.

I'm quite new to style sheets so I wonder if I missed something along the way in this setup.

I attached the hip file below.

note:
I tried even without Delay Load with the same results.
Edited by mrWolf - July 5, 2016 17:52:42

Attachments:
no_style_sheets.png (201.4 KB)
with_style_sheets.png (232.0 KB)
style.png (46.6 KB)
style_sheet_issue_v001.hip (621.5 KB)

Alessandro Pepe
http://www.alessandropepe.com [www.alessandropepe.com]
http://pepefx.blogspot.com [pepefx.blogspot.com]
User Avatar
Staff
4447 posts
Joined: July 2005
Offline
One way you could speed up this particular file is to get rid of the sub-target, and instead set a condition on the top level target, using a Primitive Group of @path=*geo0*, and @path=*geo1*. There is still a big slowdown, but not as much because mantra doesn't need to evaluate the style sheets for the primitives inside the packed primitives (the material gets assigned to the packed prims themselves).

The basic problem is that style sheets can do just about anything to the materials in your scene. Each primitive inside each instance could in theory have a different material assigned by the style sheet. In such a context, the increased render time and memory usage would be understandable. Unfortunately right now mantra is not as smart as it could be about short circuiting some of these evaluations when the style sheet is not going to set overrides at that level of granularity. This results in excessive unpacking/unsharing of geometry and evaluation of style sheets, which leads to the slowdowns you are seeing.

At this point all I can do is thank you for the excellent example file, and say that as style sheets mature, their performance is definitely an area we know we need to focus on.

Mark
User Avatar
Member
22 posts
Joined: June 2006
Offline
Mark,
thank you for the reply man, I really appreciate that cause I've been banging my head on this for a couple of days.
Actually it does make perfect sense that if I am addressing primitive groups contained into the packed disk, of course at some point they have to be unpacked before rendering.
I must admit that I was hoping this would happen as last step before rendering (as I understood from the manual), since (I assume) a packed primitive has to be unpacked anyway before being rendered.

mtucker
One way you could speed up this particular file is to get rid of the sub-target, and instead set a condition on the top level target, using a Primitive Group of @path=*geo0*, and @path=*geo1*. There is still a big slowdown, but not as much because mantra doesn't need to evaluate the style sheets for the primitives inside the packed primitives (the material gets assigned to the packed prims themselves).

In my original setup (the one where I experienced the issue initially : from 5 min a frame to 8+ hours a frame 20% of the frames, and memory crash for the remaining 80%), I initially created a very simple Style, containing just a “set material” to the whole Object.

Anyway, I removed all the conditions and sub-targets in the example hip file too, and I definitely got some improvement.

Frame 100 : 3' 55” (opposed to 6' 20” in the version with target Conditions).

According to what you said, assigning a Style to the object level, would not need Mantra to evaluate the style sheets for the primitive inside the packed prim, so , theoretically, there should be no slow down at all, is that correct ?

mtucker
The basic problem is that style sheets can do just about anything to the materials in your scene. Each primitive inside each instance could in theory have a different material assigned by the style sheet. In such a context, the increased render time and memory usage would be understandable. Unfortunately right now mantra is not as smart as it could be about short circuiting some of these evaluations when the style sheet is not going to set overrides at that level of granularity. This results in excessive unpacking/unsharing of geometry and evaluation of style sheets, which leads to the slowdowns you are seeing.

Ah ! this second part of your reply answered my previous question I guess
I've always wondered why Style Sheets are mentioned pretty much only associated with Houdini Crowd, and now it makes more sense, since agents geometry is apparently light, and the agents never arrive to the million (at least in the examples).

mtucker
At this point all I can do is thank you for the excellent example file, and say that as style sheets mature, their performance is definitely an area we know we need to focus on.

Thank you for explaining Mark, and since there is no workaround to fix this issue at the moment, I am really looking forward for this to happen, hopefully in the next Houdini build.
Maybe in the future Style Sheets can be applied to every attribute / parameter in the setup, opposed to Shading only !
Alessandro Pepe
http://www.alessandropepe.com [www.alessandropepe.com]
http://pepefx.blogspot.com [pepefx.blogspot.com]
  • Quick Links