How to generate simple normal map in material from single channel

Hi there,

I have a custom material which blends multiple textures using an RGB mask. The mask is generated at runtime.
I want to generate a simple normal map from the B channel of the mask to give the appearance that the texture is inset.

I found the Height to normal function but it requires a texture object and uses all channels.

Any suggestions greatly appreciated

Thanks

You will not be able to create a proper normal map, without sampling your mask several times. Thats why height to normal needs texture object. However, you could get away with some fakery. Lets say that your mask B channel value of 0 corresponds to to a flat normal (0,0,1) and mask value of 1 defines slanted normal, (0.9,0.9,0.2) for example. Then you can lerp between these two Vector3 using your mask as alpha. You will not be able to get realistic normal map, but depending on your case that might be enough.

Thanks for the suggestion. I’ll give it a go!

I combined it with a fake shadowing effect and it’s acceptable for the moment. Thanks a lot!