Custom per-vertex information
Asked Answered
A

2

0

I am converting some fancy mesh generation into a vertex shader. For it to work, each vertex needs some extra information. Something like Unity's MeshRenderer.additionalVertexStreams is what I'm looking for.

The mesh is being procedurally generated before the shader is applied, so I could inject the data at that stage if I knew how. Further, it happens that each vertex needs 4 vec4s, so CUSTOM0-3 would be perfect, but I can find no information on how to use those properties. I could potentially use a uniform array, but I've had trouble getting large amounts of data into uniforms.

Does anyone know the best way to do this?

Arabinose answered 26/6, 2023 at 23:11 Comment(0)
A
0

Yeah, you would need those CUSTOMX properties, but they appear completely undocumented.

Alkalize answered 27/6, 2023 at 2:58 Comment(0)
A
0

Alkalize Your reply encouraged me to dig through the Godot repo (and read the documentation more carefully). If anyone finds this post with a similar problem, you can pass data to CUSTOM0-3 using the SurfaceTool's set_custom. Make sure to call set_custom_format after begin and before commit.

Arabinose answered 27/6, 2023 at 5:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.