Posted: 25th Apr 2023 0:52
I have no idea how to pass on the texture colors or Hight with SetShaderConstantByName.

I need a demonstration as i am confused. I searched with no help at all and nothing showing how to use the funcion.

// if you want to change the following values when the app is running, change
// them to uniforms, remove the default values, and use SetShaderConstantByName
// after loading the shader

Here is the shader I guess somehow i am supposes to know what a uniform is.

I know what a vector is but have no other shadder experience.

Things I want to influence

mediump vec3 grassColor = vec3(0.89, 1.20, 0.77);
mediump vec3 snowColor = vec3(1.5, 1.5, 1.5);
mediump vec3 rockColor = vec3(0.75, 0.75, 0.75);
mediump float snowHeightStart = 25.0; // height that grass begins to turn to snow
mediump float snowHeightEnd = 35.0; // height that it becomes completely snow
mediump float rockStart = 0.8; // normals with Y greater than this will be 100% grass
mediump float rockEnd = 0.4; // normals with Y less than this will be 100% rock
Posted: 25th Apr 2023 1:37
Variables need to be vec4 to be able to set them: uniform vec4 MyVariable;

Even if they are just a float, make it vec4 and just set the first value (.x) and make the rest zero. Case is important for the variable name.

in AGK:
SetShaderConstantByName(shader, "segmentCount", 3, 0, 0, 0)

in pixel shader;
uniform vec4 segmentCount;

At least that's my experience. Attached is an example of a pie chart which sets ARRAY variables;
Posted: 25th Apr 2023 2:04
Ok thanks, ill check it out and see what happens.
Posted: 25th Apr 2023 2:16
Ok i did this and got a error in my pixel shader.

uniform vec3 grassColor;

Nevermind lol, I was putting it in the vs not the ps lol.

But it still does not work.

Im confused.
Posted: 25th Apr 2023 8:23
No not uniform vec3 grassColor;
It should be uniform vec4 grassColor;
Posted: 25th Apr 2023 12:14
still did nothing so i don't know
Posted: 25th Apr 2023 20:46
You don't have to set all uniforms to vec4 you can have vec3,2 and float uniforms and still use SetShaderConstantByName()
But you uploaded a vertex shader but talk about a pixel shader above and do you still have default values like "= vec3(0.89, 1.20, 0.77);" in your shader ?
And what is the error you are getting ?
Posted: 25th Apr 2023 21:04
Hay I bought you shader pack and Posted what my error is there. But if i could get your shader pack working this post does not matter.

https://forum.thegamecreators.com/thread/229052