I am making procedural terrains through c# script, and while I achieve to produce a texture, a heightmap and a normalmap to Texture2D
, it seems they are not being applied correctly to the material.
- the texture (albedo) is applied
- the noise map is applied (but as a "default" texture, I think?)
- the heightmap is not even selected
The trick I currently use is to also save the Texture2D to files. After generation I manually affect the file normalMap and it goes fine. But you'll understand this is not satisfactory, I want the script to set the normal map correctly.
I suspect this is because the file's texture type
is force to normal map. But I cannot see how I can change the type of an in-memory Texture2D through code.
Researches gave nothing fitting my concerns, any help will be appreciated. Thanks:)
[EDIT] I tricked by passing a pre-made normal map as parameter, to use instead of the one I generate. Guess what? It works instantly.