Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    31
  • comments
    17
  • views
    20299

Radar Shader

Sign in to follow this  

544 views

Finally got my radar working... and I think its even CG complaint

Radar


float4 RADAR_OUTTER_COLOR;
float4 RADAR_INNER_COLOR;
float4 RADAR_COLOR;

float4 RADAR_ANG;
float4 RADAR_RING1;
float4 RADAR_RING2;
float RADAR_PAUSED;

sampler RT : register(s0);

float4 ps_main(float2 iTexCoord : TEXCOORD0): COLOR
{
float4 color = float4(0,0,0,0);
float2 centre = float2(0.5,0.5);
float2 dir = iTexCoord - centre;
float dist = length(dir);


if(dist<0.45)
{
color = tex2D(RT, iTexCoord);// * float4(0,0,4,1);
float ang = (180 + atan2(dir.y,dir.x) * 57.325);


if(ang> RADAR_ANG.x && ang {
color += RADAR_INNER_COLOR;
}else{
color += RADAR_OUTTER_COLOR;
}

if((dist > RADAR_RING1.x && dist < RADAR_RING1.y) || (dist > RADAR_RING1.z && dist < RADAR_RING1.w) || (dist

> RADAR_RING2.z && dist < RADAR_RING2.w))
{
color += RADAR_COLOR;
}




// color *= float4(0,0,1,0);
color.a = .5;
}

return color;
}

Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!