Skip to content
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

New UV Channel imports into a scene file #2266

Closed
fire opened this issue Feb 10, 2021 · 5 comments · Fixed by godotengine/godot#52504
Closed

New UV Channel imports into a scene file #2266

fire opened this issue Feb 10, 2021 · 5 comments · Fixed by godotengine/godot#52504

Comments

@fire
Copy link
Member

fire commented Feb 10, 2021

Describe the project you are working on

3d project

Describe the problem or limitation you are having in your project

We wanted to import more UV channels for use in Godot games.

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

The GLTF2 importer will use the all-new extended mesh format to store UVs.

The GLTF2 exporter will store the UV channels from the mesh into the gltf2 file.

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

Discussed at the rendering meeting. https://gist.github.com/fire/878b71a2b69fcb47c1c685e96163e05d

New glTF importer will have a dropdown to select the lightmap channel:

We default to texcoord1.

  • None
  • texcoord0
  • texcoord1
  • ..
  • texcoord7

This vec2 is to be stored into custom3 (vec4) and aligned to XY because it would waste two floats if not aligned.

The layout for UV:

The glTF importer will write

  • texcoord0->uv,
  • texcoord1->uv2
  • texcoord2,3->custom0
  • texcoord4,5->custom1
  • texcoord6,7->custom2

The PackedScene to glTF2 exporter will write:

  • uv->texcoord0
  • uv2->texcoord1
  • custom0->texcoord2,3
  • custom1->texcoord4,5
  • custom2->texcoord6,7

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

Adding new UV channels is not a script change. It is a gltf2 importer change.

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

Importing UV channels is a core change. It is unable to be integrated with the scene importer/exporters and still be a script.

@fire fire changed the title New UV Channel imports into a scene file #4 New UV Channel imports into a scene file Feb 10, 2021
@Calinou
Copy link
Member

Calinou commented Feb 10, 2021

See also #2192.

@Calinou Calinou changed the title New UV Channel imports into a scene file New UV Channel imports into a scene file Apr 9, 2021
@Lexpartizan
Copy link

Lexpartizan commented Apr 22, 2021

I need this functionality right now, as I'm going to use additional UV channels in shaders. Since one channel (UV2 is reserved for lightmaps) is not enough for me. I want to store more information in the bag to greatly reduce the amount of materials.

I need this functionality right now, as I'm going to use additional UV channels in shaders. Since one channel (UV2 is reserved for lightmaps) is not enough for me. I want to store more information in the mesh to greatly reduce the amount of materials.
I just wanted to remind you that this functionality is needed not only when importing and in the editor, you need to provide easy access to these UV layers in the Godot shader language. UV3, UV4, etc.

I also liked the idea expressed here that the last UV layer should be used for lighting. But I understand that this may cause some problems in other parts of the engine.

I am currently working on a texture atlas (more precisely, a texture array) and would like to transmit the tile number using UV3, for example. This would solve a lot of problems for me, since I would be able to provide several other materials (from 16 to 64) on one material without unnecessary drawcalls. At the same time, without sacrificing mipmapping or repeating textures, that is, without overestimating the number of polygons.

@Lexpartizan
Copy link

https://www.youtube.com/watch?v=Rw8UL2q6VYI
i trying make texture atlas with tiling and need two UVs channel.

@fire
Copy link
Member Author

fire commented Sep 9, 2021

Updated godotengine/godot#52504 (comment) with a video.

2021-09-08_23-05-35.mp4

@Lexpartizan
Copy link

@fire You are a real hero! I've already given up all hope of seeing this! Thanks! Thanks! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants