godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.07k stars 68 forks source link

Additional UVs on a mesh. #9944

Open gerarreal opened 2 weeks ago

gerarreal commented 2 weeks ago

Describe the project you are working on

I am the lead developer of an experimental 4-player traditional fighting game engine.

Describe the problem or limitation you are having in your project

Currently spatial shaders utilize only two UVs for a single mesh and I want more 2D-esque features on a model.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

The enhancement in question would add two extra UV built-ins. There isn't much to it. The end goal is using extra UV coordinates for the iris on the eyes or the mouth and additional layering on top of the aforementioned facial features for a more authentic 2D look on the faces.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

This adds UV3 and UV4 built ins.

In code, it'd look like this: vec3 eye_uv = UV3;

If this enhancement will not be used often, can it be worked around with a few lines of script?

You can fake a third UV by blending a texture with another and having the two be tied to separate coordinates.

Is there a reason why this should be core and not an add-on in the asset library?

This is about the overall complexity that the base engine entails. It isn't worth it to make it an add-on if it fundamentally changes how meshes work.

AThousandShips commented 2 weeks ago

See also:

Can you use the custom data inputs instead of dedicated UVs?

clayjohn commented 2 weeks ago

For context, when a GLTF model has more than two UV channels we pack the additional UVs into the CUSTOM channels. At this point, any new vertex attributes should be passed via CUSTOM channels