How to generate a metallic or specular texture from diffuse texture?


If i have a diffuse texture for charactor. The charactor dress helmet and armour, so whether have some fast way to generate metallic or specular texture form the charactor’s diffuse texture?


It really depends on what information is in the diffuse texture, and how accurate it should be. You could desaturate the image and add a curves or levels adjustment, if you make the assumption that lighter areas in the diffuse might be more reflective. If you can’t make any assumptions like that, or if you need more realistic effects, then there’s probably no simple or automatic way to get specular out of diffuse.


Yes, I do the same thing about desaturate and add level now.
But when we add more and more character assets in game, it will cost many time for artist.


To echo stwert - you can only make assumptions based on value. Essentially anything with a luminance above 128/255 sRGB can be considered a metal. Below 64/255 sRGB can be considered a dielectric, and in between is glass/diamond (though if you’re using metalness its difficult to get that middle range).

Attached is a few common metal and dielectric specular values:

That said - the results aren’t going to be ideal. For example, if you had a white piece of cloth on your character, how would you know it should be cloth and not metal? If time and resources permit, I would have the artists painting the textures themselves. In a production pinch it might be OK, but be prepared for a lot of fix up anyway.


This is far from perfect, but it’s a good as anything you’re likely to hack up on your own: