Hi,
I am experiencing an issue in the development of a custom effect, where a certain parameter (float3) will not set properly in an OpenGL project, however will work fine in a DirectX project. Here is my shader code:
The parameter in question is swizzle which appears to be set to a default value of 1, 1, 1 instead of what is set in my C# code. Interestingly, however, attempting to retrieve the value though C# reveals the value which I set it too, however hardcoding this value causes a different visual result.
Yep, I’d recommend trying that, or commenting out the WorldViewProjection parameter entirely if it’s unused.
This reminds me of this issue that I and several other users have run into.
I don’t remember all the details of the issue, but basically the shader compiler will aggressively remove unused parameters (or even unused individual columns of matrix parameters). However MonoGame isn’t made aware of this, so it will still pass parameters by index in the original order. So if your WorldViewProjection is unused, then when you set WorldViewProjection from code, it’s probably actually using the first column (or maybe first row?) to set swizzle.
Sorry if I’ve wasted your time but I worked out that the problem was that I was using floats where ints probably should’ve been used. Anyway, thank you to everyone who participated in this topic.