Making mapTexelToLinear work with rendertarget texture

Hi,

I am learning how to use selective bloom and trying to get the bloom effect on materials other than MeshBasicMaterial and with the official example (selective bloom), this does not seem to work.

The example I found where bloom can be made to work with any material was written as a codepen by @prisoner849. Here is the link to the original codepen:

But it seems that this version was written for v0.115.0 of three.js and updating the same example to work with versions >0.118.0 is giving me this error:

maptexelToLinear; no matching overloaded function found

In the codepen above it seems like FBO is rendered to a texture and this texture is passed on to the finalPass as baseTexture. I see a solution posted by @Mugen87 here but in this case, the texture is passed as a uniform at program startup.

Here is the updated example on codepen that gives me the error.

How to make this example work with composers as well? So that the texture rendered in the previous pass is passed as “baseTexture” to the shader? Any help regarding this would be invaluable

Hi!
Selective bloom with MeshStandardMaterial in r127:

In your codepen with r119.1, change getTexture() to this:

vec4 getTexture( sampler2D tex ) { return  texture2D( tex , vUv ) ; }
1 Like

Hi @prisoner849,

Your solution worked. Appreciate your fast response

Thanks!

@Srinivas_Prabhu You’re welcome :handshake:

1 Like

Here is an updated example with 2 BoxGeometries and simplified code for someone who is facing the same issue with selective bloom. Hope this will help you as well. This has been updated to work with latest version of three.js

1 Like