-
-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move lightmap UVs out of UV2 and into one of the custom vertex data fields #2192
Comments
see #651 (comment) |
Reduz mention there are problems with this layout. FBX and Collada support 3d uvs. So like UVW. |
I'm excited about the OP proposal, as well as the chart that Fire linked in the case of glTF 2.0, for which Reduz' objection is irrelevant as that chart deals with glTF 2.0, not Collada or FBX. Regarding glTF import (which should technically be a separate proposal, IMHO), I support the chart linked by @fire (I discussed it with fire), though I would propose lightmap use .xy instead of .zw by default. Regarding the 3d UV objection, note also that FBX 3d UV support is very poor anyway across applications. Blender doesn't support it. Neither does Unity. I don't see why Godot would support this obscure FBX feature when it historically only supported 2-channel UVs anyway. That said, if 3d UV channels are desired, using CUSTOM channels at least gives us options: For FBX and Collada which use 3d UVs, they could be placed one per custom channel, instead of two. So for each 3d UV channel, the w component should be unused, and all the subsequent channels would be shifted by one. I also think 3d UV import for FBX (and maybe COLLADA but seriously who cares) that belongs in its own proposal,. Finally, I'd love to see more customization possibilities with UVs and Customs. Not limiting them to 2 or 4 channels, and providing more flexible layouts and data types. Until that time, I think the OP for lightmap UVs is a great proposal specifically putting them in CUSTOM3.xy |
By the way, I noticed that in #651 (comment) Rediz said more specifically that:
An import option would also then resolve Reduz's point: Users who are concerned about 3d UVW channels could opt to use a different option that uses only one UV per CUSTOM (.xy or .xyz) instead of packing them by two at a time (.xy & .zw). So I see the proposed UV->Custom layout as just being one (of many) possible layouts that could be selected in import settings. But I do really think that @fire's UV->CUSTOM mapping issue needs to be its own proposal anyway. The only connection it has to this issue is the fact that lightmap uv used to be in UV2. |
This sounds good on paper, but one of my concerns is about compatibility with GLES3. Will GLES3 support 4 custom UV fields? If not, we'll have to provide a setting to pack the lightmap UV into UV2 as before. Otherwise, your Vulkan project won't be able to fall back to GLES3 without losing lightmaps in the process. |
@Calinou good point. Can we have someone clarify whether the custom data channels are Vulkan exclusive or a general Godot 4 feature. |
I think 4 channels of CUSTOM data at minimum is an absolute necessity and not supporting it in GLES3 would be a big mistake: adding vertex attributes is relatively straightforward, and other GLES3 engines already support far more vertex attributes than even with this proposal so it's definitely possible. Examples of things that CUSTOM data can be used for: barycentric coordinates, pre-baked global triplanar coordinates, adjacent vertex data, secondary vertex color, baked vertex motion (e.g. wind), and (with this proposal) lightmap UVs. |
I think just changing the default is OK, but would be nice to select what field it goes in via a dropdown. Some 3.2 games will port to 4.0, so a simple editor setting is a good idea, as they may have embedded the lightmap data in uv2 in their asset. Keeps compatibility with people's assets and also means if you don't use UV2 for anything else then it's fine to keep as-is. I don't see everyone needing to use this option either. As for FBX, it has a bunch of options, I'd not worry about 3D uv's, they're not really used frequently in games. |
Due to planned future work on vertex compression, this approach won't be viable as UV2 needs to remain used as such for lightmapping. Therefore, this proposal can't be implemented. In any case, if you have a custom shader, remember that you can use |
Describe the project you are working on
Various 3D Projects.
Describe the problem or limitation you are having in your project
You cannot use UV2 together with baked lightning.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Since Godot 4.0 now has additional channels for custom vertex data. I suggest using the last of these channels for lightmap UVs when using baked lightmaps, so UV2 is no longer taken up by this. I think this would be a more elegant solution and easier for new users who wouldn't run into Spatial Materials not being able to use their UV2 functionality when using lightmaps for example.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
NA
If this enhancement will not be used often, can it be worked around with a few lines of script?
I believe this would be used often.
Is there a reason why this should be core and not an add-on in the asset library?
This would have to be changed in core.
The text was updated successfully, but these errors were encountered: