2
$\begingroup$

How can I create a diffuse texture for my rendered models or game assets ? If possible with a single node setup and no compositing needed.

$\endgroup$
5
$\begingroup$

Base color and blood color

We start with the base color and the Sub-Surface Scattering to add blood to the model. For the SSS, add an Input > Ambient Occlusion node, you can reduce the Samples for it to 8, you can reduce it even more if the amount of blood visible is subtle. Check Inside to invert it and Only Local. For the Distance use 0.4, it varies depending on the model, this is the size I will use with the Monkey mesh. Connect the AO output to a Color Mix RGB and connect it to the Factor. Set Color1 to R; 0.7 GB: 0.1. The Color2 will be the Base Color, add an Input > RGB and connect it.

Connect the Mix node to the Color1 of another Mix node set to Value. For the Color2 plug the RGB node of the base color. This will allow to have the blood with the same value of the base color, if you make the base color brighter the blood will be more visible.

Now add another Mix node for the amount of blood visible. In Color1 plug the RGB node, in Color2 plug the previous Value node. Set the Factor to 0 to have no blood by default.

Here is what our node setup looks like:

enter image description here

Ambient Occlusion

We then add an Ambient Occlusion node, you can enable Only Local if you want. To make it more realistic you can connect it to a mix node to add bluish shadows to fake ambient lighting, for that connect the AO output to the Factor of a Mix node. Set the Color1 to RG: 0 B: 0.1. Set the Color2 to white.

Add a Mix node and connect in the Color1 the node for the amount of blood and in Color2 the Ambient Occlusion effect. Set the node to Multiply and the Factor to 0.8.

The node setup:

enter image description here

Vertical Gradient

The vertical gradient will darker the bottom part of your model to focus the attention at the top of your model. To create it add an Input > Texture Coordinate, connect the Generated output to a Converter > Separate RGB and use the Blue channel, that's all you have to do for this effect. Connect the gradient to a multiply node, in Color1 plug the AO amount and in Color2 the Vertical gradient, set the Factor to 0.5.

enter image description here

Here is the result you should get in the viewport (connect it to an Output > Material Output to see it):

enter image description here

Top Lighting

For the fake top lighting effect add an Input > Texture Coordinate (or use the previous node), connect the Normal output to a Converter > Separate RGB, connect the Blue channel in the first Input of a Mix node set to Screen mode, for the second Input keep the grey color (RGB: 0.5), we do that to avoid to have completely dark areas. Then connect it again to a screen node in the first Input with the RGB 0.5 grey in the second color to make the image a bit brighter. Connect the vertical gradient and top lighting to a Soft Light node and set it to 0.8.

Here is the node setup:

enter image description here

And the current result:

enter image description here

For now it is too bright but we will correct the gamma later.

Curvature

The curvature will add an hand painted effect to your texture. Add an Input > Geometry and connect the Pointiness output to a Converter > ColorRamp. Move the left cursor at 0.45 and the right at 0.55. Connect the fake lighting and curvature on an Overlay node and set it to 1.

enter image description here

Gamma Correction

The texture is too bright, by default Blender works in sRGB, it brighten everything, this was ideal for older screens. We need to fix this to have the middle grey displayed with half the luminosity. For that set the RGB node used for the base color to a value of 0.5 in HSV mode or type this Hexadecimal code: 7F7F7F.

The base grey color is now in Linear instead of sRGB, but in order to make it blend correctly with the other effects we need to add a node to set it to sRGB temporarly, for that add a Converter > Gamma, in Color connect the SSS node and in Gamma connect a Converter Math in Divide mode with Value 1: 0.5, Value 2: 2.2.

enter image description here

After the last node add a Converter > Gamma and set it to 2.2:

enter image description here

Here is the final result with the gamma corrected:

enter image description here

Here is the result I can get by changing the color and adding a bit of SSS:

enter image description here

Notes

  • You can now tweak the different factor if you want to add more curvature, more lighting effect, etc. Change the amount of blood on organic models and the Inverted AO distance.
    • To make the Vertical Gradient and Top Lighting effect work correctly, apply the rotation with Ctrl + A.
    • You can now directly bake your game texture in Emit mode. If you connect it to the base color input of a shader you must bake in Diffuse mode and disable Direct and Indirect lighting in the baking settings.
    • You can create a node group, I suggest to replace the Input RGB by the Input of the node and to allow to change the amount of blood. The Blood color and the factor of the other settings aren't necessary.

enter image description here

  • You can add a slider to switch between a version with no lighting information (PBR) and with the lighting. For that add a mix node between the Top Lighting node and the Curvature, in the first slot plug the Top Lighting in the second plug the first gamma node for the color. You can then add the setting in your node group.

enter image description here

The PBR version looks like this, you will need to bake your AO map separately: enter image description here

$\endgroup$
0
$\begingroup$

Single Node way with Cycles!

Assume you have a model with some texture and properly UV unwrapped model with some texture and UV unwrapped

Just create New Image with desired dimensions and select it in node editor New Image

Set Cycles Sampling Render to ONE (1)

Select Diffuse Bake Type and uncheck Direct with Indirect leave only Сolor

And press Bake bake

Don't forget to save or pack result diffuse color texture.

$\endgroup$
0
$\begingroup$

You can use a diffuse shader to give you a single node setup of a simple diffuse. You also can use a principled shader which is default in 2.8 to give you a diffuse appearance. You just have to turn all the values to zero except diffuse to give you a pure diffuse shader.

$\endgroup$
  • $\begingroup$ You can see in the question title and the answer of the OP that they are talking about stylized diffuse shader, not plain diffuse surface $\endgroup$ – Mr Zak May 17 at 12:58
  • $\begingroup$ Sorry. By diffuse it sounded like he/she meant a solid color shader. $\endgroup$ – Lyle Goff May 17 at 13:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.