Page MenuHome

Bizarre render times with Refraction node
Closed, ArchivedPublic

Description

OS X 10.9.4, 2014 Mac Pro, 3.5 GHz 6-Core Intel Xeon E5, AMD FirePro D500 3072 MB

Blender 2.71

DESCRIPTION: I switched out a Glass BSDF node for Refraction BSDF node and the render time jumped from 4.5 minutes to a predicted 76 hours. My purpose was to separate refraction's from reflections for additional control. Using Cycles on CPU.

TROUBLESHOOT: Download and unzip this archive, open the .blend file and look in the node editor. In the frame labeled "SWITCH THESE" render once with the glass BSDF and once with the refraction BSDF.

Event Timeline

Kent Trammell (khtrammell) raised the priority of this task from to 90.
Kent Trammell (khtrammell) updated the task description. (Show Details)
Kent Trammell (khtrammell) edited a custom field.

Don’t know whether this is bug or expected (some settings can lead to insane render times…).

Bastien Montagne (mont29) lowered the priority of this task from 90 to Normal.Aug 29 2014, 6:14 PM

@Bastien Montagne (mont29) well glass also does refraction. so I would not expect this outcome.

The goal of this scene was to experiment with the ray length absorption technique. So perhaps my node setup is "weird" in that the absorption factor mixes the glass/refraction with a translucent BSDF (closer to the surface is glass/refraction, deeper in the object is translucent BSDF). Perhaps this is where the refraction BSDF freaks out?

Like @Bastien Montagne (mont29) said, since glass BSDF handles it fine I would expect the same from the refraction node...

Thanks for looking into this!

Thomas Dinges (dingto) triaged this task as 50 priority.Aug 29 2014, 11:14 PM

Yes, that's indeed very slow with the Refraction shader, I cannot think of a valid reason here at first, needs more investigation.

@Sergey Sharybin (sergey): I cannot find a difference between Glass and Refraction shader in the code (svm_closure.h etc.). Glass Shader does reflection and refraction, Refraction Shader obviously just refraction. So I would expect rendertime to be lower even, not sure why this is happening. Maybe you have more luck.

Glass is a mix between reflection (glossy) and refraction (transmission), mixed based on fresnel, at each bounce it will pick one of the two. If you use refraction you only get transmission bounces, and they are set to 12 in this file, while glossy is set to 4. Further, if you refract rather than reflect, you're typically going to be doing more bounces because you're entering the object, if you're reflected off it then you're done. So some increased render time is expected depending on the scene.

This is more than I would expect, so something bad might be going on. But rendering e.g. 5x or 10x slower would seem plausible to me.

Sergey Sharybin (sergey) changed the task status from Unknown Status to Unknown Status.Sep 1 2014, 2:55 PM

Looked into the file in details, the slowdown here is caused by quite dense BVH tree, which could make ray intersection rather slow to perform. And as Brecht described above changing shader tree in that way increases number of bounces a lot and each of the bounce happens inside of the object. while using Glass shader will bounce to the enviroment much sooner.

All this combined together leads to rather long render times. Plus the time prediction is _really_ inaccurate -- it assumes all the tiles are the same complexity and all the samples takes the same time to calculate, which is't true in this scene.

I've let single sample to render and the slowdown was only the factor of 20, which is much closer to the expected one.

Using progessive refine might give better approximation (it'll be still off tho). And you can try limiting number of bounces or reducing the number of subdivisions on the object in order to make BVH intersections faster.

For sure stuff could be optimized, but that'd be considered a TODO, not a bug. So thanks for the report and stay tuned for the Cycles optimizations!

I filed a duplicate report of this issue earlier today. I found that the problem does not occur if you set the Refraction BSDF's roughness value to 0.001, and doing so made a huge difference in render times for me: 41 seconds versus 20 minutes. So, setting your roughness to that value could be a useful workaround.

@Zauber Paracelsus (zauberexonar) This saved me lots of headache inventing bizarre workaround shading trees :) Thanks.

Had the same issue with a project a while ago. Very long render times using Refraction. Just did @Zauber Paracelsus (zauberexonar)'s suggestion and yeah that seems to be the culprit.

I also noted that my computer becomes very unresponsive and sometimes I get an nVidia driver timeout error with Roughness at 0, while it stays normal at 0.001. Card used is a GTX 780 Ti. Example render:

  • Roughness at 0.001. (Finished in 1:29):

  • Roughness at 0. (07:26 and still not nearly finished):

Perhaps the Roughness for Refraction shader should be automatically clamped at a really low value when set to 0?