TA Log 11082021

Blom like an artist: Bloom Like an Artist Circular Progress Bar https://bgolus.medium.com/progressing-in-circles-13452434fdb9 ATan vs. ATan2 $$ \tan{\alpha} = \frac{\sin{\alpha}}{\cos{\alpha}} $$ and we have Quadrant Angle sin cos tan ------------------------------------------------- I 0 < α < π/2 + + + II π/2 < α < π + - - III π < α < 3π/2 - - + IV 3π/2 < α < 2π - + - Only knowing tangent doesn’t give exact quadrant, so we need atan2()....

November 8, 2021 · Kyle Fang

TA Log 11012021

Unity Lighting System Direct light is light that is emitted, hits a surface and is then reflected directly into a sensor. Indirect light is all other light that is ultimately reflected into a sensor, including sky light. Reali-time lighting is calculated at runtime, while baked lighting is calculated in advance and is saved as lighting data. Unity: Render Feature Blit https://forum.unity.com/threads/apply-effect-to-objects-on-specific-layer-using-stencil-solved.841150/ https://forum.unity.com/threads/has-anyone-ever-gotten-a-stencil-buffer-to-copy-with-commandbuffer-blit.432503/ In URP’s custom render feature pass, Blit doesn’t pass the depth/stencil when blitting a color texture....

November 1, 2021 · Kyle Fang

TA Log 10182021

Sprite Billboard https://www.reddit.com/r/Unity3D/comments/ahqbod/a_billboard_sprite_shader_in_only_one_axis/ To make the sprite look at the camera all the time (billboard)_ View space is a rotated version of world space with the xy plane parallel to the view plane. It’s intuitive to make the billboard in here. First we transform the origin in the view coordinates and then float4 newVertex = mul(UNITY_MATRIX_P, mul(UNITY_MATRIX_MV, float4(0.0, 0.0, 0.0, 1.0)) + float4(input.vertex.x, input.vertex.y, 0.0, 1.0)); We can also cancel out the rotation before the model matrix and then apply the view matrix....

October 21, 2021 · Kyle Fang

TA Log 09262021

C# It’s a good practice to save game setting data to binary files. To save: FileStream dataStream = new FileStream( dataPath, FileMode.Create); BinaryFormatter converter = new BinaryFormatter(); converter.Serialize(dataStream, toSave); dataStream.Close(); To open/load: FileStream dataStream = new FileStream(dataPath, FileMode.Open); BinaryFormatter converter = new BinaryFormatter(); DataClass data = converter.Deserialize(dataStream) as DataClass; We can use it outside game too. For example, dynamic bone’s parameter settings will lost once the model is updated, because people usually replace the whole prefab....

September 26, 2021 · Kyle Fang

TA Log 09222021

RGB to Grayscale dot(color.rgb, float3(0.298999995, 0.587000012, 0.114)); It’s a convenient way to write rather than multiply and add up every channel. Tangent, Normal, Bitangent Tangent is the U of the UV for both OpenGL and DirectX. Left to right, 0.0 to 1.0. The binormal is the V of the UV. OpenGL is bottom to top, and DirectX is top to bottom. Unity is +Y, OpenGL standard. Unreal is -Y, DirectX standard....

September 22, 2021 · Kyle Fang