How to change sampling mode when generating down-scaled glowlayer's blurTexture

So I’m trying to store an extra channel for blur in glowlayer, and I used 6 bits to store rgba rather than 8.
The question is blur textures are down scaled when generating, the down-scale seems to calculate 1 pixel with the average of 4 former pixels, so I can’t get an accurate 7th bit nor 8th bit.
Is it possible that I can use nearest rather than linear for the step? If not, is there any other ways that I can store an extra channel without creating a new rtt?

Looking at the GlowLayer source, the sampling mode is set here: Babylon.js/glowLayer.ts at 8fc60196edda3265351a0aad50fdb4c665ae1bfc · BabylonJS/Babylon.js · GitHub
@Deltakosh do you think we could add an option for the user to specify their desired sampling mode? :thinking:

Of course no problem! Would be a nice addition

@tanpopo do you want to add the argument as a contribution? :smiley:

I can do the contribution if nothing else troubled this week.
And after thinking, I went in a wrong way at first, as even with nearest, I will lost my data on blurtexture2.


There is no need to use the nearest, I lost my data when multiplying emissiveColor to emissiveTexture in glowmapGeneration fragment shader.
I modified the color again in the shader, and it works as my expect.

Glad you found the cause! :smiley:

1 Like