Cycles – lamp cover optimizations

Does your scene have a light source with a glass cover on it? Headlights, flashlight, lantern, etc? Here’s a little tip for the glass. Use this shader instead of the glass bsdf or a refraction/glossy mix:

Image

 

This way, the “glass” is considered transparent instead of transmissive. This gives a few nice benefits:

  • The light is not considered a “caustic” and will shine even with no-caustics enabled, and be MUCH easier to sample if you are lighting with it directly (instead of an invisible lamp outside the fixture)
  • The light source is considered direct, meaning it is affected by the “clamp direct” value instead of the harsh, firefly-stomping “clamp indirect” setting
  • Being direct light also means it will appear in the “emit” pass instead of the transmission passes, which makes adding glow effects and adjusting lamp power a lot easier.

There’s also another even further optimization you can do. This shader, containing the transparent bsdf, casts transparent shadows. Transparent shadows are bad, they make sampling lamps slower (Cycles has to call the shader, then trace another ray the rest of the distance instead of simply seeing if it hit something or not). While it won’t usually have a big affect on some small panes of glass, you can squeeze out a little extra speed by disabling shadow-casting entirely for your glass object in the ray visibility panel:Image 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s