Struggling to optimize a scene.

slitherhence

Member
Sep 24, 2017
426
336
I normally don't have an issue optimizing a scene. Not that I'm some expert... it just hasn't been something I've struggled with so far. But this time I'm quite stumped.

All the scene in question is, is Space Station Living Quarters. That's it. No figures. No additional props. Just that by itself. I plan to add a figure to the bed, but all times and iteration counts mentioned below are with the figure hidden in the scene outline... and the figure itself takes about 10 minutes to render in my "portrait/studio lighting" set with no optimizations. Render time for the desired angle is just over an hour on my RTX 3070.

Here's where I'm at now (note that the ceiling and two walls are marked hidden in the viewport):
1621815239175.png

Now, correct me if I'm wrong but... "complexity" in the sense of scene optimization primarily comes in three flavors...
  1. Too many faces at concave angles resulting in unproductive bounces for the ray tracing (increases the time each iteration takes to complete).
  2. Too many (or excessively large) ray sources... generally unnecessary mesh lights in a scene... resulting in more rays that need to be tracked (increases the time each iteration takes to complete).
  3. Not enough light for rendered parts of the scene... making achieving a low-noise render for those parts of the scene more difficult (increases the number of iterations required to eliminate the majority of the noise).
So #1 and #2 increase the time each iteration takes and #3 increases the total number of iterations needed. The scene in question takes an hour and ten minutes and about ~3000 iterations to reach 95% convergence. That's about 1.4 iterations per second.

The set I linked above has a _lot_ of mesh lights and no "lights" lights. Just about every object... including the walls... has at least one emissive surface. Most of these are only 50 kcd/m^2, so not super bright. The ceiling lights are 3000 kcd/m^2. The ceiling lights are tru-white while all the others are the same sky blue.

So I started by focusing on flavor #1... I removed all objects from the scene that were not important/visible in the desired render. This included the walls behind and to the right of the camera as well as the floor and ceiling. Because I was likely to end up with the majority of my lighting coming from the mesh light that had previously been hanging from the ceiling (and now were floating magically on their own) and because the wall behind the camera was no longer there to bounce light onto the figure I was working with, I elected to replace the walls, floors, and ceiling with untextured plane-primitives with coloring similar to the removed walls (light-light-grey). It's also worth noting this cut the number of mesh lights in the scene down to half.

The result was that the time taken for each iteration doubled. No, I don't mean the number of iterations in a given amount of time doubled... I mean exactly what I said. The time taken for each iteration doubled. I expected more iterations to be needed and planned to correct for that after testing what changes I had made so far, but after seeing how long each iteration was taking I didn't bother to see how many iterations would be needed.

Not sure what else to do, I then moved on to flavor #2. I went and set every single other mesh light from the scene to 0 kcd/m^2 except the ceiling lights.

The time taken for each iteration doubled again.

1621813938175.png

I thought about it some... and did a lot of experimenting. Eventually I turned those plane-primitives into mirrors. That brought the time taken for each iteration back down to about the original 1.4 iterations per second. But now the number of iterations needed had tripled.

Okay then, I expected... something... like that. Not to that extreme, but whatever. I break out the ghost lights 3 kit, throw up two simple square lights to the left and right of the camera facing my figure.

Good news... I have optimized the scene! It now takes ~1000 iterations and 50 minutes to reach convergence.

1621814333483.png

I'm actually really hesitant to ask for help on these forums after how I was treated last time. But I'm passing confused on this one. And, apparently, I can expect people to derail any thread I make about any issue with this scene so long as it takes more than about 10 minutes to render it... and for the moderators to allow said derailing. So... I have no choice but to focus on this issue first. Clearly there's something going on here that I don't understand (with the scene... not the community). More advanced techniques I can try? Something wrong with the techniques I've used? Something.
 
Last edited:

Deleted member 609064

Well-Known Member
May 11, 2018
1,249
1,590
Stay positive. Perhaps someone will be able to help you. I know there are some 3D nerds in the Developer Discord. I think the info to join is in the "Bloo" thread.
 
  • Like
Reactions: slitherhence

Egglock

Member
Oct 17, 2017
198
110
Can't give you any advice in terms of Daz3D, and what I'm about to suggest is coming from my knowledge with UE4,

1. If I had to guess it might be your light settings that's causing a lot of issue, as light is probably the most expensive in terms of performance cost. If you can, try tweaking the light parameters, i.e the amount of light bounces, the size/details of shadow maps, what objects should be affected by the light (if Daz3D even has an option for that) ect.

2. Take this with a grain of salt and do some research, but tris can also account for your rendering performance. If you have a lot of tris in your scene (I'm talking about 1+ million or even 500k+) it can get a bit pricey. As each vertices (3 verts makes a tri, 4 makes a quad.) will hold information about their light/shadow/color data. So think about it for a second here, if you have a piece of mesh that is 500K+ tris, when that gets sent to your GPU to get process, things can get pricey. Again I'm not sure how Daz3D handles this so I could just be full of shit here. But just something to be cautious even if a small pixel shows through the camera I believe the entire mesh will get process.

3. Reduce the amount of lights and tris in your scene, (of course without destroying the integrity of the mesh) mess around with each lights parameters (if that's even possible). Could also have something to do with the shaders too? I'm not sure how Daz3D handles their shader code or if you can even tap into the code itself but I tend to find that transparency shaders are expensive to render. So maybe reduce the amount of transparency shaders you have?

My suggestion is, start with a simple light setup, maybe 2 master spot lights with a large arc and their light bounce settings set accordingly (if that's even possible), than slowly add other lights with no light bounces and see what your render times are. Do this with the entire scene intact first, and slowly peel away meshes that aren't in view to see if you're occurring any performance hit or gains. Try to use as little point lights as possible, and stick with spot lights with a wide arc if you can. Point lights shoot rays in 360 degree in every direction, so you can imagine just how expensive that can get if you put those every where.
 

probably_dave

Member
Jun 3, 2017
133
363
Are you able to share your project file? I've been trying to reproduce the slowness all morning.

I found that by removing everything that was not in shot, my render times decreased to 1 third of the original set so very different behaviour to what you're seeing.

Also, the last few lines of the log after rendering would be helpful:
2021-05-24 13:07:16.947 Finished Rendering
2021-05-24 13:07:17.014 Total Rendering Time: 7 minutes 4.26 seconds
2021-05-24 13:07:17.184 Loaded image r.png
2021-05-24 13:07:37.591 Iray [INFO] - IRAY:RENDER :: 1.0 IRAY rend info : Device statistics:
2021-05-24 13:07:37.591 Iray [INFO] - IRAY:RENDER :: 1.0 IRAY rend info : CUDA device 0 (NVIDIA GeForce RTX 3090): 1549 iterations, 1.452s init, 416.398s render
 

mickydoo

Fudged it again.
Game Developer
Jan 5, 2018
2,446
3,557
You are both doing something wrong, what I don't know. I did two with my RTX 3060TI, looking at the bed like it would be a couple feet in front of the character, you can see the whole bed on the floor. (It was just the default lighting it came with).

3000 iterations with render quality off

2021-05-24 22:21:47.416 Iray [INFO] - IRAY:RENDER :: 1.0 IRAY rend progr: Received update to 02000 iterations after 305.720s.
2021-05-24 22:21:47.435 Iray [INFO] - IRAY:RENDER :: 1.0 IRAY rend progr: Maximum number of samples reached.
2021-05-24 22:21:48.431 Saved image: C:\Users\xrebe\AppData\Roaming\DAZ 3D\Studio4 Public Build\temp\render\r.png
2021-05-24 22:21:48.441 Finished Rendering
2021-05-24 22:21:48.481 Total Rendering Time: 5 minutes 8.29 seconds

Render quality on, left it on the 5000 default integrations and 95% coverage

2021-05-24 22:30:27.752 Iray [INFO] - IRAY:RENDER :: 1.0 IRAY rend progr: Received update to 02755 iterations after 417.963s.
2021-05-24 22:30:27.752 Iray [INFO] - IRAY:RENDER :: 1.0 IRAY rend progr: Convergence threshold reached.
2021-05-24 22:30:32.875 Saved image: C:\Users\xrebe\AppData\Roaming\DAZ 3D\Studio4 Public Build\temp\render\r.png
2021-05-24 22:30:32.891 Finished Rendering
2021-05-24 22:30:32.939 Total Rendering Time: 7 minutes 4.57 seconds
 
  • Like
Reactions: anne O'nymous

slitherhence

Member
Sep 24, 2017
426
336
I've gotten it down to about 35 minutes by stuffing primitives into every gap that might trap a ray. Currently using SSIM @ 0.98. Also ended up putting a fabric shader on the bed but it had no effect on render time. I also went over it with scene optimizer hoping lowering the resolution of some of the textures would help (desperation)... nottah.
 

probably_dave

Member
Jun 3, 2017
133
363
You are both doing something wrong, what I don't know. I did two with my RTX 3060TI, looking at the bed like it would be a couple feet in front of the character, you can see the whole bed on the floor. (It was just the default lighting it came with).

3000 iterations with render quality off

2021-05-24 22:21:47.416 Iray [INFO] - IRAY:RENDER :: 1.0 IRAY rend progr: Received update to 02000 iterations after 305.720s.
2021-05-24 22:21:47.435 Iray [INFO] - IRAY:RENDER :: 1.0 IRAY rend progr: Maximum number of samples reached.
2021-05-24 22:21:48.431 Saved image: C:\Users\xrebe\AppData\Roaming\DAZ 3D\Studio4 Public Build\temp\render\r.png
2021-05-24 22:21:48.441 Finished Rendering
2021-05-24 22:21:48.481 Total Rendering Time: 5 minutes 8.29 seconds

Render quality on, left it on the 5000 default integrations and 95% coverage

2021-05-24 22:30:27.752 Iray [INFO] - IRAY:RENDER :: 1.0 IRAY rend progr: Received update to 02755 iterations after 417.963s.
2021-05-24 22:30:27.752 Iray [INFO] - IRAY:RENDER :: 1.0 IRAY rend progr: Convergence threshold reached.
2021-05-24 22:30:32.875 Saved image: C:\Users\xrebe\AppData\Roaming\DAZ 3D\Studio4 Public Build\temp\render\r.png
2021-05-24 22:30:32.891 Finished Rendering
2021-05-24 22:30:32.939 Total Rendering Time: 7 minutes 4.57 seconds
Was this with Full HD or Ultra HD? I get similar results with Full HD, but 17mins with Ultra.
 

slitherhence

Member
Sep 24, 2017
426
336
Okay I still need sleep. When I wake up... unless someone has had an epiphany... I'm going to record a video of me recreating this scene step by step. Then maybe y'all can point to the time code where I pull a stupid.
 

mickydoo

Fudged it again.
Game Developer
Jan 5, 2018
2,446
3,557
Was this with Full HD or Ultra HD? I get similar results with Full HD, but 17mins with Ultra.
Just full HD. Interesting though I just did it again and I stopped it 75% after 6 minutes, so I was looking at 10.

Its late I gotta go to bed (DAZ is special at times)
 

probably_dave

Member
Jun 3, 2017
133
363
I've gotten it down to about 35 minutes by stuffing primitives into every gap that might trap a ray. Currently using SSIM @ 0.98. Also ended up putting a fabric shader on the bed but it had no effect on render time. I also went over it with scene optimizer hoping lowering the resolution of some of the textures would help (desperation)... nottah.
Ok, I loaded up your scene and gave up on the rendering when it went over 10 mins.

I made some changes however, and got it to complete in my system, at 4k, in 5 mins. Note, I didn't have the model for Sly, so was not in the render.

  • Hid the Group group and all the reflective surfaces. This will make light bounce all over the place and sometimes it's better to let it escape to the HDRI
  • Hid the Plugs group and all cubes within it
  • Hid the lighting group apart from the ones that came with the Spaceroom (I didn't have the models for the other ones)
  • Disabled SSIM
  • Disabled Spectral Rendering
  • Reset Shutter Speed to default (128 which also reset the exposure to default 13)
This is now fully rendering (quality 1, 95% convergence) in 1m23s in Full HD and 5m30s in UltraHD.
 
  • Like
Reactions: anne O'nymous

probably_dave

Member
Jun 3, 2017
133
363
btw, below are the some renders with times:

render_used_FullHD.png
Your model with changes outlined above: 5m30s 4K (image shown in FullHD as I forgot to save the Ultra one)


render_used_NormalHD.png
Using default set, but with all out of shot props, floors and ceiling hidden. Standard Daz HDRI, 4K (same render settings as before): 5m30s

render_used_O1.png
As above but with props in shot kept, with pillows changed, a darker HDRI (stars) and higher camera angle (the higher angle reduces increases times due to some reflections and more shadows under the desk), Glass in windows made fully transparent, 4K (pic is actually 4K this time) and same render settings: 7m00s

Personally, I believe the extra ~25% render time is worth it.
 

slitherhence

Member
Sep 24, 2017
426
336
Ok, I loaded up your scene and gave up on the rendering when it went over 10 mins.

I made some changes however, and got it to complete in my system, at 4k, in 5 mins. Note, I didn't have the model for Sly, so was not in the render.

  • Hid the Group group and all the reflective surfaces. This will make light bounce all over the place and sometimes it's better to let it escape to the HDRI
  • Hid the Plugs group and all cubes within it
  • Hid the lighting group apart from the ones that came with the Spaceroom (I didn't have the models for the other ones)
  • Disabled SSIM
  • Disabled Spectral Rendering
  • Reset Shutter Speed to default (128 which also reset the exposure to default 13)
This is now fully rendering (quality 1, 95% convergence) in 1m23s in Full HD and 5m30s in UltraHD.
Made the changes you suggested. Currently rendering it, >6 minutes, 37.3%, convergence, 506 iterations.

(┛ಠ_ಠ)┛彡┻━┻

It's definitely iterating more quickly. And the huge iteration times that I was using the reflective walls to get rid of haven't come back. I honestly never understood how that was "helping" before... it was just random shit I tried and seemed to help. I did at one point remove the walls when I first noticed the increased iteration times... but it didn't help at the time. Honestly, I don't fucking know.

10 minutes 48 seconds, 75.10% convergence, 883 iterations. :sigh:

So, apparently, my video card isn't performing to spec. Correct me if I'm wrong... but doesn't daz load all the assets into memory before it starts rendering? My video card _is_ bottle necked due to my mobo being PCIe 3.0... but that should only be an issue when loading assets into video ram.

It's finished.

Code:
2021-05-24 15:43:54.692 Iray [INFO] - IRAY:RENDER ::   1.0   IRAY   rend progr: Received update to 01423 iterations after 1021.266s.
2021-05-24 15:43:54.695 Iray [INFO] - IRAY:RENDER ::   1.0   IRAY   rend progr: Convergence threshold reached.
2021-05-24 15:44:10.469 Saved image: E:\_cache\DazStudio\temp\render\r.png
2021-05-24 15:44:10.493 Finished Rendering
2021-05-24 15:44:10.592 Total Rendering Time: 17 minutes 28.57 seconds
blahbleh.png

I mean it's still a huge improvement... buuut... it's not <10 minutes. And it's become very clear that I will be refused help with (or, at a minimum, constantly harassed while pursuing) other issues so long as the render times are above 10 minutes. It's been a problem with every thread where I've asked for help and it became known what video card I had and how long my renders were taking. Every single time people try to derail the thread to focus on that instead. Like some sort of mass-obsession. And the moderators don't care. So I don't have a choice. I have to get it under 10 minutes.

But I'm having a hard time finding the motivation to keep fighting with it. In the time it's taken to get this render to take only 15 minutes, I could have setup 3 more sets, populated it with figures, posed them into difference scenes, and produced two dozen renders. This has in no way been a productive use of my time. But I haven't been left with a choice.

Regardless I'm thankful for all the help you've given me probably_dave. I'll keep working at it.
 
Last edited: