Skip to content

Conversation

@upisfree
Copy link

@upisfree upisfree commented Dec 23, 2025

I added an ability to make a varying non-interpolated, "flat".

Usage:

mesh.setUniformAt(uniformName, index, value, isFlat);

In my case I needed it to add 16 textures to the shader and have an ability to set the texture index.

@lojjic
Copy link
Collaborator

lojjic commented Dec 26, 2025

Nice addition! I wasn't aware of the flat varying glsl feature. 👍

Would you kindly add this to the documentation in the package's README.md?

@upisfree
Copy link
Author

Yes, I will add this to README 👌🏻

I thought, maybe it's better to pass options object instead of one variable in case we will add more options in future?
Something like this:

mesh.setUniformAt(uniformName, index, value, { isFlat: true });

@lojjic
Copy link
Collaborator

lojjic commented Dec 31, 2025

An options object is a good idea. 👍

I'm also wondering... should we make flat the default? That does seem like it's probably the usually expected behavior given that we're trying to mimic uniforms which wouldn't be interpolated. In that case we could still add an option {interpolate: true} just in case somebody was relying on that undocumented behavior.

@lojjic
Copy link
Collaborator

lojjic commented Jan 1, 2026

Thinking about this more... Can you give a concrete example of where interpolation would be occurring that is messing you up? It seems to me like all vertices within an instanced draw would be receiving the same attribute value, so any interpolation would be between the same number...? How would two vertices of a triangle receive different values?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants