TA Log 09062021

Shader Animation The usual method of making shader animation is to use time parameter and sin wave function. It’s fast and easy to make simple periodical animation, such as water wave and flashing color. However, to have more complex periodical animation, we need to shape sin wave function with min(), max(), abs(), and the sin function it self. It might requires a lot of works to shape it. I figured out a simpler way to input the animation parameters: texture....

September 6, 2021 · Kyle Fang

TA Log 08302021

Collections UV distortion: https://twitter.com/Fakirgnome/status/1120421374571495426 Easy PS techniques to create distance field texture: https://twitter.com/Ed_dV/status/1415156393959518209 easing demonstration: https://easings.net/ URP SurfaceInput.hlsl Declartion: BaseMap BumpMap / NormalMap EmissionMap Helpers: Alpha() sample albedo and alpha sample normal sample emission There’s a problem in URP’s hlsl files. They are all tight together to build the URP shader, not SRP. This reminds me that URP is an example of SRP. It’s better to have my own helper library....

August 30, 2021 · Kyle Fang

TA Log 08162021

Fog Linear Fog c = fog coordinates, S, E = start and end $$f = \frac{E - c}{ E - S}$$ Exponential Fog d = fog density $$f = \frac{1}{2^{cd}} = 2^{-cd}$$ Exponential Squared Fog $$f = \frac{1}{2^{cd^2}} = 2^{- (cd)^2}$$

August 16, 2021 · Kyle Fang

TA Log 08092021

Light URP has only one main light. It must be the directional light. If it is not set in the Sun Source, then the brightest directional light is the main light. Test it with the light direction. half4 color = half4(_MainLightPosition.xyz, 1.0); Stencil Manual: https://docs.unity3d.com/Manual/SL-Stencil.html YouTube: https://www.youtube.com/watch?v=-NB2TR8IjE8 The stencil buffer stores an 8-bit integer value for each pixel in the frame buffer. Stencil test happens before executing the fragment shader. It will compare the value with the reference value....

August 9, 2021 · Kyle Fang

TA Log 08022021

Blend Textures (Multitexturing) http://untitledgam.es/2017/01/height-blending-shader/ A common way to blend textures is the alpha blending. $$C_{result} = C_{source} \cdot F_{source} + C_{destination} \cdot F_{destination} \ F_{source} + F_{destination} = 1$$ Another way is to do linear interpolation. We can linearly interpolate the result color between two textures. $$\frac{y-h_{0}}{x - x_{0}} = \frac{y_{1} - y_{0}}{x_{1} - x_{0}}$$ $$y = \frac{ y_0(x_1 - x) +y_1({x - x_{0})} }{x_1 - x_0}$$ The third way is to use the height map to determine the blend of two textures....

August 2, 2021 · Kyle Fang