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

Expose custom vertex attributes to MeshDataTool #65943

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lyuma
Copy link
Contributor

@lyuma lyuma commented Sep 16, 2022

Salvaged PR by @fire: Add support for custom vertex attributes to MeshDataTool
Color is used as an array of 4 floating point numbers.

Color is used as an array of 4 floating point numbers.
@clayjohn
Copy link
Member

It would be good to link to the original PR (#52214) in the description and make the original author a co-author as well

@bitsawer
Copy link
Member

bitsawer commented Sep 17, 2022

I wonder if it might be better to use Vector4 (now that we have it) or something else instead of Color for custom data. There is the real_t vs float issue, but conceptually Vector4 might be better here. Especially if we want to possibly support full double data types in shaders in the future for harware that supports them (at least for custom vertex data). aaronfranke had some good point about similar issues back when Vector4 was discussed: godotengine/godot-proposals#629 (comment)

@lyuma
Copy link
Contributor Author

lyuma commented Sep 18, 2022

@clayjohn Thanks for finding the original PR. I'll add credit for the MeshDataTool apis, and as noted in the original PR, might be good to make sure the SurfaceTool API also lines up.

@bitsawer regarding Vector4 and real_t, shaders generally use 32-bit floats or halfs. I don't see a per-vertex double attribute being particularly well supported or used. If I compile Godot to doubles, i would not expect that to change all shader properties and vertex attributes to double internally.

I'm okay with using Vector4 if gets converted back to float in the end. Though there's a lack of consistency in Godot apis right now that makes this whole thing a bit awkward. Some use Color, some use PackedFloat32Array, some use Plane (shader parameters used Plane, unless this got changed) and some use Vector4. I would copy either what is used for tangents, or what is used for uniform vec4 shader parameters.

@unfa
Copy link

unfa commented Apr 6, 2024

I'm waiting for this feature to be able to generate tangents for extra UV channels at import so I can then blend multiple normal maps (using different UV channels).

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

Successfully merging this pull request may close these issues.

5 participants