Texturing Glass - LuxRender Wiki
Luxrender GPL Physically Based Renderer

Texturing Glass

Personal tools

From LuxRender Wiki

Jump to: navigation, search

Texturing glass tutorial example dots.jpg

In this tutorial we will be putting a texture on a glass object. This process can be used to render a glass with a company logo or a painted glass or a just plain dirty glass. It is assumed that you are already familiar with LuxBlend so you know how to manage Blender's interface and setting up basic materials. If this is new to you please have a look at the introduction to LuxBlend first. We will use LuxCore API so please make sure that it's selected on the Render tab in Blender. Grab the starter file here: http://www.luxrender.net/forum/download/file.php?id=25960


Painted Glass

Arrange Blender's interface so that you have got the 3D view, node editor and two image editors visible. Open 'dots alpha.png' in one of the image editor views.

In the 3D view, go to the front ortho view and enter edit mode. Select the four rows of outer faces and unwrap those with cylinder projection. Place the UV's to match up in the image editor. Back in the 3D view, select the rest of the faces with CTRL-I and unwrap the standard way. This will create distorted UV's for those faces but it doesn't matter. The important thing is that we must place them where there is pure black in the image. When we set up the material later, the black area will be clear glass and the white areas will be a different material.

Texturing glass tutorial image 1.png

Texturing glass tutorial image 2.png

On the material tab, add a material for the glass and click 'Use Material Nodes'. In the node editor, replace the matte node with a glass node (SHIFT-A -> Material -> Glass). If we render this now(F12) we will get a clear drinking glass. Add a Material Mix node (Material -> Mix), and a Glossy Translucent node. Connect the Glass node to the Material 1 socket and Glossy Translucent to the other socket.

Texturing glass tutorial image 3.png

Add two Image Map nodes (Texture 1 -> Image Map) and set them to 'dots diffuse.png' and 'dots alpha.png'. The 'dots alpha.png' node need to output a float image so enable the Advanced button and select Channel: Mean. Connect that node to the Mix Amount on the Mix node. Connect the 'dots diffuse.png' node to the Transmission socket on the Glossy Translucent node.

Texturing glass tutorial image 4.png

Note: When working with Glossy Translucent/Matte Translucent please keep in mind what color brightness you have got on the diffuse channel. If you've got a bright white color (RGB: 0.8, 0.8, 0,8) most light will be reflected and the light that is left (RGB: 0.2, 0.2, 0.2) will pass through the material, even if the transmission color is brighter than 0.2. Also if the camera is on the same side as the light source and the material looks wrong, it could be that it's reflecting too much light instead of letting it pass through. This can be fixed by making the diffuse color darker or, in this case when we are using a texture, by using the Color Mix node and set its mode to 'multiply'.

Add a Color Mix node (Color & Math -> ColorMix) and connect its output to the Diffuse socket on the Glossy Translucent node. Connect the 'dots diffuse.png' node to the Color 1 socket on the Color Mix node, set the mode to Multiply and set Color 2 to some dark grey such as RGB: 0.3

Texturing glass tutorial image 8.png

If we take a little closer look at the Glass node, we see that the Transmission Color is RGB: 1.0 and Reflection is RGB: 0.7. This would be perfectly clear glass but considering the retro look of the image texture we might want to add a little bit of impurity to the glass to make it look older. This can be done in two ways depending on the look you want.

  • Set the Transmission color to something just a little darker than RGB: 1.0 to make some light get absorbed as it enters and exits the material. This does not have to be much to have an effect. Set it to RGB: 1.0, 0.96, 0.85 or something similar. This is not entirely realistic as you will notice if you set the color to something too dark, but depending on the shape of the glass object it can work just fine.
  • Or create a volume for the glass that absorbs some light. This will create correct absorption in the glass depending on how thick it is. Add a new volume on the World tab and enter these settings:
Name: Glass impure
Type: Clear
Preset: Glass Crown (Common)
Absorption: 1.0, 0.5, 0.11
Abs at depth: 15cm

If you created the volume, pick the 'Glass impure' as interior volume on the Material Output node. Render this now.

Texturing glass tutorial example dots.jpg


Some examples that used a similar setup. See the finished .blend file.

Clear glass
Dirty glass

Gold Rimmed Glass

Texturing glass tutorial example gold rim.jpg

The gold rimmed glass differs a little bit from the above so let's have a look at that. Make the object 'Glass 2 gold rimmed' visible and change active camera to 'Camera 2'

Add a material for it, a Glass node, a Mix Material node, a Metal Node (Material -> Metal) and connect them as above.

Add four Image Map nodes, and connect them as follows:

gold rim diffuse.jpg - connect to Metal node 
gold rim alpha.png - select Channel: Mean and connect to the Mix node
gold rim roughness.png - select Channel: Mean and connect to the Metal node
gold rim bump.png - select Channel: Mean and connect to the Metal node.

Add a Bump Map node (Texture 1 -> Bump Map) and drop it on the bump connection. Set Bump Height to 0.2mm.

Sometimes we need to make some changes to an image map to get the look that we want and sometimes it's easier to do it directly in the node editor without editing the actual image file. Add a Color Mix node (Color & Math -> ColorMix), set the mode to 'Add' and connect its output to the Metal node. Connect the diffuse image map to the Color 1 socket and set Color 2 to RGB: 0.67 0.63 0.28

We can add a little impurity to this glass by using a volume. Add a new volume on the World tab and put in these settings:

Name: Glass old
Type: Homogeneous
Preset: Glass Crown (Common)
Absorption: 1, 0.19, 0.07
Abs at depth: 30cm
Scattering: 1, 0.19, 0.7
Scattering Scale: 20

Back in the node editor, pick the 'Glass old' volume as Interior on the Material output node. Scattering volumes add more load to the rendering so you can expect a little longer render time when using those.

All done! Render!

Finished node and volume setup for the rimmed glass

Back to other tutorials about LuxRender


Wood texture: BurningWell
Gold rim pattern: ImageAfter
Dirt texture: http://thespook.deviantart.com/
Fingerprint texture: http://fp-textures.deviantart.com/