Hi guys!
Is there a way to avoid this? I would like to use only one texture with different UVs and avoid to have multiple sampler2D
s in the shader code. Is it possible? Thanks!
If I set the same Texture
by code on all textures of the node material will it clone the texture on the GPU or is it passing just some reference to one texture thus having multiple sampler2D
uniforms “pointing?” to the same Texture
is a way to go?
Yes, it’s the way to go for the time being: you will have multiple sampler2D
uniforms in the shader but a single underlying GPU texture.
We would need a redesign of the texture block to be able to separate the sampling of the texture from the texture itself (in much the same way we can have multiple Texture
instances pointing to the same InternalTexture
instance).
Thank you!
I was thinking of having an optimization path to reuse samplers at some point but unfortunately nothing guarantees that the users will end up pointing to the same texture (this could be change after the fact by code). So yeah the only path forward to optimize it would be to have a new block representing the sampler itself that we could pipe to the current textureBlock. If that input is not connected no change, else we simply reuse the connected sampler.
Note that it’s now supported thanks to @Deltakosh :
Thank you guys!