Tag:Shader

  • Unity shader for texture masking

    Time:2020-11-17

    Texture masking is very useful. In short, it allows us to protect certain areas of the model from certain factors.For example, we sometimes want some areas of the surface of the model to reflect more strongly, while some areas are weaker. In order to get more detailed results, we need to use a mask texture […]

  • Simple anti energy shield based on unity shader intersection algorithm

    Time:2020-11-7

    Unity shader learning: a simple anti energy shield based on intersection algorithm Main ideas:Compare the depth difference between the object and the scene depth map in the observation space. The smaller the depth difference is, the deeper the color is. Add edge light to mark the outline. Shader section: Shader “Unlit/DepthOutline” { Properties{ _MainTex(“MainTex”,2D) = […]

  • Unity shader for glass effect

    Time:2020-11-5

    Learn from unity shader: glass material, for your reference. Mainly through reflection and refraction to achieve transparent effect, using Fresnel to mix. Shader section: Shader “Unlit/Crystal” { Properties { _Cube(“Skybox”,Cube)=””{} //Refraction angle _EtaRatio(“EtaRatio”, Range(0, 1)) = 0 //Fresnel coefficient _FresnelBias(“FresnelBias”,float)=0.5 _FresnelScale(“FresnelScale”,float)=0.5 _FresnelPower(“FresnelPower”,float)=0.5 } SubShader { Tags { “RenderType”=”Opaque” } LOD 100 Pass { CGPROGRAM #pragma […]

  • Unity shader for glass refraction

    Time:2020-11-4

    In this paper, we share the specific code of unity shader to realize glass refraction for your reference. The specific contents are as follows Shader “Unlit/render_reflect” { Properties { _MainTex (“Texture”, 2D) = “white” {} } SubShader { Tags {“Queue” = “Transparent” “RenderType”=”Opaque” } LOD 100 GrabPass{“_ScreenTex”} Pass { CGPROGRAM #pragma vertex vert #pragma fragment […]

  • Unity shader for dynamic fog effect

    Time:2020-11-3

    Unity shader learning: dynamic fog, for your reference, the specific content is as follows Firstly, the four angle vectors of the camera near the cutting plane are transmitted to the shader, then the pixel position in the world coordinate system is calculated by observing the depth value and camera position in the space, and the […]

  • Unity3d shader for streamer effect

    Time:2020-10-31

    In this paper, we share the specific code of unity3d shader to achieve streamer effect for your reference. The specific content is as follows Streamer effect picture: Demo project: download address //Functional requirements: simulate the data transmission effect, and move the highlight color block from the top to the bottom of the model //Function analysis: […]

  • Unity shader for ink and wash effect

    Time:2020-10-30

    Unity shader learning: ink effect Occasionally I saw the ink style post-processing of grade 9 armored chrysalis on the Internet, and I found it interesting. Referring to the implementation, it is still related to the previous oil painting effect algorithm. What filtering is temporarily unclear, so it should be used to deal with hand-painted effects. […]

  • Unity shader for rendering sketch style

    Time:2020-10-29

    In this paper, we share the specific code of unity shader to achieve sketch style for your reference. The specific content is as follows principle Six sketch textures are used for rendering. In the rendering stage, the illumination per vertex is calculated in the vertex shading stage. The blending weights of the six textures are […]

  • Unity shader for sketch effect

    Time:2020-10-28

    In this paper, we share the specific code of unity shader to achieve sketch effect for your reference. The specific content is as follows This is the unreal rendering in Lele’s book. The algorithm is very interesting. If you are interested, you can have a try. The basic principle of sketch effect: first, draw the […]

  • Unity shader for graphics rendering (blue sky, white clouds, sea)

    Time:2020-10-27

    Unity shader learning: 2D graphics rendering (blue sky, white clouds, sea), for your reference, the specific content is as follows It’s basically some mathematical algorithms Shader section: Shader “Unlit/2D-Ocean” { Properties { _MainTex (“Texture”, 2D) = “white” {} _SunColor(“SunColor”,Color) = (1,1,1,1) _SunRoundColor(“SunRoundColor”,Color) = (1,0,0,1) _WaveColor1(“WaveColor1”,Color) = (1,1,1,1) _WaveColor2(“WaveColor2”,Color) = (1,1,1,1) _WaveColor3(“WaveColor3”,Color) = (1,1,1,1) _WaveColor4(“WaveColor4”,Color) = […]

  • Unity shader realizes 2D game fog

    Time:2020-10-26

    In this paper, we share the specific code of unity shader to realize 2D game fog for your reference. The specific content is as follows Let’s see the effect first. I use the post-processing effect of the screen, first go to Photoshop to make a picture as follows, click a point with a brush, and […]

  • Unity3d shader for dynamic sky

    Time:2020-10-25

    In this paper, we share the specific code of unity3d shader to realize dynamic starry sky for your reference. The specific contents are as follows Shader “Unlit/Test” { Properties { [Gamma][Header(CubeMap)]_MainColor(“MainColor”,COLOR)=(0.5,0.5,0.5,1) _Spec(“Spec”,Range(1,8))=1 [NoScaleOffset]_Tex(“CubeMap”,CUBE)=”black”{} [Header(Rotation)][Toggle(_ENABLEROTATION_ON)]_EnableRotation(“Enable Rotation”,Float)=0 [IntRange]_Rotation(“Rotation”,Range(0,360))=0 _RotationSpeed(“RotationSpeed”,float)=1 [Header(Fog)][Toggle(_ENABLEFOG_ON)]_EnableFog(“Enable Fog”,float)=0 _FogHeight(“FogHeight”,Range(0,1))=1 _FogSmooth(“FogSmooth”,Range(0.01,1))=0.01 _FogHill(“FogHill”,Range(0,1))=0.5 } SubShader { Tags { “RenderType”=”Background” “Queue”=”Background” “IgnoreProjector”=”True” “ForceNoShadowCasting”=”True”} LOD 100 Cull Off […]