Splinter Cell Goggles radar effect

Hello. I am developing a spy game prototype and I would like to know how I can implement the tracking effect seen in the video below, where an energy wave is emitted and the position of objects is revealed in the scenario covered. I need directions on how to reproduce this effect. Thanks in advance for your help.

It’s probably done as a 2D filter that samples the depth texture and uses that to overlay a glow (at least, that’s how I would do it).

I didn’t think I’d implemented a shader this way, but it turns out I have.

There are two effects applied in that video. One is to use a shader that “draws above” all the others. This reveals the hidden equipment behind the doors etc.
The other effect is the white “pulse” that travels down the corridoor.

Here’s the 2D filter I used for that:

//Does a shockwave along the depth channel only where it's dark

uniform sampler2D bgl_RenderedTexture;
uniform sampler2D bgl_DepthTexture;

uniform float camNear;      //camera clipping start
uniform float camFar;       //camera clipping end
uniform float fov;          //camera field of view
uniform float aspect;       //camera aspect ratio
uniform float pulseRange;
uniform float pulsePercent;

float linearize(float depth)
{
    /**Some magic I pinched off Martinish's DOF shader
    I'm not entirely sure how it works, but without it, the mist is
    strange **/
    return -camNear * camFar / (depth * (camFar - camNear) - camFar) ;
}

void main(){
    vec2 texcoord = gl_TexCoord[0].xy;
    vec4 out_col = texture2D(bgl_RenderedTexture, texcoord);
    float depth = texture2D(bgl_DepthTexture,gl_TexCoord[0].xy).z;
    float linear_depth = linearize(depth);

    float shockwave = linear_depth / pulseRange * (1.0 - pulsePercent) / pulsePercent;
    shockwave /= 5.0;
    if (shockwave > 0.5){
        shockwave = 1.0 - shockwave;
    }

    shockwave = shockwave;

    vec4 brighter = out_col*2.0 + vec4(0.5);
    gl_FragColor = out_col + mix(vec4(0.0), brighter, clamp(shockwave, 0.0, 1.0));
}

Add this as a 2D filter, and then create some properties on teh game object for the various uniforms.

    cont.owner['camNear'] = current_cam.near
    cont.owner['camFar'] = current_cam.far
    cont.owner['fov'] = current_cam.fov / 360 * 3.14
    aspect = bge.render.getWindowWidth() / bge.render.getWindowHeight()
    cont.owner['aspect'] = aspect

Then to get a “pulse” along, animate the “pulse_range” and “pulse_percent” uniforms

    cont.owner['pulseRange'] = pulse_range
    cont.owner['pulsePercent'] = pulse_percent

IIRC pulseRange is the maximum distance the pulse should go before it “fades out” and pulsePercent is how far the pulse currently is.

The other part is to show/hide certain objects based on the shockwave. That is a case of toggling the obj.visiable or perhaps animating the alpha channel.

3 Likes

Thanks!!! This is amazing. It was exactly what I was looking for.

half life alyx uses this but a spot lamp almost instead of a wave