Blender 2.8 Tips and Tricks
Below follows a collection of shaders, addons and general tips that I like to use when modeling and shading.
Use Environment Map only for Reflections
When creating a product visualisation, you might want to use an
environment-map for your lighting. When you want to render you
scene into an image with a solid background and still make use
of an environment map, you have to use a transparent node with
you world material. You use a Light Path
node and select the
Is Camera Ray
and connect that to the factor
input of the
Mix Shader
. See the shader setup in the image below which
allows you to use an environment map for reflections and renders
a solid color in the background.
Floor Plane for a Product Display
When you're creating a product visualisation where you want to
render only the product, it's good practice to render the product
onto a ground plane. Note that you can combine this method with
the Use Environment Map only for Reflections
shader setup as
described above.
With this shader, you fade a plane using the generated texture
coordinates. Note that you need to make sure you fade along the
desired axis. I'm rotating the texture coordinates by 90 degrees
and then scale along the x-axis. Also make sure that you use
easing for the Gradient Texture
.
See this StackOverflow where this technique is described.
Diffuse texture for roughness
I found this shader setup in the You Say Armchair .blend file that you can download from blendswap. The model is created by piergi. The nice thing here, is that we use the diffuse texture directly for our roughness, so we don't need an extra texture and works perfectly.
You connect the diffuse texture to a ColorRamp
. This
ColorRamp
influences what range of colors you want to use for
the roughness. Next, you connect the ColorRamp
to a Mix RGB
node. You use this MixRGB
node to set the strength of the
roughness by making the color darker or brigher.
Transparent material
This material fades away based on the Z-height. This shader is
based on this one from Blender
Artists.
You take the generated UV as input and attach it to a Mapping
node. The Mapping
node allows you to offset where we should
start fading away. To access the z
value from the UV, we use a
separate RGB. The value ranges from 0-1. We use a ColorRamp
to
flip this so that we have a range from 1-0 (1.0 at the bottom,
0.0 at the top). We then mix a transparent and emission node using
the output of the ColorRamp
.
- Use the
Location.z
of theMapping
node to change the offset for the effect. - Use the
ColorRamp
to influence the falloff.
We can add a Noise Texture
to create a more dynamic shape. A
RGB Curves
allows us to tweak the fallof a bit more.
Texture Baking
I've got a renderer that uses a separate texture for roughness. Below I'll show you how to bake the roughness into a .png file. Let's say you've got this node setup:
A simple way to bake textures is to create a new separate
image node in the shader editor and make sure it's selected.
You add the image node, then press the New
button.
Now, make sure that this node is active and make sure that
your are using the Cycles
render engine. Open your Render
tab, scroll to the Bake
section. For the Bake type
select Roughness
and press the Bake
button.
Then you can open an image pane and save the generated
roughness map.
Export to GLTF using Principled BSDF Shader
GLTF and Blender use these channels:
- Occlusion = R
- Metallic = B
- Roughness = G
Use this node setup: