Boxshot supports physically-correct glass simulations with reflection, refraction and absorbance. This allows you to create various glass-like materials with relative ease. We'll show some examples here.
A bit of theory
When light strikes a surface two things (may) happen: part of the light may go through the surface and what does not go through is reflected. How much light is reflected depends on the reflection level of the surface. For instance, a mirror has a reflection level of 100%, so nothing goes through. A completely transparent object has a zero reflection level, so all the light goes through it.
The light that goes through the surface may change its direction. The change depends on the ratio of the indices of refraction of two mediums. Each medium (i.e. air, glass, plastic) has its own index of refraction (IOR) and it is essential to use correct index values when dealing with transparent materials. There are lots of online tables of indices, so it shouldn't be a problem to find the right values.
If the surface is even, the light is reflected in one direction. Otherwise rays are reflected randomly, so you see a "frosted glass", or rippled, effect. The same is true for the part of the light that goes through, as the direction of the refracted light also depends on the surface.
The medium that the light passes through may absorb some light. The thicker the medium, the more light is absorbed.
That's probably all you need to know to work with transparent objects in Boxshot. You can read more about this online, if you like. The keywords to start searching with: reflection, refraction, fresnel reflection, and index of refraction.
Boxshot does not (yet) support caustics and wavelength-dependent refraction, although we may add both in future releases.
We need a sample scene for the tutorial, so let's put a plane on the floor and assign a checkerboard texture to it. Then put a pharma bottle shape on the plane and hide its label and cap:
Boxshot does not show realistic glass effects in preview, so you need to render the scene to see the result:
You see the glass bottle that reflects the black and white tiles and you can also see a little distortion of the tiles that show through the bottle. This is what you would see with a real glass bottle on a real checkerboard.
Let's now switch to the materials panel of the bottle and scroll down to the "Reflection" section. If you don't see that section, you are probably using the Boxshot 4 Home version that doesn't support the feature.
You can see the reflection level slider, fresnel and raytraced reflection options, and a reflection texture selector. You may notice that the reflection level slider is disabled. That's because the "Fresnel reflection" option is selected, so Boxshot computes the level of reflection depending on the surface properties and angle.
This option is perfect for simulating glass and plastic surfaces, but let's turn it off temporarily and set the reflection level to 100%. Render again to see the result:
The bottle now completely reflects the environment and doesn't refract at all. Now reduce the reflection level to 30% and render again to see what happens:
It looks strange, right? That's because in real life glass (and most other semi-transparent materials) respond to light with a fresnel reflection, not a simple one. The fresnel option gives less reflection if the light falls directly on the surface, but increases the reflection level if the light goes along the surface at a tight angle.
However, it is a good idea to control the reflection level directly when you render metal, foil and other materials like that.
Now turn the fresnel reflection back on and we'll continue to refraction.
The refraction section is directly below the reflection one. It is quite simple, with just two sliders: index of refraction and opacity:
Both properties are essential when it comes to transparent objects. As noted above, the index of refraction defines how light changes its direction while passing through the material. Here is the same bottle rendered with IOR = 1.01:
And here is the bottle with IOR = 2. See the difference?
The index of refraction defines how much the background is distorted and how well the surface reflects light.
The next slider is "Opacity". It tells Boxshot what to do with the light that is not reflected. When Boxshot traces light to a surface it checks the reflection slider setting and reflects that amount of light. Then it checks the opacity slider to see how much light to pass through. The rest of the light (if any) uses diffuse texture and tint to color the surface.
Let's make the bottle semi-transparent by setting the opacity slider to 30%. Then adjust the diffuse tint color at the top of the material panel to make it green, and render again:
We've just made a green bottle. However, this is not a 100% correct way to make colored glass, as we need to adjust the light that passes through, as well. We'll do this in the next tutorial. Now set the tint back to white and set the opacity back to 0%.
Absorbance and medium color
Scroll the materials panel down to the "Medium Color" section. Here we'll do the magic: set the medium color to a dark green and set attenuation to 0.2 centimeters. Then render the scene:
That's how real glass looks. The difference is not that visible on this particular shape, but for more complex shapes or different view angles the difference is obvious.
What is the difference? Diffuse tint color simply colors the pixel without taking into account the path that light has traveled through the medium. Medium color settings do take this into account. Here is a more complex scene made of two beer bottles:
The bottle at the left uses diffuse tint, while the right one is done using medium color. You can easily see the glass thickness on the right bottle, but not on the left one. That's how absorbance works - the longer light travels through the medium, the more it changes.
"Transmittance" color is the color that white light becomes after travelling through the "attenuation" cm thick medium. You can read more about this in the user manual. Let's copy and paste our bottle several times and assign different attenuation values to each bottle:
All the bottles have walls of the same thickness, but they all look different because of their different attenuation levels. The bottle the furthest to the left has an attenuation level of just 0.5mm and as the bottle is discernably thicker, the glass becomes too dark to let much light through because of its absorbance. The bottle furthest to the right has an attenuation level of 10cm and you can barely see the green tint in the glass.
All you need to make pleasing glass materials is to set up the transmittance color and adjust the attenuation level to match the shape and your expectations.
Here are some points to keep in mind:
- white transmittance color doesn't work - you will simply not see any difference, as white means "no absorbance".
- the same is true for the "maximum" colors. If, for example, you set transmittance to RGB (0, 255, 0), you will get the same green color regardless of the level attenuation. Use lower values instead - something around (0, 250, 0) could provide a satisfactory result.
Boxshot supports both reflection and refraction blur, but as our bottle is quite transparent and you can hardly see the reflection on it, we'll try refraction blur here. Revert to our green bottle (use Undo to get back to the single green bottle if you copied the bottle several times to test attenuation). Then go to the refraction section, set the blur to 5 and the number of samples to 4, and render again.
In the preview you've got a frozen bottle. Draft rendering doesn't take the number of samples into account, so you may want to render it in production:
Rendering took longer, but the result is better. The blur sliders define how much the reflected or refracted ray will differ from the ideal one. The more the ray differs, the rougher the surface looks. It is a good idea to use the same blur levels for both reflection and refraction, but this is not a mandatory.
Both reflection and refraction blur have a "samples" parameter that controls how many rays Boxshot needs to trace for each reflection and refraction. The stronger blur you use, the more samples you may want to trace, as otherwise the image may be noisy (not smooth). However, each reflected or refracted ray may hit the same surface and produce even more rays, so avoid selecting a very high number of samples: 8 to 16 samples is usually more than enough.
Great! You've just learned how to create semi-transparent mediums in Boxshot. You are now familiar with reflection, refraction and absorbance and ready to create even more amazing things in Boxshot :).
- Decals - applying decals and configuring them.
- Easy Lighting - add the right shadow to your scene.
- Saturated Reflection - make "rich" colorful reflections.
- Floor Reflection - reflecting scene objects in the floor.
- Complex Shape Rotation - how to do more than the rotation gizmo can handle.
- Loft Objects - Quick Start Guide - making loft objects from scracth or configuring the built-in ones.
- Loft Objects - FAQ - frequently asked questions about lofts, when the quick start guide is not enough.
- Loft Objects - Shape Editor - editing loft shapes using the built-in editor.
- Lathe Curve Editing - editing lathe curves using the built-in editor.
- UV-Spot - how to make a uv-spot effect easily.
- Depth Of Field - adding more realism to your renderings.
- Semi-Transparent Labels - how to make semi-transparent and partial labels on bottles.
- Foil Effect - how to add foil-finishing to your shapes.
- 3D Text - making 3d text objects in Boxshot.
- Extruded Objects - how to make thick 3D object of your flat 2D curve.
- Conical Labels - making conical labels with distorted artwork.