How to apply Normal, Metallic, Roughness Specular maps to 3D model in Monogame

I’m working on a game using Monogame (latest) in Visual Studio 2022. The game is mostly 2D, but I have some 3D portions as well. I have some 3D assets that were provided as a model mesh with multiple textures included. The assets often include a base texture, then several texture maps such as normal, metallic, roughness, and sometimes specular. I would like to be able to apply these maps to my 3D model. I played around with Pixel Shaders for a little while, but just haven’t gotten it to work right. I followed Whitaker’s XNA “pixel shader” tutorials, but they did not do what I need. Are there any good ways to do what I want to do with just applying these maps to the 3D models? Based on the 3D assets I have, it seems to be a standard way of providing the assets, but I am not finding a straightforward way to implement this feature. Thanks!

You are going to have to write the shaders for these effects I am afraid :slight_smile:

Thank you for the reply! I’ve been Googling around for days and just not finding anything all that helpful.

Is there an example for how a shader for metallic or roughness map would work? Do I have to combine them all into one shader or can I have a shader for each somehow?

I have a minogame samples repo, if I get time I’ll put a sample shader up for you.

I’ll post a link here when I post it up.

Actually if I posted my planet shader on there, and I think I did, you could do something similar to that, but in ine pass.

There’s the MonoScene project that adds physically based rendering to MG. I never used it myself, but a quick look at the material.fx file shows that there’s roughness as well as metallic.

Then there’s the DeferredEngine project. The helper.fx file contains two lighting functions (SpecularCookTorrance, DiffuseOrenNayar) with a roughness parameter.

1 Like

Awesome, thank you guys so much! I will take a look and see if I can get it working based on those samples.