Pickable Objects Shader

Here’s how to create a simple effect to communicate to the players which objects are pickable, interactive etc.
A lot of games implemented this effect in clever ways; today I’m showing a simple version that relies on the object’s vertices coordinates (like a gradient) and passing of time.
HLSL
Here’s an example, written in HLSL. Even if this tutorial example is targeted for Unity the mechanics and logic apply to all other engines as well.
//@febucci, https://www.febucci.com/tutorials/
//Support my work here: https://www.patreon.com/febucci
Shader "Custom/PickableObjects" {
Properties{
_HighlightColor("Highlight Color", Color) = (1,1,1,1)
_ObjectColor("Object Color", Color) = (1,1,1,1) // you can use a Texture instead of a Tint
}
SubShader{
Tags { "RenderType" = "Opaque" }
CGPROGRAM
#pragma surface surf Standard vertex:vert
#include "UnityShaderVariables.cginc" //to use _Time
float4 _ObjectColor;
float4 _HighlightColor;
struct Input {
float vertexPos;
};
void vert(inout appdata_full v, out Input o) {
UNITY_INITIALIZE_OUTPUT(Input, o);
o.vertexPos = v.vertex.x; // passes the vertex data to pixel shader, you can change it to a different axis or scale it (divide or multiply the value)
}
void surf(Input IN, inout SurfaceOutputStandard o) {
float highlight_value = clamp( //clamps the value between 0 and 1 (since "cos" can go from -1 to 1)
cos(
_Time.y * 4 - //4 is the effect speed
IN.vertexPos),
0,
1);
o.Albedo = lerp(_ObjectColor, _HighlightColor, highlight_value);
o.Emission = lerp((0,0,0), _HighlightColor.xyz, highlight_value);
}
ENDCG
}
FallBack "Diffuse"
}
Shader Graph
Here’s the same effect created in Unity Shader Graph.
To use it you must enable one Scriptable Render Pipeline in the Package manager, for example the Lightweight RP or the High Definition one.

Amplify Shader Editor
Here’s the same effect created using the plugin Amplify Shader Editor.

Thanks for reading! ❤️
Let us know what you think! We're a small team and we are loving what we do, so any feedback is appreciated ❤️ You can also consider joining the newsletter (either weekly or monthly, we care deeply about it) and never miss our new posts. Cheers!
✦ Join the newsletterMore Posts
I'll be doing a workshop at DevGAMM Lisbon this year!
I'll be doing a workshop at DevGAMM Lisbon this year! Designing tools from start to finish and prototyping with Godot, docs and much more. Looking forward to it!
Creating custom inspectors in Godot C# more easily
Creating custom inspectors in Godot can become a bit tedious in C#, so we have built a custom and free addon that handles this for you!
LinkedIn will use your data to train thier AI
Starting November 3rd, 2025, LinkedIn will start using your data to train their AI. Ughh.
The Best Gamescom so far! August 2025
We just attended Gamescom (and devcom) this year and they were the best one for us so far!! Here's a short update about the general mood and more thoughts.
How to dynamically scale font size in Godot
We wrote a custom script to scale font sizes dynamically in Godot, so that we can make a better and responsive UI for different resolutions. Read More!
I'm giving a talk at devcom 2025!
I am giving a talk at devcom 2025 about the many lessons I have learned while developing and selling Text Animator for Unity! I'll also make a post here in the future... read more!
Comments