distortion/refraction

Im trying to get an heat distortion effect into my game, I tryed different tecniques, for example using the the material: Fx/glass/stainedBumpDistort and putting it on particles, this works perfectly, but Objects beeing in front of the particles also become distorted. Looking at the pro-water, it seems to have the same effect, but the waterscript fixes this using “clip-plane offset”, setting the nearplane of the camera to the refractionplane, so objects in front dont get distorted. Someone has an idea how to transfer this clip-plane-thing to other objects/shaders?

Thanks for looking into this…

edit: screenshot of the effect: character standing in front off a cube with Fx/glass/stainedBumpDistort(no diffuse, just normalmap) material:

solution depends on technique you use for this effect:

  • if this is a shader only effect, then you need to render distortion AFTER all that should be distorted, but BEFORE everything that should not. this can be achieved by setting shader queue in shader declaration

  • if this is a render texture with posteffect effect, then solution is layers-separation. e.g. you should use layer for distortion object and turn on render of that objects only to this camera