-
-
Notifications
You must be signed in to change notification settings - Fork 21.8k
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
Need more vertex attributes (for terrain shading) #9134
Comments
not going to happen, but as mentioned a while ago, you can use vertexID and vertex texture fetch to get as much data as you want |
But isn't a texture fetch a lot more expensive than vertex attributes? Especially when it's about rendering pretty large patches of pixels |
No, there is no reason for it to be more expensive, it's just bandwidth
On Aug 6, 2017 11:25 PM, "Marc" <notifications@github.com> wrote:
But isn't a texture fetch a lot more expensive than vertex attributes?
Especially when it's about rendering very big patches of pixels
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#9134 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AF-Z2xoZxl44d1JQzm7bHQrcx9KFD7aZks5sVnWSgaJpZM4N3dQh>
.
|
Is there a way to use the vertexID in a shader? I need additional attributes in a CanvasItem shader for a MeshInstance2D. The idea now would be to use the vertexId inside the vertex() shader function to calculate the UV texcoord for the vertex texture fetch. The trick with a MultiMesh to use INSTANCE_CUSTOM (see #31299 ) should not be possible because MeshInstance2D uses a Mesh and not a MultiMesh. |
Okay, I've now found a solution. Instead of using vertexID, I now use UV as vertexID. It even has the advantage that I can already precalculate the correct fetch coordinates between 0.0 and 1.0. |
@jwurzer just use UV2 and or Color. |
UV2 doesn't exist for CanvasItem shaders. Only for Spatial shaders. COLOR is used at my example for colors. In my MeshInstance2D example I want to realize Multitexturing with two textures via CanvasItem shader. Where different UV coordinates are to be used for the textures. The two textures doesn't share the same uv coordinates. Therefore the UV attribute is not enough. Since a CanvasItem shader does not provide UV2, I solved it as described above. |
How can we use it it's not exposed ? Even then, for dynamic geometry, how is updating a texture on cpu then fetching it in shader faster then passing another array ? |
Will vertex id and custom vertex attributes come to Godot4.0 with Vulcan ? how about geometry / tesselation / mesh shaders ? |
Currently i don't see ANY way to implement anything that needs more than Color and UV attributes in a canvas_item shader. |
Shading a heightmap terrain as a module using texture arrays requires at least the following vertex attributes:
By usage + type:
In order to be able to do this in the shader (assuming texarrays are supported):
However the amount of attributes currently in engine are limited for this.
In theory I could use COLOR, UV and UV2 to have those 8 missing floats, but if COLOR needs to be used for something else then there is not enough attributes left (TANGENTS, BONES and WEIGHTS give only 2 floats and an int).
Given that GLES3 allows for any number of attributes (no longer hardcoded), is there a chance we can have more, or at best custom vertex attributes in 3.0?
The text was updated successfully, but these errors were encountered: