How can I make heat shimmer in the BGE?

(Chompy) #1

How can I simulate the heat shimmering effect in a far off background using Python? In this case there is a property known as “temp” , without the quotes which defines the temperature, and another which sets the point at where heat shimmering starts, e.g, 38. You can modify the intensity, how much distortion, and the speed too. What I want to replicate is heat shimmer on a very hot day, but it involves using Python to use a texture that refracts to create a heat shimmering efdect, or a plane with a Motion actuator tied to the script with a property. Heat shimmer is created because the air next to the hot surface rises, meets cold air, and mixes, creating an inferior mirage, which distorts the light coming to your eyes. You can see this most commonly in the desert/hot summer days.

(Nicholas_A) #2

haha well good luck doing it in python. You’ll need to code some glsl shaders for that bro.

(modelinblender) #3

Is that not possible? What about transparency effect of moving particles? I wouldn’t know where to begin with that.

( #4

Where to begin? Learning GLSL basics for sure, and then maybe writing your own 2D Filters / material shaders in order to test the waters.

Image distortion requires a GLSL shader, no way around it (that I know of).

(modelinblender) #5

I wouldn’t know anything about that.

I was just thinking about some effects I could use for a mini game. I use a sphere as a sort of sensor and effect, but it isn’t quite necessary as it doesn’t work with the player for anything. An effect like that could come in handy.

(BluePrintRandom) #6

what you are looking for is called refraction

(Chompy) #7

The trouble is, I have no knowledge of GLSL shaders, or how to write them correctly in Blender. I know you have to write it in Blender’s text editor, but GLSL shaders look very complex to write. I tried using Render To Texture, but it is very blurry, and as an overlay scene, it does not affect the game, I think.

Also, how do I make a 2d filter? An example one which refracts the game.

(Thomas Murphy) #8

GLSL shaders are sort of a deep dive. What you could try to do is create a shader with material nodes-- the only problem is that it would have to be on a material, and it couldn’t effect objects behind it.

This water ripple effect is a good example of creating a “heat-like” distortion in the BGE. Take a look at it here:

(BluePrintRandom) #9

I have a idea - use a plane that is subdivided and have a few shape key actions where it gets distorted and texture it with a render to texture from a camera in the scene,

point main cam at plane and play actions to distort / shimmer

this is similar but using a kdtree to deform the vertex which is much slower

(BluePrintRandom) #10

here is a quick exampleShimmer.blend (547.4 KB)

(AeroLynx) #11

There is an old thread from a user called Fluppi393 which might help. Quite some time ago, I used his method to create a heat distortion effect demo, but applied to a jet engine exhaust.