# How to bake roughness into green channel only for usage with GLTF (Blender 2.8)

I've got a node setup that uses the red channel of the diffuse map for the roughness. I've described this method here. This works really well for wood textures. The node setup looks like:

I want to export my object to GLTF. To create correct GLTF files, you have to connect one texture that holds the roughness (G), metallic (B) and AO (R) in the different color channels. Therefore the setup I currently have doesn't work. The setup that is needed by the GLTF exporter looks like:

(I'm not 100% sure about the connection to the glTF Metallic Roughness group node; Blender crashes atm when I use this setup).

I use a 2 step procedure now. First I use the setup as described at the top of this post. Then I bake the roughness into a texture. Then use that texture and connect the green channel to the roughness input of the principled bsdf node. Problem is that the generated roughness map contains the roughness in all channels (R,G,B). So when I connect the blue channel to the metallic it uses the same values as the roughness instead.

Is there a better way to do this? Or maybe a way to only bake into one channel? What solution do you use to export GLTF files from blender 2.8?

• Your Occlusion channel should be sourced from the empty R output of the Separate RGB node, not the image node itself. And yes, the glTF exporter doesn't know anything about ColorRamp or Mix nodes, so some sort of baking is required to take them into account. May 28 '19 at 18:42