-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Shader Sampler2D Uniforms are always listed last in the Inspector #75454
Comments
I think this is intended, and sampler uniforms are indexed, 100000 after the common uniforms in the 3.x and now. Here, I just modified the old code to make it works as before: godot/servers/rendering/renderer_rd/storage_rd/material_storage.cpp Lines 963 to 976 in 23394be
cc @clayjohn - what's the purpose of that comfortability, it was by your opinion? |
@Chaosus I didn't add this code, nor have I worked on it much. If I had to guess I would say that reduz added it to allow for quickly parsing whether a given uniform is a texture or not. It is used in the godot/servers/rendering/renderer_rd/storage_rd/material_storage.cpp Lines 1025 to 1026 in 6d7413b
We would have to ask @reduz what his rationale was when he wrote the code |
Godot version
4.0 stable
System information
Windows 10 960m
Issue description
When creating sampler2d uniforms in a shader, they get listed at the bottom of the uniform group in the inspector. It is often useful to have them listed with related uniforms, so they should ideally follow the same order as listed in the shader code. For instance, albedo texture followed by the albedo color.
This example shows the standard 3d material converted to a shader with some small edits for readability. Note that the 3 sampler 2d uniforms are displayed at the bottom in the inspector and not in the shader order. However, they do display in the relative order that they appear in the shader code.
@Chaosus thanks for your fix on the alphabetical uniform group ordering! I thought it would be a good time to add this issue as the final obstacle to getting the perfect uniform ordering. Pretty sure this same issue also happened in 3.x and is a long standing problem.
Steps to reproduce
Minimal reproduction project
sampler2d_order.zip
The text was updated successfully, but these errors were encountered: