how can i do this effect?

hello friends,

i want a camera effect like this image, pls any reference


You need to create a custom shader that chooses a replacement value from a colour spectrum based on some property of the image. If this were a “true” thermal image, that property would be the temperature of the surface in question, but obviously you don’t know the temperature of the elements in your game, so you’ll have to choose some other property instead. You could encode temperature in the vertex colours of each object, for example, or you could simply choose the overall brightness of each pixel, assuming that brighter pixels = hotter.

Having determined the temperature of each pixel, you can then look up the corresponding replacement colour in a ramp texture such as this:


Pseudocode for the fragment shader would look something like this:

// Set temperature equal to the red component of the main texture
half temperature = tex2D(_MainTex, i.uv).r;

// Since temperature will be a value between 0-1, we can 
// look up corresponding colour from temperature gradient
half4 result = tex2D(_TemperatureColourRamp, float2(temperature, 0.5));

// Use the replacement colour 
return result;

I used this approach in my 7dfps game entry earlier this year, and here’s what the output of this approach looks like:

alt text