Rotation Matrix

$P = (x, y) = (1, 0)$ $P' = (x', y' )$ $\cos{\theta} = \frac{x'}{x}$ $\sin{\theta} = \frac{y'}{x}$ therefore: $x' = \cos{\theta} \cdot x$ $y' = \sin{\theta} \cdot x$ similarly: $Q = (x, y) = (0, 1)$ $ Q' = (x', y' )$ $\cos{\theta} = \frac{y'}{y}$ $\sin{\theta} = \frac{-x'}{y}$ therefore: $x' = -\sin{\theta} \cdot y$ $y' = \cos{\theta} \cdot y$ add them together: $\begin{bmatrix} \cos{\theta} & -\sin{\theta} \\ \sin{\theta} & \cos{\theta} \\...

May 14, 2019 · Kyle Fang

Dot Product

Reference: “Dot products and duality | Essence of linear algebra, chapter 9”, 3Blue1Brown Algebra example: $\begin{bmatrix} 1 & 2 \end{bmatrix} \cdot \begin{bmatrix} 3 \ 4 \end{bmatrix} = 1 \cdot 3 + 2 \cdot 4$ Gemoetrically: ![projection](https://i.imgur.com/HYJeePM.png =150x150) The dot product of v and u = (length of projection of v onto u)(length of u) Order and Symmetry Order doesn’t matter. (Length of projected v) x (Length of u) = (Length of projected u) x (Length of v)...

January 27, 2019 · Kyle Fang

Unity Physically Based Render

Lambertian and Blinn-Phong Lambertian Model Lambertian model is based on lambertian reflectance, is the property that defines an ideal “matte” or diffusely reflecting surface. The reflected quantity is equal to the vertical component of the incident light ray. Shader "Custom/LambertianShader" { Properties { _MainTex ("Texture", 2D) = "white" {} } SubShader { Tags { "RenderType"="Opaque" } LOD 200 CGPROGRAM #pragma surface surf SimpleLambert struct Input { float2 uv_MainTex; }; sampler2D _MainTex; void surf (Input IN, inout SurfaceOutput o) { o....

Kyle Fang