sp614x / optifine

1.81k stars 418 forks source link

[Suggestion] Define a CTM texture as a normal map #4055

Open MisterQuiggly opened 4 years ago

MisterQuiggly commented 4 years ago

I have a normal map texture that is using the method repeat. In this case, it is a normal map that is 8x8, so comprised of 64 separate textures. Currently, in order to have this work, I have to have 64 files for sand called 0-63, and 64 files called 0_n-63_n. Here's what I'm proposing. I feel like I have double the textures I need. I feel like I shouldn't have to have128 files, but rather just the normal map files. Here is what I believe could be an example properties file, using my sand example:

matchTiles=sand method=repeat (or maybe it would be overlay_repeat?) width=8 height=8 tiles=0-63 (these files would be normal map textures) bump=true (or normalMap=true, normal=true, etc.)

Using this, for normal sand and red sand textures alone, I could save myself having to have 192 files because I just need 64 textures for the normal map, and not 64 normal map textures, 64 for sand texture that the normal map is being applied too, and the same thing for red sand, making 256 files total.

This can go further, is this is mainly what I'm looking forward to it for. The normal map option should work with overlay textures as well. Specifically, the normal map, when applied to an overlay texture, will ignore alpha on the texture. It should only apply to the part of the texture where pixels are present, and not on the alpha; therefore, the entire block surface would not have the normal map applied to it. So, (pretend this would be ingame) the texture should look like this and not this where the alpha would represent the block it's being overlayed on. Here is an example. With having this be able to work on overlay textures, it would save me having to make 2048 textures. (16 for overlay textures, 16 for bump map textures, 64 times for each texture for one block, both sand and red sand would require me to make 4096 textures).

Currently, this is what it looks like in game when the only textures defined are normal map textures

And this is what it could look like, and the overlayed sand on the stone should also have the normal map on it

sp614x commented 4 years ago

The normal/specular textures are linked to the main texture and there is no way to separate them. Always when "stone.png" is rendered, the "stone_n.png" is automatically linked for the shaders to use. This comes from the way normal/specular atlas textures are built and how the shaders work.

sp614x commented 4 years ago

It may be possible to reuse one normal/specular texture with mutiple base textures is this would help. For example by defining aliases.

MisterQuiggly commented 4 years ago

So this could be possible with 1 texture, but not multiple textures using ctm methods such as repeat or random, etc.? I guess if that is as far is it is able to go, then that should still technically save a good amount of time and textures needed to be made.