This shader uses the sin() function to create a pulsing effect on the object's transparency. The _PulseSpeed property can be adjusted in the Unity editor to control the speed of the pulse.
You can apply this shader to the spatial mapping mesh and adjust the properties to get the desired effect.
User
add origin point in world space
Assistant
Here is an updated version of the HLSL shader that allows you to specify an origin point in world space for the pulsing effect:
This version of the shader includes a new property named _Origin, which is a float4 vector that represents the origin point in world space. The distance() function is used to calculate the distance between the current fragment's world position and the origin point. This distance value is then used to offset the time value in the sin() function, allowing you to create a pulsing effect that originates from the specified origin point.
You can adjust the _Origin property in the Unity editor to specify the origin point for the pulsing effect.
This version of the shader includes new properties named _PulseColor and _Radius_PulseColor is a float4 vector that represents the pulse color
_Radius is a float that represents the radius of the pulse effect area in world space.
It uses distance() function to calculate the distance between the current fragment's world position and the origin point.
The if statement checks if the distance is less than the radius, if yes, it will lerp(interpolate) between the color of the object and the pulse color using the pulse value.
You can adjust the _PulseColor, _Radius and _Origin properties in the Unity editor to control the appearance of the pulse effect.
In this version of the shader, I have added the #pragma target 3.0 and #pragma multi_compile _ LIGHTMAP_ON directives, and included the UnityPBSLighting.cginc file. Also, I have added the SurfaceOutput structure and assigned the Normal, Emission, Specular, and Smoothness fields to appropriate values.
This version of the shader should work with Unity URP and you can use it in your Unity project and adjust the properties as needed.