Closed Uradamus closed 2 years ago
While I don't care much about having named UVs and I'm fine with just numbered UVs, I definitely agree that the 2 UV limit should be lifted or at least raised. Maybe edit the title since it doesn't make it clear that this proposal is also about the 2 UV limit.
Another vote to increase the amount of UV channels supported by the engine. Additional channels can be used to import many different kinds of per-vertex data. Blender supports 8 channels, this would be a good minimum baseline.
This is now being implemented in https://github.com/godotengine/godot/pull/44025 Besides the two UV maps, there are now 4 custom attributes you can use them in any way you want. You can choose the following formats for any of them:
Eventually an import option will be added so extra UV channels found in imported files can be mapped to those.
I noticed these custom attributes are currently only available in the vertex shader. (on Master) Are there plans to make these accessible in fragment as well? Having only 2 UV channels in fragment shader is very little. Considering UV2 is used for lightmaps as well...
Making sure https://github.com/godotengine/godot-proposals/issues/2266 is cross linked.
@Xyotic I think you can use varyings to pass data from the vertex shader to the fragment shader.
E.g. something like this:
varying vec3 my_custom_attribute;
void vertex() {
my_custom_attribute = CUSTOM0;
}
void fragment()
{
// You can now use "my_custom_attribute" here
}
(I'm not sure what the attributes are actually called but you get the idea)
Superseded by: https://github.com/godotengine/godot/pull/52504
I think named uv maps is a feature that needs a separate proposal / design.
Describe the project you are working on: I've been working on 3D as a hobby for about 20 years now, first with Maya and then with Blender for the past 14 years or so. I want to start making any of several game projects I have in mind with Godot, but I keep running into limitations on the 3D front that keep making it feel like a non-starter.
Describe the problem or limitation you are having in your project: Due to terrible unresolved bleeding issues with texture atlases that seem like they may never be resolved, the next best alternative are texture arrays. But there is a problem with that, as Godot materials only support 2 UV map slots, which effectively means 1 UV map per material if you want to bake lighting. Due to this limitation, every single texture in an array needs a unique material, since in order to use more than 1 index per material, you would need a UV map for each to associate with them. The whole point of using a texture atlas is to limit draw calls by allowing you to UV map different faces to several different sub-textures at once with a single material, something that can't be done in Godot with the current UV map setup and/or with the abysmal atlas support.
Describe the feature / enhancement and how it helps to overcome the problem or limitation: A way around this would be to change up the way UV maps are handled, replacing the hard coded 2 slot limit with the much more flexible named UV map setup adopted by most 3D programs and many other engines (Blender, Maya, Unreal, Panda3D, Armory, and UPBGE to name a few I've tried in the past).
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams: Since Blender is what I have the most experience with, I can explain how they use it with their shader nodes, which is to have a UV Map node, which basically has a drop down field that lists all of the available UV maps by their name to choose from. and it's output can be fed into any node that needs UV map input. I would imagine in code they can be basically treated as variable names or used as string input for some sort of attribute lookup function.
If this enhancement will not be used often, can it be worked around with a few lines of script?: I'd be using it a lot if atlas support isn't some day fixed. The only alternative I see is having a material for every texture needed, which seems terribly inefficient. I would definitely prefer being able to use atlases, especially since I have a ton of legacy content that uses atlases already, but if that isn't an option, I'd want to be using texture arrays with multiple UV maps in their place.
Is there a reason why this should be core and not an add-on in the asset library?: Doesn't get much more core than UV maps when it comes to 3D.