Texturing Glass Classic API - LuxRender Wiki
Luxrender GPL Physically Based Renderer

Texturing Glass Classic API

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 the classic 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

Contents

Painted Glass

Open 'dots alpha.png' in the image editor. 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.

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 Diffuse and Transmission sockets 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, resulting in a dark back side. 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 by using the Scale node if you are using a texture.

Add a Scale node (Classic API -> Scale), connect 'dots diffuse.png' to the Scale node and the Scale node to the diffuse socket on the Glossy Translucent node. Set the color on the Scale node to some dark grey such as RGB:0.3

Texturing glass tutorial image 5.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 color 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 then select it on the Material Output node as interior volume. Render this now.

Texturing glass tutorial example dots.jpg


Examples

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

Clear glass
Dirty glass
Fingerprint



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. Pick Fresnel Color on the Metal node and add a Fresnel Color node (Fresnel -> Fresnel Color) and connect its output to the Metal node.

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

gold rim diffuse.jpg - connect to Fresnel Color 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 connection you just made. Set Bump Height to 0.2mm.

The image maps can be edited in the node editor without editing the actual image file. Insert an Add node (Classic API -> Add Node) and drop it on the connection between the diffuse image map and the Fresnel node. Set it 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 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.

All done! Render!

Finished node and volume setup for the rimmed glass



Back to other tutorials about LuxRender


Credits

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