The 3D object can be bent through vertex deformation, which is common in the runway of parkour game. Can be bent left, right, up, and down.
Shader"custom/vertexcolorcurved"{Properties {//6 parameters required by shader_maintex ("Base (RGB)", 2D) =" White"{} _qoffset ("Offset", Vector) = (0,0,0,0) _dist ("Distance", Float) =100.0_brightnessamount ("Brightness Amount", Float) =1.0_saturationamount ("saturation Amount", Float) =1.0_contrastamount ("contrast Amount", Float) =1.0} subshader {Tags {"Queue"="Transparent"} Pass {Blend srcalpha oneminussrcalpha cgprogram#pragmaVertex vert#pragmaFragment Frag#include"Unitycg.cginc"sampler2d _maintex; FLOAT4 _qoffset; float_dist; fixed_brightnessamount; fixed_saturationamount; fixed_contrastamount; float_opacityamount; structv2f {float4 pos:sv_position; FLOAT4 uv:texcoord0; FLOAT3 Viewdir:texcoord1; Fixed4 Color:color; }; v2f Vert (Appdata_full v) {v2f o; FLOAT4 vPOS=Mul (UNITY_MATRIX_MV, V.vertex); floatZoff = vpos.z/_dist; vPOS+ = _qoffset*zoff*Zoff; O.pos=Mul (unity_matrix_p, vPOS); O.uv=V.texcoord; //O.color.rgb = V.color.rgb; //take vertex color returno; } float3 contrastsaturationbrightness (float3 color,floatBrtfloatSatfloatcon) { //increase or decrease these values to//adjust R, G and B color channels separately floatAVGLUMR =0.5; floatAVGLUMG =0.5; floatAvglumb =0.5; //luminance coefficients for getting luminance from the imageFLOAT3 Luminancecoeff = FLOAT3 (0.2125,0.7154,0.0721); //Operation for BrightmessFLOAT3 Avglumin =float3 (AVGLUMR, AVGLUMG, Avglumb); FLOAT3 Brtcolor= Color *BRT; floatINTENSITYF =dot (Brtcolor, Luminancecoeff); FLOAT3 intensity=float3 (INTENSITYF, INTENSITYF, INTENSITYF); //operation for SaturationFLOAT3 Satcolor =lerp (intensity, brtcolor, Sat); //Operation for contrastFLOAT3 concolor =lerp (avglumin, Satcolor, con); returnconcolor; } Half4 Frag (v2f i): COLOR0 {fixed4 Rendertex=tex2d (_maintex, I.UV); // //Apply vertex Color//Rendertex.rgb *= I.color.rgb; //vertex color and map blending//Apply The brightness, saturation, contrast operationsRendertex.rgb =contrastsaturationbrightness (Rendertex.rgb, _brightnessamount, _saturationamount, _ContrastAmount); returnRendertex; } ENDCG}} FallBack"Diffuse"}
Vertex deformation of Shader