当前位置:网站首页>Cyberpunk special effect shader
Cyberpunk special effect shader
2022-07-29 07:57:00 【TingQiaoQiao】
A little sci-fi special effect villain about learning teachers shader Learning from


It is mainly through the triangular wave function as a dynamic texture for transparent and opaque over transformation , Then by superimposing noise texture on this basis , So as to make it more diversified . Finally through smoothstep Function to change its x To achieve different levels of mutation transition . On the basis of this mask , Add the vertex to the direction of the normal to produce an outward expansion effect .
float4 EffectAnim(float noise, float mask, float3 normal, inout float3 vertex){
float baseMask = abs(frac(vertex.y * _EffectParams.x - _Time.x * _EffectParams.y) - 0.5) * 2.0;// Calculate base texture
baseMask = min(1.0, baseMask * 2.0);
baseMask += (noise - 0.5) * _EffectParams.z; // Superimpose the noise texture on the procedural texture created earlier
// The distortion degree of each level of the special effect mask
float4 effectMask = float4(0.0,0.0,0.0,0.0);
effectMask.x = smoothstep(0.0,0.9, baseMask); // Restrict mutation to 0-0.9 Between
effectMask.y = smoothstep(0.2, 0.7, baseMask);
effectMask.z = smoothstep(0.4, 0.5, baseMask); // Restrict mutation to 0.4-0.5 Between
// Vertex colors are stored in the mask
effectMask.w = mask;
vertex.xz += normal.xz * (1 - effectMask.y) * _EffectParams.w * mask;
return effectMask;
} This function acts on the vertex shader In , And before using, we must sample the noise texture to get the noise information .
In pixels shader in , First, use the texture of the special effect uv1 To sample , Because to realize the whole villain is to make a special effect transition from bottom to top , If you divide the villain into heads with the original 、 I'm not uv0 Coordinates will produce light bands on the head and body at the same time , Not quite in line with the desired effect , So open another uv Space to store the information of the whole villain .
Set parameters to receive the information of different mask mutations in the output structure after using the above function . When using this transparent mask , The corresponding transparency needs to be normalized .
Luminescence is obtained by multiplying the area of intermediate transformation by the part of grid lines that you want to emit light , And take advantage of yourself to play pow Function functions
// Special effects part
float3 var_EffectTex = tex2D(_EffectTex, i.uv1).xyz;
float meshMask = var_EffectTex.x;
float randomDisappearMask = var_EffectTex.y;
float slopMask = var_EffectTex.z;
float smallMask = i.EffectMask.x;
float middleMask = i.EffectMask.y;
float bigMask = i.EffectMask.z;
float baseMask = i.EffectMask.w;
float bigOpacity = saturate(floor( randomDisappearMask + middleMask));
float middleOpacity = saturate(floor( slopMask + bigMask));
float opacity = lerp(1.0, min(bigOpacity, middleOpacity), baseMask);
float meshEmission = (bigMask - smallMask)* meshMask ;
meshEmission = meshEmission * meshEmission ;
emission += _EffectCol * meshEmission * baseMask;Different x Mask of range :
bigMask:

middleMask:

smallMask:

You can see that the effect is getting softer .
边栏推荐
- Sqlmap(SQL注入自动化工具)
- Android interview question | how to write a good and fast log library?
- The computer system has no standard tcp/ip port processing operations
- Some thoughts on growing into an architect
- 技术分享| 快对讲综合调度系统
- 下推分析的限制
- Go 事,如何成为一个Gopher ,并在7天找到 Go 语言相关工作,第1篇
- An optimal buffer management scheme with dynamic thresholds paper summary
- Keyboard processing in jetpack compose
- [cryoelectron microscope] relation4.0 - subtomogram tutorial
猜你喜欢

Day 014 2D array exercise

Useful websites

Explanation and closing method of server 135, 137, 138, 139, 445 and other ports

10 practical uses of NFT

How to draw an excellent architecture diagram

Dynamic thresholds buffer management in a shared buffer packet switch paper summary

Excellent urban design ~ good! Design # visualization radio station will be broadcast soon
![[cryoelectron microscope | paper reading] interpretation of sub fault average m software: multi particle cryo EM refining with M](/img/5e/69987afcd1e50ba37bc49441dd3a50.png)
[cryoelectron microscope | paper reading] interpretation of sub fault average m software: multi particle cryo EM refining with M

Sqlmap(SQL注入自动化工具)

207.课程表
随机推荐
[cryoelectron microscope | paper reading] interpretation of sub fault average m software: multi particle cryo EM refining with M
Strongly connected component
For the application challenge of smart city, shengteng AI gives a new solution
在js中,0表示false,非0表示true
Jiamusi Market Supervision Bureau carried out special food safety network training on epidemic and insect prevention
Cross domain problems when downloading webapi interface files
工业互联网行至深水区,落地的路要怎么走?
Shell script - global variables, local variables, environment variables
MySQL 45 讲 | 07 行锁功过:怎么减少行锁对性能的影响?
The smallest positive number that a subset of an array cannot accumulate
[密码学实验] 0x00 安装NTL库
Database persistence +jdbc database connection
Operator overloading
As long as flutter is data, it will be judged null
Measured waveform of boot capacitor short circuit and open circuit of buck circuit
Solving linear programming problems based on MATLAB
输出1234无重复的三位数
Mqtt server setup and mqtt.fx testing
Dynamic Thresholds Buffer Management in a Shared Buffer Packet Switch论文总结
[untitled] format save