I am just trying to make a chaser light effect so that the light appears to be circling around the sign. So far my attempts to write code to turn on emissions or anything along those lines has not worked. I tried using code for point lights but i needed like 39 of em and they stopped working after a few
#Trying to create a chaser Light effect around the blue circles
1 messages · Page 1 of 1 (latest)
Shader "Custom/LightChaser"
{
Properties
{
_MainTex ("Texture", 2D) = "white" { }
_LightData ("Light Data", 2D) = "white" { } // Use a texture for light information
_ChaserSpeed ("Chaser Speed", Range(0, 10)) = 1
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
CGPROGRAM
#pragma surface surf Lambert
sampler2D _MainTex;
sampler2D _LightData; // Texture to store light information
float _ChaserSpeed;
struct Input
{
float2 uv_MainTex;
};
void surf(Input IN, inout SurfaceOutput o)
{
// Extract light information based on UV coordinates
float lightIntensity = tex2D(_MainTex, IN.uv_MainTex).r;
// Sample the light texture for additional information
float lightData = tex2D(_LightData, IN.uv_MainTex).r;
// TODO: Use lightIntensity and lightData to control the appearance of each light
// Example: Animated chaser effect
float chaser = frac(_ChaserSpeed * _Time.y);
float distance = abs(IN.uv_MainTex.x - chaser);
float chaserEffect = smoothstep(0.01, 0.05, distance);
// Combine lightIntensity and chaserEffect to create the final output
o.Albedo = lightIntensity * chaserEffect;
o.Alpha = 1.0;
}
ENDCG
}
FallBack "Diffuse"
}
According to the code you've posted, you are using the UV.x value to time the effect. Are the different light meshes spread along the UV.x axis ?
Furthermore, you may want to use the o.Emission output to fake emitting light effect instead of Albedo
I just need it to circle through the unit through each circle and im not sure how to accomplish this
The first step is to create/layout the UV coordinates of the sign's yellow dots so that they're all in a horizontal row, lined up between zero and one. Have you done that, Sam?
I have just made a texture like this
is this what you mean