TA Log 02282022

URP URP doesn’t support OnPreCull, OnPreRender, OnPostRener, and OnRenderImage. URP does support OnRenderObjectand OnWillRenderObject, but it doesn’t support recursive rendering. URP has 4 new hooks: RenderPipelineManager.beginFrameRendering RenderPipelineManager.beginCameraRendering RenderPipelineManager.endCameraRendering RenderPipelineManager.endFrameRendering // we can subscribe these events private void OnEnable() { RenderPipelineManager.beginCameraRendering += ExecuteRenderActions; } public void ExecuteRenderActions(ScriptableRenderContext context, Camera camera) { // rendering code .. } Planar Reflection The idea is to create a reflected camera to render the screen from below, and render what the reflected camera sees on the planar....

February 28, 2022 · Kyle Fang

TA Log 02212022

Snow A simple snow surface implementation is to calculate dot product of normal and a custom direction. half snowSurfaceMask = clamp(dot(normalWS, _SnowDirection), 0.0f, 1.0f); It is similar to NdotL. We can add some small scale gradient noise or simple noise to this mask, and make it white. When we change the _SnowDirection, we might add some unwanted artifacts. To solve this problem, multiplying another upward snow mask to the snow surface mask....

February 21, 2022 · Kyle Fang

TA Log 02142022

Unity Settings source: https://forum.unity.com/threads/warning-to-all-my-friends-beware-optimise-mesh-data.544735/ Optimize Mesh Data will strip unused in mesh component. If the project only instantiate mesh during runtimes, Unity might delete some components in the build, such as lightmap uv. Unity Shader Erosion The most basic erosion (or dissolve) is the alpha clipping method. To soft the erosion, we can instead use a float to convert the noise between 0 and 1, and use the result as alpha....

February 14, 2022 · Kyle Fang

TA Log 01242022

Unity Shader Undocumented rules https://medium.com/@jasonbooth_86226/loose-ends-in-unity-shaders-df5e98bdcc3 URP Depth https://www.cyanilux.com/tutorials/depth/ https://forum.unity.com/threads/need-clarification-on-urps-use-of-the-depth-prepass.1004577/ Between rendering opaque and transparent objects, URP copies the depth buffer and store it to the depth texture. Transparent objects don’t write to it, because writing happened before the transparent rendering. Whenever URP can not copy depth, it uses Depth Prepass. It uses DepthOnly pass in the shader to write the depth. The following situation cannot copy the depth: URP Asset enabled MSAA Hardware doesn’t support copying or the RT format URP resolves depth with MSAA and keeps precision (future update) Scene Camera or Preview Camera Rendering to XR In the scene view, any shader that has not DepthOnly pass will not write depth....

January 24, 2022 · Kyle Fang

TA Log 01232022

Shadow Mapping Renders the entire scene’s depth from the point of the view of the camera. This data corresponds to a fragment’s z coordinates in clip space. Render the entire scene’s shadow map of the light from the point of the view of the light source. Light acts as a camera. the depth values tell us how far a ray of light traveled before it hit something. multiple renders if shadow cascades is active....

January 23, 2022 · Kyle Fang