Specular Maps in Cycles

When I was looking for examples on how to render Specular Maps in Cycles, the thread I came to was closed. It was posted in 2012 and I wanted to post information on how to do it since I think the answers did not actually create the right answer. Quite simply roughness won’t cut it.
There are 3 elements to specular lighting, the color of the highlight(Specular Color), the angle of the specularity(Glossiness), and how much specularity(Specular Level). When these three are calculated its added onto the diffuse.

So in order to use specular maps you will need multiple shaders. A Glossiness, Diffuse, HoldOut, Mix, and Add.

The Glossiness Shader holds the Glossiness and Specular color. Put your Specular Color map into the Color input, Put the BW Glossiness map into the Roughness.
Next is creating the Specular Level. We achieve this with the Mix Shader. Mix the Glossiness Shader with the Hold Out Shader using a BW Specular Level map as the factor. Now our shader should be black in areas with 0 specular level, and should highlight in areas with some specular level.

Now we create the base using the Diffuse Shader. Simply apply the Diffuse Map to the Diffuse Shader.

Then finally we combine the shaders with an Add Shader. This adds the specular highlights ontop of the diffuse map.

I attached a node structure of this. Mine only uses Specular Level, so the other elements of Glossiness and Color are not inputed.

Attachments


You don’t need a separate spec-level control, you can just change the brightness of the specular color. “spec color” as you define it is essentially the hue/saturation of the spec color, and “spec level” is the brightness. On renderers that do have a separate “spec level” control, it usually just scales the specular color. That’s not at all what the holdout shader is for, it’s a compositing tool that affects the framebuffer alpha. Not something you want in a normal shader. And you should usually have a fresnel node mixing the diffuse/glossy. You don’t want to add them, that can give you a shader that’s not energy conserving the bright areas.

This is the general setup for a textured, coated glossy shader:


Only 10 to 12 nodes just to make a specular highlight? :stuck_out_tongue:

Thanks for correcting me on the hold out shader. I just used it because I want something that will give me matte unshaded black in areas where there is no specular level.
When I am talking about Specular maps, I am talking about things targeted mainly towards being imported into games. I have not really seen a solution that mimics the shader code for specular level within cycles. Quite simply the final pixel shader output is adding diffuse, ambient, and specular when the lighting has been calculated onto the geometry. My goal was to control these three elements in the final pass. Since the shader calculates the lighting, I wanted to get something that just gets the highlights based on a texture. and add it to the final diffuse shader as is done in most shader code.
Now that I think about it using the hold out and mix was not at all necessary since a color of black in a glossiness shader does not produce highlights.
The main reason I want to do this in Cycles rather than Blender’s Standard renderer is because the standard renderer in blender produces blurry results.

What’s the difference of plugging bump into each shader instead of just Displacement?

Bump node affects shader normal (so it can be different per shader). You can also use normal maps on that input, etc.
Displacement output is literally for displacement. However, Cycles’ render time displacement has a couple of different modes, and the default is “bump” which doesn’t actually displace the mesh. Unless you enable experimental features, you can’t take it out of the “bump” mode either, so most of the time that output just becomes a redundant second bump map (it gets added to whatever the shader normal is).

If you enable experimental features, you can instead use the “true” mode (actually displaces the mesh) or the “both” mode, which displaces the mesh then bump maps it to cover the detail displacement couldn’t handle due to lack of polys. There’s also a subdivision option in that tab, but it’s mostly unfinished and currently destroys all mesh data (UVs, vertex colors, etc).

Yeah, at that point a person is better off using the displacement modifier with either a multires or a subdivision surface with a high amount of polys (depending on the effect you are going for).

To expand on the question of Specularity, in older renderers like BI, Maya’s internal and Max refers to a faking reflection of the environment. I feel like that becomes the biggest challenge in rendering these days because before you’d adjust the faked reflection intensity within things like Specular Level and other settings within the specular options. You can kind of do that in Cycles but it’s heavily reliant on placement of your reflection cards and your intensity settings on your light. Games don’t use true HDRI lighting but rather environment spheres that basically tell Unity and other engines what sort of lighting it should be casting. It’s a fake global illumination/environmental reflection basically. Cycles, Mental Ray and others are almost backward from the older days. It just is different way of doing things.

That’s why if you trying to match something for games you should probably use Blender Internal. It’s closer to what people use in their shader code and game engines. Cycles is a closer way to mimic how the real world works (closer being the key word) where games don’t really work that way. Normal maps are prevalent in games because they really do well when working with lights from all angles. The day that something like Cycles gets implemented into games is probably the day that you know computing power has increased considerably. Cycles is basically for high res pre-vis for games or production quality tasks. I wouldn’t lump sum Cycles shaders as being anything close to what they use in gaming engines. That’s just not what it was made for.

Mostly, with one exception: you can get multi-tile displacement maps to work with Cycles displacement. That doesn’t work with the displace modifier. Also, Cycles procedurals, I guess. I mean, technically you can’t use those with the displace modifier…