Real-time Physically Based Rendering and Transparent Materials

Started by
2 comments, last by Bummel 9 years, 4 months ago

Hi,

I am looking for resources on how to integrate transparent materials to a (real-time) physically base rendering engine.

I don't think the simple solution to just alpha-blend the objects with transparent materials is physically realistic.

Say I have a realistic-looking scene for several opaque materials, to which I want to add an object made of glass (window, bottle, etc). How I could modify my rendering model to integrate this new material nicely (with physically correct specular highlights and colors) ?

What are good reads on the subject, or possible approaches to the problem ?

Advertisement

How I could modify my rendering model to integrate this new material nicely (with physically correct specular highlights and colors) ?

It is physically based, therefor start with the physics behind refraction. Although remember, that the object surface itself will reflect light, therefor you need to calcuate the refraction color (starting from a simple texture lookup up to ray/cone tracing the (voxelized) scene) additionally to the reflection surface color, which should be handled like most other PBR surfaces.


What are good reads on the subject, or possible approaches to the problem ?

Refraction depends heavily on your engine/rendering approach. There are several articles handling refraction rendering (mostly water, google for refraction shaders). Refraction is most likely still handled with forward rendering. Refraction, or in general transparent materials, is still one of the really hard stuff in rendering engines (atleast if the rendering engine is based on a deferred approach), if you want to deliver good performance, hi-quality and easy handling.

Ignoring all the bending of light stuff:

I don't think the simple solution to just alpha-blend the objects with transparent materials is physically realistic.

It almost is - the basis of alpha-blending almost lines up with some physical concepts, but pre-multiplied alpha is closer:
traditional alpha is: final = a*src + (1-a)*dst;
premultiplied alpha is: final = src + (1-a)*dst;
(where src is the value output from your shader, dst is previous framebuffer contents, and final is the new framebuffer contents)

In that second model, you can think of a as the percentage of light that's being absorbed by the material and converted to heat/light (or being diffused). It should change based on the type of material (a traditional alpha map / alpha material value), the thickness of the material (which maybe you just fake and store in the texture), and the angle that you're looking at the material from.

On that last point - If light has entered a translucent object from the back and is about to enter via a front surface towards you, the amount of light that makes it through that boundary is defined by Fresnel's law. Some percentage won't make it though, and will reflect back into the object instead of making it out the other side. At glancing angles, this tends towards 100%.
However, some percentage of that inwardly-reflected light will continue to bounce around inside and eventually make it back out anyway... You can calculate all that if you want to go fully physically based!

With this model, any light being emitted or reflected off the material isn't affected by the alpha value, which is correct. A glass pane will have the same reflections regardless of whether you put black cardboard on the other side to make it become opaque.
A glass material then has a very low alpha value (perhaps even zero for crystal clear glass? but increasing towards 1 for thicker and thicker surfaces), a very dark diffuse colour (if it's clean), and a specular-mask value calculated from it's index of refraction (somewhere around 0.04 I'd guess). It would also have a very low roughness / high spec-power if it's smooth glass.
If you're trying to render glass of varying kinds of thicknesses, it might also be helpful to multiply your diffuse lighting results by the alpha value (so that opaque glass actually gains a colour instead of becoming black), but not the specular lighting results (as these photons don't actually enter the glass material, so aren't affected by it's properties).

About the physics behind alpha: https://www.cs.duke.edu/courses/cps296.8/spring03/papers/max95opticalModelsForDirectVolumeRendering.pdf

This topic is closed to new replies.

Advertisement