Generating Normals/Metallic/etc textures at build time

Hi :slightly_smiling:

I know, generating normals from a diffuse texture is bad as the diff. texture may not correspond to heights from a higher resolution model, but this is only for a few models that don’t have anything more than diff. And i don’t want, for now, to loose time with photoshop.

So, my question is: is it possible to launch/use a pixel shader in a custom process to generate these ? (I’ve seen nvidia gives tools and sources to do it) or does it have to be done on CPU, by reading the data with Get/SetData() ?

Thanks for your advices :wink:

Well I´ve made some shaders for generating normal maps from height maps (which you don´t have as you mentioned). I am not sure what techniques are used for generating from diffuse maps, I would expect that first height map is extrapolated (now it depends how elaborate it will be, it could detect shadows, reliefs etc, or it just could convert to greyscale, improve contrast and normalize, primitive version can be definitely done on GPU, some of more complex might be hard or impossible without use of compute shader).

I recommend you to research commonly used techniques and consider what quality you are actually looking for, my personal bet is that GPU based solution won´t be an issue at all if you are not looking for some super advanced approach.

Thanks :slightly_smiling:
For the moment, quality is not he most important, as i only want to make " proof of concept".
I already have all the theory behind the normals generation, i just want to know, as i WANT to generate them in a CustomContentProcessor, if it must be done on the CPU or if it is possible to do it within a shader during the build time to create the normal(metallic, or whatever later on) texture.
Generating them at runtime/first load is not a solution, as there are many, and some have a lot of textures or somewhat big atlases.

I just want to create the missing textures for my models that contain only diffuse, and for the models i don’t have the sources to create them in Blender (because of a low resolution model, or can’t open it as they are 3DS max files etc)