three-instanced-uniforms-mesh: add an ability to make varying non-interpolated (flat)#380
three-instanced-uniforms-mesh: add an ability to make varying non-interpolated (flat)#380upisfree wants to merge 2 commits intoprotectwise:mainfrom
Conversation
…on-interpolated (flat)
|
Nice addition! I wasn't aware of the Would you kindly add this to the documentation in the package's README.md? |
|
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? mesh.setUniformAt(uniformName, index, value, { isFlat: true }); |
|
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 |
|
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? |
|
By the way, now with uniform options it will be easy to add an ability to specify uniform type manually. Now, all uniforms are in Float32Array, but sometimes you need other types. |
|
I added uniform options and info to README, but not sure is my explanations good enough... |

I added an ability to make a varying non-interpolated, "flat".
Usage:
In my case I needed it to add 16 textures to the shader and have an ability to set the texture index.