How can I have a uniform struct in a Shader?
Hello! I'm very new to shaders, but I have some understanding of the pipeline and how they work in theory.
Right now, I'm trying to create a fragment shader with a uniform struct as input. Ideally, I would like to have a uniform array of structs, but one step at a time.
I have
struct Name{ float f1; float f2; }; uniform Name _struct; fixed4 frag(){...}
and in the application side, I use material.SetFloat("_struct.f1", 1);
However, the value in the struct never seems to change.
I hope the post is clear enough. If not, I'll try to rephrase.
I've successfully passed uniform input to the shader in the form of simple floats. The problem seems to be in assigning members of structs.
Any help is very much appreciated!
I'm also trying to accomplish something very similar.
Have you figured out how to pass uniform structs to shaders ?
No, I think I created a float array for each attribute separately... not very clean, but it works, I suppose.
Your answer
Follow this Question
Related Questions
What does this error mean? 1 Answer
How do you check the next pixels color? 2 Answers
Making a pixelation shader to change resolutions in different areas of the screen 0 Answers
Is there a way to fetch albedo/spec/roughness/AO and normals (RTs) in a deferred frag. shader? 0 Answers
Fragment shader shows alpha, surface shader doesn't 0 Answers