<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>TODO on BoilTask's Blog</title><link>https://boiltask.com/en/tags/todo/</link><description>Recent content in TODO on BoilTask's Blog</description><generator>Hugo -- gohugo.io</generator><language>en-US</language><lastBuildDate>Thu, 29 Jan 2026 12:26:47 +0800</lastBuildDate><atom:link href="https://boiltask.com/en/tags/todo/index.xml" rel="self" type="application/rss+xml"/><item><title>GAMES104 Modern Game Engine - Rendering of Terrain, Atmosphere, and Clouds in Games (Part 1)</title><link>https://boiltask.com/en/note/games104-game-engine-6/</link><pubDate>Thu, 29 Jan 2026 12:26:47 +0800</pubDate><guid>https://boiltask.com/en/note/games104-game-engine-6/</guid><description>&lt;blockquote&gt;
&lt;p&gt;There are quite a few things I didn&amp;rsquo;t fully understand here; I&amp;rsquo;ll need to go over them again later.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="the-god-of-the-earth-and-the-god-of-the-sky"&gt;&lt;a href="#the-god-of-the-earth-and-the-god-of-the-sky" class="header-anchor"&gt;&lt;/a&gt;The God of the Earth and the God of the Sky
&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Course positioning&lt;/strong&gt;: Lecture 6 of GAMES104 &lt;em&gt;Modern Game Engine: From Introduction to Practice&lt;/em&gt;, on the rendering of &amp;ldquo;Mother Nature&amp;rdquo; — how to express the magnificent natural world with 0s and 1s.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;ldquo;God of the Earth&amp;rdquo; and &amp;ldquo;God of the Sky&amp;rdquo;&lt;/strong&gt;: In a game engine team, the engineer responsible for the terrain system is called the &amp;ldquo;God of the Earth&amp;rdquo;, and the one responsible for sky, lighting, and clouds is called the &amp;ldquo;God of the Sky&amp;rdquo;. These titles arose spontaneously within teams and reflect a love for the technology of rendering nature.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Rendering the beauty of nature&lt;/strong&gt;: From Spanish cave paintings to Picasso, the human instinct to express nature continues to this day. The mission of game engine developers is to turn mountains, rivers, and skies into virtual worlds with mathematical formulas.&lt;/p&gt;
&lt;h2 id="terrain-rendering-basics"&gt;&lt;a href="#terrain-rendering-basics" class="header-anchor"&gt;&lt;/a&gt;Terrain Rendering Basics
&lt;/h2&gt;&lt;h3 id="core-concept-height-field"&gt;&lt;a href="#core-concept-height-field" class="header-anchor"&gt;&lt;/a&gt;Core Concept: Height Field
&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;Definition&lt;/strong&gt;: Terrain in a game engine is called &lt;strong&gt;Terrain&lt;/strong&gt;, a word rooted in the Old English meaning &amp;ldquo;mother of the earth&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Height Field&lt;/strong&gt; is the most basic way to represent terrain:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use a 2D grayscale image to represent terrain height (similar to a contour map)&lt;/li&gt;
&lt;li&gt;Mathematical essence: $y = f(x,z)$, a single-valued function&lt;/li&gt;
&lt;li&gt;Long before computer games appeared, surveying already used contour lines (Counter) to represent terrain&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Geometry generation&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Generate a uniform grid (e.g., one vertex per meter)&lt;/li&gt;
&lt;li&gt;Displace vertices along the Y axis according to the Height Field&lt;/li&gt;
&lt;li&gt;The early approach is simple, but in an Open World the data volume explodes (1km×1km needs 1 million vertices)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="fractal-and-the-laws-of-nature"&gt;&lt;a href="#fractal-and-the-laws-of-nature" class="header-anchor"&gt;&lt;/a&gt;Fractal and the Laws of Nature
&lt;/h3&gt;&lt;p&gt;Natural terrain (mountain ranges, coastlines, erosion marks) follows the principle of &lt;strong&gt;fractals&lt;/strong&gt;: infinitely self-similar shapes. This mathematical law is the foundation of procedural terrain generation.&lt;/p&gt;
&lt;h2 id="terrain-lod-level-of-detail-techniques"&gt;&lt;a href="#terrain-lod-level-of-detail-techniques" class="header-anchor"&gt;&lt;/a&gt;Terrain LOD (Level of Detail) Techniques
&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Core conflict&lt;/strong&gt;: up close you need detail, far away you need efficiency.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;LOD principles&lt;/strong&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Distance-dependent&lt;/strong&gt;: dense nearby, sparse far away&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;FOV (Field of View)-dependent&lt;/strong&gt;: the narrower the view (e.g., when aiming down sights), the finer the triangles; the wider the view, the sparser they are
&lt;ul&gt;
&lt;li&gt;Rationale: at the same screen pixels, the smaller the FOV, the more pixels a single object occupies, so higher geometric precision is required&lt;/li&gt;
&lt;li&gt;Application: 3x and 8x scopes are implemented by shrinking the FOV&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="mesh-subdivision-algorithms"&gt;&lt;a href="#mesh-subdivision-algorithms" class="header-anchor"&gt;&lt;/a&gt;Mesh Subdivision Algorithms
&lt;/h3&gt;&lt;h4 id="binary-triangle-tree"&gt;&lt;a href="#binary-triangle-tree" class="header-anchor"&gt;&lt;/a&gt;Binary Triangle Tree
&lt;/h4&gt;&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Method&lt;/strong&gt;: always split at the midpoint of the longest side (the hypotenuse) of an isosceles right triangle, producing two new isosceles right triangles&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Structure&lt;/strong&gt;: a binary tree&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Problem&lt;/strong&gt;: &lt;strong&gt;T Junction (T-shaped junction / crack)&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;When adjacent triangles have different subdivision levels, the shared edge ends up with &amp;ldquo;a vertex on one side and no vertex on the other&amp;rdquo;&lt;/li&gt;
&lt;li&gt;Result: cracks appear in the terrain (white edges showing the sky background)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Solution&lt;/strong&gt;: force-refine the coarser side until it matches its neighbor&amp;rsquo;s level&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="quadtree--the-mainstream-approach-in-modern-games"&gt;&lt;a href="#quadtree--the-mainstream-approach-in-modern-games" class="header-anchor"&gt;&lt;/a&gt;Quadtree — the mainstream approach in modern games
&lt;/h4&gt;&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Idea&lt;/strong&gt;: cut the terrain into &amp;ldquo;tofu cubes&amp;rdquo;, which matches human intuition and computer storage conventions (textures and height maps are all block-shaped)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Hierarchy&lt;/strong&gt;:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Block&lt;/strong&gt;: e.g., a 512m×512m on-disk data block (stores height map, textures, vegetation, and building information)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Patch&lt;/strong&gt;: further subdivided into e.g. 64m×64m pieces&lt;/li&gt;
&lt;li&gt;Stop merging once subdivided to the visual limit&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;T Junction solution: Stitching&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Rather than changing the geometry topology, the extra vertices are &amp;ldquo;stitched&amp;rdquo; onto the neighbor&amp;rsquo;s edge&lt;/li&gt;
&lt;li&gt;This forms &lt;strong&gt;degenerate triangles&lt;/strong&gt; (triangles with zero area)&lt;/li&gt;
&lt;li&gt;Advantage: the mesh structure is unchanged, and the code is simpler than with a Binary Triangle Tree&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="gpu-driven-terrain-tessellation"&gt;&lt;a href="#gpu-driven-terrain-tessellation" class="header-anchor"&gt;&lt;/a&gt;GPU-Driven Terrain Tessellation
&lt;/h2&gt;&lt;h3 id="traditional-pipeline-dx11"&gt;&lt;a href="#traditional-pipeline-dx11" class="header-anchor"&gt;&lt;/a&gt;Traditional pipeline (DX11)
&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Hull Shader&lt;/strong&gt;: generates the patches (control points) used for tessellation&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tessellator&lt;/strong&gt;: fixed-function hardware unit that subdivides edges a set number of times&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Domain Shader&lt;/strong&gt;: samples the height map at the tessellated vertices and displaces them&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Geometry Shader&lt;/strong&gt;: Post Processing; passes vertex data to the next stage&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="modern-approach-mesh-shader-dx12"&gt;&lt;a href="#modern-approach-mesh-shader-dx12" class="header-anchor"&gt;&lt;/a&gt;Modern approach: Mesh Shader (DX12+)
&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Revolutionary change&lt;/strong&gt;: Hull, Domain, and Geometry shaders are merged, generating Meshlets (small geometry pieces) in one pass&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Advantages&lt;/strong&gt;:
&lt;ul&gt;
&lt;li&gt;Programmers have full control over the subdivision algorithm&lt;/li&gt;
&lt;li&gt;More flexible geometry generation&lt;/li&gt;
&lt;li&gt;Provides a foundation for Deformable Terrain&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="dynamicdeformable-terrain"&gt;&lt;a href="#dynamicdeformable-terrain" class="header-anchor"&gt;&lt;/a&gt;Dynamic/Deformable Terrain
&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;Use cases&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A tractor leaving ruts in a rice field&lt;/li&gt;
&lt;li&gt;The deformable snow in &lt;em&gt;God of War&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;Craters left by artillery explosions&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Implementation logic&lt;/strong&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Generate geometry in real time with GPU Tessellation&lt;/li&gt;
&lt;li&gt;Maintain a Deformation Texture at runtime&lt;/li&gt;
&lt;li&gt;Add the deformation offset in the Vertex Shader&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Physics synchronization&lt;/strong&gt;: the Collision Mesh must be updated in sync, otherwise you get the &amp;ldquo;walking on the void&amp;rdquo; bug&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="complex-terrain-features-beyond-the-height-field"&gt;&lt;a href="#complex-terrain-features-beyond-the-height-field" class="header-anchor"&gt;&lt;/a&gt;Complex Terrain Features: Beyond the Height Field
&lt;/h2&gt;&lt;h3 id="limitations-of-the-height-field"&gt;&lt;a href="#limitations-of-the-height-field" class="header-anchor"&gt;&lt;/a&gt;Limitations of the Height Field
&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;Cannot express vertical Overhangs&lt;/li&gt;
&lt;li&gt;Cannot express Caves or tunnels&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="traditional-hack-solutions"&gt;&lt;a href="#traditional-hack-solutions" class="header-anchor"&gt;&lt;/a&gt;Traditional hack solutions
&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Hole-punching markers&lt;/strong&gt;: in the Vertex Shader, output NaN (invalid number) for vertices in the region to be punched out, and the GPU automatically culls the affected triangles&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Placing objects at seams&lt;/strong&gt;: manually place rock models at cliff edges to hide the seams&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="volumetric-terrain--marching-cubes"&gt;&lt;a href="#volumetric-terrain--marching-cubes" class="header-anchor"&gt;&lt;/a&gt;Volumetric Terrain + Marching Cubes
&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;Concept&lt;/strong&gt;: store a density value (Weight) in 3D voxels instead of a single height.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Marching Cubes algorithm&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Based on the density values at the 8 voxel corners, look up one of 15 (or more) predefined triangulation cases&lt;/li&gt;
&lt;li&gt;Produces a watertight triangle mesh&lt;/li&gt;
&lt;li&gt;Applications: CT scan visualization, digital humans, fluid simulation&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Current state and outlook&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Currently used mainly in voxel games such as &lt;em&gt;Minecraft&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;Challenges: LOD transitions, complex data management&lt;/li&gt;
&lt;li&gt;Potential: truly fully dynamic terrain (dig holes or excavate anywhere)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="terrain-material-system"&gt;&lt;a href="#terrain-material-system" class="header-anchor"&gt;&lt;/a&gt;Terrain Material System
&lt;/h2&gt;&lt;h3 id="texture-splatting"&gt;&lt;a href="#texture-splatting" class="header-anchor"&gt;&lt;/a&gt;Texture Splatting
&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;Basic approach&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Splat Map&lt;/strong&gt;: each channel represents the weight of one material&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Material properties&lt;/strong&gt;: Base Color, Normal, Roughness, Metallic, Height&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Height-Based Blending&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Problem: alpha blending makes sand &amp;ldquo;float&amp;rdquo; on the rock surface, which looks unreal&lt;/li&gt;
&lt;li&gt;Solution: compare heights using the Height Map — the higher one is kept, the lower one fades out&lt;/li&gt;
&lt;li&gt;Effect: sand fills the cracks in the rock and grass grows out of them, rather than covering the rock&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Reducing jitter&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Add a &lt;strong&gt;Bias (offset, e.g. 0.2)&lt;/strong&gt; and &lt;strong&gt;Smoothstep&lt;/strong&gt; to avoid sharp boundaries when materials switch and flickering (aliasing) at a distance&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="multi-material-management-texture-array"&gt;&lt;a href="#multi-material-management-texture-array" class="header-anchor"&gt;&lt;/a&gt;Multi-Material Management: Texture Array
&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Concept&lt;/strong&gt;: stack multiple unrelated 2D textures and access them by Index (rather than the trilinear interpolation of a 3D Texture)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Advantage&lt;/strong&gt;: supports blending dozens of materials with no interpolation cost between layers&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Data organization&lt;/strong&gt;: the Splat Map stores both the material Index and the blend weights&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="enhancing-surface-detail"&gt;&lt;a href="#enhancing-surface-detail" class="header-anchor"&gt;&lt;/a&gt;Enhancing Surface Detail
&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Parallax Mapping&lt;/strong&gt;:
&lt;ul&gt;
&lt;li&gt;Simulates parallax via raymarching&lt;/li&gt;
&lt;li&gt;Produces a three-dimensional bump effect, though the geometric silhouette stays flat&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Displacement Mapping&lt;/strong&gt;:
&lt;ul&gt;
&lt;li&gt;Actually displaces vertices together with Tessellation&lt;/li&gt;
&lt;li&gt;Higher cost, and the trend of the future&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="virtual-texture"&gt;&lt;a href="#virtual-texture" class="header-anchor"&gt;&lt;/a&gt;Virtual Texture
&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Core idea&lt;/strong&gt;: load only the textures in the region visible inside the view frustum, similar to virtual memory management in an operating system.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Workflow&lt;/strong&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Divide the large terrain into multi-level Tiles, forming a mipmap pyramid&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Physics Texture (physical texture / cache)&lt;/strong&gt;: stores only the currently visible Tiles&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Feedback/Indirection&lt;/strong&gt;: map UVs to positions in the physical texture via a lookup table (Page Table)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Asynchronous loading&lt;/strong&gt;: an &amp;ldquo;apprentice&amp;rdquo; (thread/IO system) loads Tiles on demand from disk/memory and unloads invisible ones&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Advantages&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Memory&lt;/strong&gt;: VRAM usage has a theoretical upper bound (a converging geometric series)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Performance&lt;/strong&gt;: material blending is precomputed (baked) at load time, so at runtime you sample a single texture directly, greatly reducing overdraw and texture sampling cost&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Hardware acceleration&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;DirectStorage&lt;/strong&gt;: disk → VRAM, transferred while still compressed and decompressed on the GPU&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DMA (Direct Memory Access)&lt;/strong&gt;: a PS5 technology; data goes straight from the SSD to VRAM, bypassing the CPU and memory bus&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="floating-point-precision"&gt;&lt;a href="#floating-point-precision" class="header-anchor"&gt;&lt;/a&gt;Floating Point Precision
&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;: when 32-bit floats represent a large-scale world (such as Earth to the Moon, or a large open world), the fractional part lacks precision (precision decreases as the value grows), causing distant objects to jitter.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Symptom&lt;/strong&gt;: at 2-3 km out, where values reach tens of thousands, the fractional precision may exceed 1 cm, causing decals to z-fight with walls and objects to flicker.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution: Camera Relative Rendering&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Set the camera position as the origin (0,0,0)&lt;/li&gt;
&lt;li&gt;Subtract the camera position from all world coordinates to get relative coordinates&lt;/li&gt;
&lt;li&gt;This preserves the high-precision fractional part and eliminates jitter&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Other approaches&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Using Double (64-bit floats): too high a cost in data volume and bandwidth&lt;/li&gt;
&lt;li&gt;Sublevel relative coordinates: used by large engines such as UE5, where the coordinate system is reset for each Level&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="environment-element-systems"&gt;&lt;a href="#environment-element-systems" class="header-anchor"&gt;&lt;/a&gt;Environment Element Systems
&lt;/h2&gt;&lt;h3 id="foliage-rendering"&gt;&lt;a href="#foliage-rendering" class="header-anchor"&gt;&lt;/a&gt;Foliage Rendering
&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;SpeedTree&lt;/strong&gt;: the industry-standard vegetation middleware&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LOD strategy&lt;/strong&gt;:
&lt;ul&gt;
&lt;li&gt;Near: real meshes&lt;/li&gt;
&lt;li&gt;Mid distance: combinations of cards&lt;/li&gt;
&lt;li&gt;Far: billboards&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="decorator"&gt;&lt;a href="#decorator" class="header-anchor"&gt;&lt;/a&gt;Decorator
&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Definition&lt;/strong&gt;: environment details such as small grass, pebbles, and small shrubs&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Techniques&lt;/strong&gt;: simple meshes, clustered billboard rendering&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="road-system"&gt;&lt;a href="#road-system" class="header-anchor"&gt;&lt;/a&gt;Road System
&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Spline&lt;/strong&gt;: artists generate roads by dragging control points&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Erosion (carving)&lt;/strong&gt;: after a road is generated, the Height Field must be carved and flattened so that mountainous terrain is suitable for the road&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="decal"&gt;&lt;a href="#decal" class="header-anchor"&gt;&lt;/a&gt;Decal
&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Definition&lt;/strong&gt;: a detail texture projected onto a surface (e.g., bullet holes, stains, road markings)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Application&lt;/strong&gt;: combined with Virtual Texture and baked into the terrain texture&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="procedural-generation"&gt;&lt;a href="#procedural-generation" class="header-anchor"&gt;&lt;/a&gt;Procedural Generation
&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Trend&lt;/strong&gt;: moving from manual editing to rule-based procedural generation.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Capabilities&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Automatically generate vegetation based on slope, altitude, and material type (broadleaf forest → coniferous forest transition)&lt;/li&gt;
&lt;li&gt;Simulate water erosion to produce ridges and gullies&lt;/li&gt;
&lt;li&gt;Automatically generate road networks&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Requirement&lt;/strong&gt;: engine developers need some naturalist knowledge to understand geological and ecological laws.&lt;/p&gt;
&lt;h2 id="conclusion-the-technical-path-to-becoming-a-god-of-the-earth"&gt;&lt;a href="#conclusion-the-technical-path-to-becoming-a-god-of-the-earth" class="header-anchor"&gt;&lt;/a&gt;Conclusion: The Technical Path to Becoming a &amp;ldquo;God of the Earth&amp;rdquo;
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Basics&lt;/strong&gt;: master the Height Field and LOD principles&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Geometry&lt;/strong&gt;: implement Quadtree + GPU Tessellation and handle T Junctions&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Materials&lt;/strong&gt;: Texture Splatting + Virtual Texture&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Dynamics&lt;/strong&gt;: GPU Driven Deformable Terrain&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Precision&lt;/strong&gt;: Camera Relative Rendering to solve large-space problems&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Ecosystem&lt;/strong&gt;: integrate the SpeedTree, Decorator, Road, and Decal systems&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Future&lt;/strong&gt;: explore Volumetric Terrain and Marching Cubes&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="references"&gt;&lt;a href="#references" class="header-anchor"&gt;&lt;/a&gt;References
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;a class="link" href="https://www.bilibili.com/video/BV1au411y7Fq" target="_blank" rel="noopener"&gt;Rendering of Terrain, Atmosphere, and Clouds in Games (Part 1) | GAMES104 - Modern Game Engine: From Introduction to Practice&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>GAMES104 Modern Game Engine - The Mathematical Magic of Light and Materials in Rendering</title><link>https://boiltask.com/en/note/games104-game-engine-5/</link><pubDate>Wed, 28 Jan 2026 13:19:37 +0800</pubDate><guid>https://boiltask.com/en/note/games104-game-engine-5/</guid><description>&lt;blockquote&gt;
&lt;p&gt;There are quite a few things I didn&amp;rsquo;t fully understand; I&amp;rsquo;ll need to go through them again later.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="introduction-the-essential-challenge-of-rendering"&gt;&lt;a href="#introduction-the-essential-challenge-of-rendering" class="header-anchor"&gt;&lt;/a&gt;Introduction: The Essential Challenge of Rendering
&lt;/h2&gt;&lt;p&gt;This lecture explores the core of modern game engine rendering — &lt;strong&gt;the mathematical relationship between light, materials, and shaders (Shader)&lt;/strong&gt;. It is one of the most complex and intricate systems in a game engine.&lt;/p&gt;
&lt;p&gt;The essence of rendering is simulating the propagation of photons: photons are emitted from light sources, and after reflection, absorption, and refraction they enter the human eye. To solve this process in real time under limited hardware compute, graphics researchers and engineers around the world have spent the past decades proposing countless ingenious &amp;ldquo;hacks&amp;rdquo; (engineering compromises), collectively building today&amp;rsquo;s real-time rendering technology stack.&lt;/p&gt;
&lt;h3 id="the-rendering-equation"&gt;&lt;a href="#the-rendering-equation" class="header-anchor"&gt;&lt;/a&gt;The Rendering Equation
&lt;/h3&gt;&lt;p&gt;35 years ago, &lt;strong&gt;Kajiya&lt;/strong&gt; proposed the famous Rendering Equation, now regarded as the most fundamental theoretical framework in graphics:&lt;/p&gt;
&lt;blockquote&gt;
$$
L_o(x, \vec w) = L_e(x, \vec w) + \int_\Omega f_r(x, \vec w', \vec w) L_i(x, \vec w') (\vec w' \cdot \vec n) d\vec w'
$$&lt;p&gt;
Where:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;$L_o(x, \vec w)$ is the outgoing light at position $ x $ and direction $\vec w$.&lt;/li&gt;
&lt;li&gt;$L_e(x, \vec w)$ is the light emitted at the same position and direction.&lt;/li&gt;
&lt;li&gt;$\int_\Omega &amp;hellip; d\vec w&amp;rsquo;$ is the infinitesimal sum over the hemisphere of incident directions.&lt;/li&gt;
&lt;li&gt;$f_r(x, \vec w&amp;rsquo;, \vec w)$ is the fraction of light reflected at that point from the incident direction to the outgoing direction.&lt;/li&gt;
&lt;li&gt;$L_i(x, \vec w&amp;rsquo;)$ is the incident light at that point, at position and direction $ \vec w&amp;rsquo; $.&lt;/li&gt;
&lt;li&gt;$(\vec w&amp;rsquo; \cdot \vec n)$ is the attenuation of incident light caused by the incident angle.&lt;/li&gt;
&lt;/ul&gt;
&lt;p style='text-align:right'&gt;—— &lt;a href="https://zh.wikipedia.org/w/index.php?title=%E6%B8%B2%E6%9F%93%E6%96%B9%E7%A8%8B" target="_blank"&gt;Rendering Equation - Wikipedia&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;Core contradiction&lt;/strong&gt;: this equation describes perfect physical truth, yet it is &lt;strong&gt;extremely difficult to solve in real time&lt;/strong&gt;. The work of game engine engineers over the past 30 years is essentially the search for various &lt;strong&gt;engineering approximate solutions&lt;/strong&gt; to this equation.&lt;/p&gt;
&lt;h2 id="the-three-major-challenges-of-real-time-rendering"&gt;&lt;a href="#the-three-major-challenges-of-real-time-rendering" class="header-anchor"&gt;&lt;/a&gt;The Three Major Challenges of Real-Time Rendering
&lt;/h2&gt;&lt;p&gt;Real-time rendering faces three core challenges:&lt;/p&gt;
&lt;h3 id="visibility-to-light"&gt;&lt;a href="#visibility-to-light" class="header-anchor"&gt;&lt;/a&gt;Visibility To Light
&lt;/h3&gt;&lt;p&gt;That is, the shadow problem. Determining whether a point in the scene can be directly lit by a light source seems simple, but it is in fact one of the thorniest problems in graphics.&lt;/p&gt;
&lt;h3 id="complexity-of-light"&gt;&lt;a href="#complexity-of-light" class="header-anchor"&gt;&lt;/a&gt;Complexity of Light
&lt;/h3&gt;&lt;p&gt;Real-world lighting comes from the spherical space (Sphere) in every direction, not from simple directional or point lights. How to handle area lights (Area Light), ambient light (Ambient Light), and the different frequency (high/low frequency) information of light is a huge challenge.&lt;/p&gt;
&lt;p&gt;Even if we know the incoming lighting from every direction (a spherical function), computing its integral (convolution) with the material BRDF is still enormously expensive. In real time, we cannot densely sample and integrate over the sphere.&lt;/p&gt;
&lt;h3 id="global-illumination"&gt;&lt;a href="#global-illumination" class="header-anchor"&gt;&lt;/a&gt;Global Illumination
&lt;/h3&gt;&lt;p&gt;In the real world, a surface that is lit becomes a new light source itself (Color Bleeding), and light bounces around the scene infinitely many times (Bouncing).&lt;/p&gt;
&lt;p&gt;This leads to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Infinitely many light sources in the scene&lt;/li&gt;
&lt;li&gt;Challenge three (indirect light) aggravates challenge one (visibility) and challenge two (complexity of light)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="the-basic-render-pipeline-early-engineering-compromises"&gt;&lt;a href="#the-basic-render-pipeline-early-engineering-compromises" class="header-anchor"&gt;&lt;/a&gt;The Basic Render Pipeline: Early Engineering Compromises
&lt;/h2&gt;&lt;p&gt;Faced with such complex mathematical theory, early graphics engineers resorted to extremely pragmatic &amp;ldquo;brute-force&amp;rdquo; tricks — and these simple hacks ended up laying the foundation of real-time rendering.&lt;/p&gt;
&lt;h3 id="simplified-lighting-models"&gt;&lt;a href="#simplified-lighting-models" class="header-anchor"&gt;&lt;/a&gt;Simplified Lighting Models
&lt;/h3&gt;&lt;p&gt;Complex spherical lighting is decomposed into three categories:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Dominant Light&lt;/strong&gt;: directional lights / point lights / spotlights&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Ambient Light&lt;/strong&gt;: a constant standing in for indirect light from all directions&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Environment Map&lt;/strong&gt;: a Cubemap (6 textures) capturing high-frequency reflection information of the surrounding environment&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="blinn-phong-material-model"&gt;&lt;a href="#blinn-phong-material-model" class="header-anchor"&gt;&lt;/a&gt;Blinn-Phong Material Model
&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;A victory for the empiricists&lt;/strong&gt;. It does not pursue strict physical correctness, but is based on observation:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Diffuse&lt;/strong&gt;: light scatters uniformly, computed with $\cos\theta$&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Specular&lt;/strong&gt;: a power function controls the width of the reflection lobe (Lobe)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Flaw&lt;/strong&gt;: energy non-conservative; in ray-traced scenes light energy explodes (brightness grows without bound).&lt;/p&gt;
&lt;h3 id="shadow-map-technology"&gt;&lt;a href="#shadow-map-technology" class="header-anchor"&gt;&lt;/a&gt;Shadow Map Technology
&lt;/h3&gt;&lt;p&gt;The classic solution to the visibility problem, with the core idea of &lt;strong&gt;trading space for time&lt;/strong&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Render a depth map (Depth Map) from the light&amp;rsquo;s point of view&lt;/li&gt;
&lt;li&gt;When rendering from the camera&amp;rsquo;s point of view, project each pixel back into light space and compare depths&lt;/li&gt;
&lt;li&gt;If the depth is greater than the value stored in the Shadow Map, the point is in shadow&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Key problems&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Self-occlusion&lt;/strong&gt;: aliasing caused by insufficient precision, solved by adding a bias, but this produces &amp;ldquo;floating shadows&amp;rdquo; (Peter Panning)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sampling rate mismatch&lt;/strong&gt;: the difference in sampling rate between the light&amp;rsquo;s view and the camera&amp;rsquo;s view causes various artifacts&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="global-illumination-gi-and-precomputation-techniques"&gt;&lt;a href="#global-illumination-gi-and-precomputation-techniques" class="header-anchor"&gt;&lt;/a&gt;Global Illumination (GI) and Precomputation Techniques
&lt;/h2&gt;&lt;p&gt;AAA games pursue realism and must solve indirect lighting. The core idea is &lt;strong&gt;precomputation&lt;/strong&gt;: store the results of offline computation and query them directly at runtime.&lt;/p&gt;
&lt;h3 id="spherical-harmonics-sh"&gt;&lt;a href="#spherical-harmonics-sh" class="header-anchor"&gt;&lt;/a&gt;Spherical Harmonics (SH)
&lt;/h3&gt;&lt;p&gt;The lighting function defined on the sphere (a spherical signal) is compressed using the idea of &lt;strong&gt;Fourier series&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Represent the spherical function with a set of orthogonal basis functions (similar to $\sin/\cos$ functions)&lt;/li&gt;
&lt;li&gt;Storing only the first $n$ orders of coefficients (e.g. 4 parameters for order 1, 9 parameters for order 2) is enough to reconstruct the approximate lighting direction&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Advantages&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Extremely high compression ratio&lt;/strong&gt;: 12 parameters (RGB×4) can express the ambient lighting at a point&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Simplified convolution&lt;/strong&gt;: the convolution (integral) of two functions on the sphere reduces to a dot product of SH coefficients&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Supports Diffuse and Specular&lt;/strong&gt;: choose different orders according to precision requirements&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="lightmap"&gt;&lt;a href="#lightmap" class="header-anchor"&gt;&lt;/a&gt;Lightmap
&lt;/h3&gt;&lt;p&gt;Bake the global illumination of static objects into 2D textures (Atlas):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Parameterization&lt;/strong&gt;: unwrap 3D geometry into 2D UV space&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Baking&lt;/strong&gt;: perform offline ray-tracing computation on a Light Farm (render farm)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;At runtime&lt;/strong&gt;: sample the Lightmap directly for indirect light and add it to real-time lighting&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Drawbacks&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Only supports static objects and static light sources&lt;/li&gt;
&lt;li&gt;Baking takes a very long time (half an hour to an hour)&lt;/li&gt;
&lt;li&gt;Consumes a lot of memory (tens to hundreds of MB)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="light-probe"&gt;&lt;a href="#light-probe" class="header-anchor"&gt;&lt;/a&gt;Light Probe
&lt;/h3&gt;&lt;p&gt;Scatter sample points through space, each storing lighting information encoded as SH:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Automatic generation&lt;/strong&gt;: modern engines automatically generate Probe distributions (along player paths, expanding over geometric surfaces)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Lighting for dynamic objects&lt;/strong&gt;: dynamic objects are shaded by interpolating the lighting of surrounding Probes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Reflection Probe&lt;/strong&gt;: dedicated to high-frequency reflections, storing high-resolution Cubemaps&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Trade-offs vs. Lightmap&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Lightmap: high precision, rich detail (soft shadows, Color Bleeding), but static only&lt;/li&gt;
&lt;li&gt;Light Probe: supports dynamic objects and runtime updates, but low precision and cannot express fine contact shadows&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id="physically-based-rendering-pbr"&gt;&lt;a href="#physically-based-rendering-pbr" class="header-anchor"&gt;&lt;/a&gt;Physically Based Rendering (PBR)
&lt;/h2&gt;&lt;h3 id="microfacet-theory"&gt;&lt;a href="#microfacet-theory" class="header-anchor"&gt;&lt;/a&gt;Microfacet Theory
&lt;/h3&gt;&lt;p&gt;A rough surface is modeled as consisting of countless tiny mirrors (Microfacets):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Roughness&lt;/strong&gt;: controls how dispersed the distribution of microfacet normals is&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Metallic&lt;/strong&gt;: distinguishes metals (reflect colored light) from non-metals (dominated by diffuse reflection)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="the-cook-torrance-reflection-model"&gt;&lt;a href="#the-cook-torrance-reflection-model" class="header-anchor"&gt;&lt;/a&gt;The Cook-Torrance Reflection Model
&lt;/h3&gt;&lt;p&gt;The standard model for modern PBRSpecular; the BRDF is a product of three terms:&lt;/p&gt;
$$
f_r = \frac{D \cdot F \cdot G}{4(\omega_o \cdot n)(\omega_i \cdot n)}
$$&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;D (Normal Distribution Function, NDF)&lt;/strong&gt;: the distribution of microfacet normals, most commonly the &lt;strong&gt;GGX&lt;/strong&gt; (Trowbridge-Reitz) distribution&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Characteristics: sharp peak (good high-frequency behavior), long trailing tail (good low-frequency behavior) — like a good speaker with &amp;ldquo;crisp highs and deep lows&amp;rdquo;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;F (Fresnel Term)&lt;/strong&gt;: describes the increase in reflectance as the angle between the view direction and the surface approaches grazing angle (Grazing Angle)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Classic approximation: &lt;strong&gt;Schlick approximation&lt;/strong&gt; $F = F_0 + (1-F_0)(1-\cos\theta)^5$&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;G (Geometry Term)&lt;/strong&gt;: the geometric occlusion term, computing self-shadowing between microfacets (Shadowing-Masking)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Smith model: computes occlusion for the incoming and outgoing directions separately based on the same Roughness distribution&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="disney-principled-brdf"&gt;&lt;a href="#disney-principled-brdf" class="header-anchor"&gt;&lt;/a&gt;Disney Principled BRDF
&lt;/h3&gt;&lt;p&gt;The PBR design principles proposed by Disney, which deeply influenced the design philosophy of game engines:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Intuitive&lt;/strong&gt;: parameters must match artists&amp;rsquo; intuition (e.g. &amp;ldquo;metallic&amp;rdquo;, &amp;ldquo;roughness&amp;rdquo; rather than physical index of refraction)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Minimal parameters&lt;/strong&gt;: the fewer the better, usually kept to 2-3&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Normalized range&lt;/strong&gt;: parameters should preferably lie in $[0,1]$&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Robustness&lt;/strong&gt;: any combination of parameters should not produce invalid or bizarre results&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Creative flexibility&lt;/strong&gt;: a small number of out-of-range values are allowed for special artistic effects&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="mainstream-pbr-workflows"&gt;&lt;a href="#mainstream-pbr-workflows" class="header-anchor"&gt;&lt;/a&gt;Mainstream PBR Workflows
&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Specular-Glossiness (SG)&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Parameters: Diffuse Map + Specular Map (RGB controls Fresnel color) + Glossiness Map&lt;/li&gt;
&lt;li&gt;Pros: flexible, good for expressing colored metals (e.g. gold, copper)&lt;/li&gt;
&lt;li&gt;Cons: easy to misconfigure, leading to energy non-conservation&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Metallic-Roughness (MR)&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Parameters: Base Color + Metallic Map + Roughness Map&lt;/li&gt;
&lt;li&gt;Mechanism: Metallic acts as a mask, interpolating between metal (using Base Color as Specular) and non-metal (Specular is gray)&lt;/li&gt;
&lt;li&gt;Pros: hard to get wrong, intuitive, the industry mainstream&lt;/li&gt;
&lt;li&gt;Cons: a white line artifact may appear at the transition between metal and non-metal&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;hr&gt;
&lt;h2 id="image-based-lighting-ibl"&gt;&lt;a href="#image-based-lighting-ibl" class="header-anchor"&gt;&lt;/a&gt;Image-Based Lighting (IBL)
&lt;/h2&gt;&lt;p&gt;A technique that combines environment lighting (Environment Map) with PBR materials, solving the integral problems of &lt;strong&gt;specular reflection&lt;/strong&gt; and &lt;strong&gt;diffuse reflection&lt;/strong&gt; from the environment.&lt;/p&gt;
&lt;h3 id="diffuse-irradiance-map"&gt;&lt;a href="#diffuse-irradiance-map" class="header-anchor"&gt;&lt;/a&gt;Diffuse Irradiance Map
&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Precomputation&lt;/strong&gt;: convolve the environment map with the Lambertian BRDF (a constant) to produce a low-frequency diffuse lookup map&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;At runtime&lt;/strong&gt;: sample directly along the normal direction, no real-time integration needed&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="specular-prefiltered-mipmap"&gt;&lt;a href="#specular-prefiltered-mipmap" class="header-anchor"&gt;&lt;/a&gt;Specular Prefiltered Mipmap
&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Roughness layering&lt;/strong&gt;: store prefiltered environment maps for different roughness values (0 to 1) in different mipmap levels of the Cubemap
&lt;ul&gt;
&lt;li&gt;Low roughness (smooth): high-frequency information, stored in high-precision mipmaps (low levels)&lt;/li&gt;
&lt;li&gt;High roughness (rough): low-frequency information, stored in low-precision mipmaps (high levels)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;BRDF LUT&lt;/strong&gt;: use a 2D lookup texture to precompute the integral of the Fresnel and geometry terms, parameterized by &lt;strong&gt;Roughness&lt;/strong&gt; and &lt;strong&gt;Cosine Theta&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Essence&lt;/strong&gt;: turning the integral computation of the rendering equation entirely into &lt;strong&gt;texture lookups&lt;/strong&gt;, enabling efficient dynamic environment lighting.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="advanced-shadow-techniques"&gt;&lt;a href="#advanced-shadow-techniques" class="header-anchor"&gt;&lt;/a&gt;Advanced Shadow Techniques
&lt;/h2&gt;&lt;h3 id="cascade-shadow-maps-csm"&gt;&lt;a href="#cascade-shadow-maps-csm" class="header-anchor"&gt;&lt;/a&gt;Cascade Shadow Maps (CSM)
&lt;/h3&gt;&lt;p&gt;Solves the problem of insufficient shadow resolution in large scenes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Cascades&lt;/strong&gt;: divide the view frustum into several cascades by distance from the camera (e.g. 0-10m, 10-30m, 30-100m)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Multiple Shadow Maps&lt;/strong&gt;: generate a Shadow Map of different resolution for each cascade — high precision near, low precision far&lt;/li&gt;
&lt;li&gt;** blend between cascades**: smooth interpolation at cascade boundaries avoids hard edges&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Cost&lt;/strong&gt;: requires rendering the scene multiple times (usually 4), making it one of the most expensive modules in the render pipeline (typically 4-5 ms).&lt;/p&gt;
&lt;h3 id="soft-shadows"&gt;&lt;a href="#soft-shadows" class="header-anchor"&gt;&lt;/a&gt;Soft Shadows
&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;PCF (Percentage Closer Filtering)&lt;/strong&gt;: sample neighboring depths on the Shadow Map and blur with multiple samples to simulate the penumbra&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;PCSS (Percentage Closer Soft Shadows)&lt;/strong&gt;: dynamically adjust the sampling kernel size based on the distance from the object to the light (occluder distance), producing distance-dependent soft/hard shadows&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;VSSM (Variance Soft Shadow Map)&lt;/strong&gt;: uses Chebyshev&amp;rsquo;s inequality and a two-channel Shadow Map (storing depth and depth squared) to estimate the probability of visibility from variance, giving fast approximate soft shadows&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="virtual-shadow-map"&gt;&lt;a href="#virtual-shadow-map" class="header-anchor"&gt;&lt;/a&gt;Virtual Shadow Map
&lt;/h3&gt;&lt;p&gt;A new technique introduced by Unreal Engine 5, solving the low spatial utilization of CSM:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Virtual paging&lt;/strong&gt;: virtualize a huge shadow texture space, allocating and generating Shadow Map tiles only for the actually visible regions&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Dynamic allocation&lt;/strong&gt;: dynamically decide which regions need high-resolution shadows based on the camera view, achieving consistent high-precision shadows across the whole scene&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id="modern-rendering-trends"&gt;&lt;a href="#modern-rendering-trends" class="header-anchor"&gt;&lt;/a&gt;Modern Rendering Trends
&lt;/h2&gt;&lt;h3 id="real-time-ray-tracing"&gt;&lt;a href="#real-time-ray-tracing" class="header-anchor"&gt;&lt;/a&gt;Real-Time Ray Tracing
&lt;/h3&gt;&lt;p&gt;Hardware acceleration (RTX/DRX) makes real-time ray tracing possible:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Current usage&lt;/strong&gt;: mainly used for &lt;strong&gt;reflection&lt;/strong&gt; and &lt;strong&gt;shadows&lt;/strong&gt;, rather than full GI&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Future direction&lt;/strong&gt;: combined with denoising to achieve real-time global illumination (e.g. UE5&amp;rsquo;s Lumen, which combines SDF, Voxel, Screen Space GI and other techniques)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="uber-shader-and-shader-variants"&gt;&lt;a href="#uber-shader-and-shader-variants" class="header-anchor"&gt;&lt;/a&gt;Uber Shader and Shader Variants
&lt;/h3&gt;&lt;p&gt;Modern engines face the problem of shader explosion:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Uber Shader&lt;/strong&gt;: write one giant shader containing all features, with branches controlled by macros (Macro)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Shader Permutation (variants)&lt;/strong&gt;: at compile time, generate all possible shader combinations based on material properties, light types, platform, etc. (e.g. 165 templates can produce 70,000+ concrete shaders)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cross-platform compilation&lt;/strong&gt;: use intermediate formats such as SPIR-V and translate uniformly to each platform&amp;rsquo;s shader language — HLSL, GLSL, Metal, PSL, etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="conclusion"&gt;&lt;a href="#conclusion" class="header-anchor"&gt;&lt;/a&gt;Conclusion
&lt;/h2&gt;&lt;p&gt;The history of real-time rendering technology is a history of engineering innovation that &lt;strong&gt;seeks a balance between physical truth and real-time performance&lt;/strong&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;The foundational era&lt;/strong&gt;: through the combination of Blinn-Phong + Shadow Map + Environment Map, minimal hacks achieved acceptable real-time rendering&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The GI era&lt;/strong&gt;: through precomputation techniques such as Lightmap, Spherical Harmonics, and Light Probe, trading space for time to achieve static global illumination&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The PBR era&lt;/strong&gt;: based on Microfacet theory and the Cook-Torrance model, a unified material standard (Metallic-Roughness) was established, achieving physically correct lighting response&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The IBL era&lt;/strong&gt;: through prefiltered environment maps, complex integral computations became texture lookups, enabling efficient environment lighting&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Modern/future&lt;/strong&gt;: hardware ray tracing and real-time GI techniques (Lumen, etc.) are breaking the constraints of precomputation, moving toward a fully dynamic, fully realistic goal&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Key takeaway&lt;/strong&gt;: game engine development is not about chasing mathematical perfection, but about creating &lt;strong&gt;believable and beautiful&lt;/strong&gt; visuals under &lt;strong&gt;limited compute&lt;/strong&gt; through reasonable &lt;strong&gt;assumptions, simplifications, and precomputation&lt;/strong&gt;.&lt;/p&gt;
&lt;h2 id="references"&gt;&lt;a href="#references" class="header-anchor"&gt;&lt;/a&gt;References
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;a class="link" href="https://www.bilibili.com/video/BV1J3411n7WT/" target="_blank" rel="noopener"&gt;The Mathematical Magic of Light and Materials in Rendering | GAMES104 - Modern Game Engine: From Beginner to Practice&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>CommonUI Plugin in Unreal Engine</title><link>https://boiltask.com/en/knowledge/ue/plugin-common-ui/</link><pubDate>Sun, 07 Sep 2025 08:01:00 +0800</pubDate><guid>https://boiltask.com/en/knowledge/ue/plugin-common-ui/</guid><description>&lt;h2 id="introduction"&gt;&lt;a href="#introduction" class="header-anchor"&gt;&lt;/a&gt;Introduction
&lt;/h2&gt;&lt;p&gt;The CommonUI plugin is a plugin provided by UE5 for convenient, feature-rich, multi-layered, and cross-platform user interfaces.&lt;/p&gt;
&lt;h2 id="reference-documentation"&gt;&lt;a href="#reference-documentation" class="header-anchor"&gt;&lt;/a&gt;Reference Documentation
&lt;/h2&gt;&lt;p&gt;&lt;a class="link" href="https://dev.epicgames.com/documentation/zh-cn/unreal-engine/common-ui-plugin-for-advanced-user-interfaces-in-unreal-engine" target="_blank" rel="noopener"&gt;Common UI Plugin for Advanced User Interfaces in Unreal Engine | Unreal Engine 5.6 Documentation | Epic Developer Community&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Design of Lyra Settings Page</title><link>https://boiltask.com/en/knowledge/ue/lyra-setting-widget/</link><pubDate>Fri, 05 Sep 2025 12:59:55 +0800</pubDate><guid>https://boiltask.com/en/knowledge/ue/lyra-setting-widget/</guid><description>&lt;h2 id="introduction"&gt;&lt;a href="#introduction" class="header-anchor"&gt;&lt;/a&gt;Introduction
&lt;/h2&gt;&lt;p&gt;In Lyra, press &lt;code&gt;ESC&lt;/code&gt; and select &lt;code&gt;OPTIONS&lt;/code&gt; to open the settings page &lt;code&gt;W_LyraSettingScreen&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id="page-analysis"&gt;&lt;a href="#page-analysis" class="header-anchor"&gt;&lt;/a&gt;Page Analysis
&lt;/h2&gt;&lt;p&gt;&lt;code&gt;W_LyraSettingScreen&lt;/code&gt; inherits from the C++ class &lt;code&gt;ULyraSettingScreen&lt;/code&gt;, which is based on the &lt;code&gt;GameSettings&lt;/code&gt; plugin&amp;rsquo;s &lt;code&gt;UGameSettingScreen&lt;/code&gt;.&lt;/p&gt;
&lt;pre class="mermaid"&gt;
classDiagram
class W_LyraSettingScreen {
+TopSettingsTabs
+Settings_Panel
+W_BottomActionBar
}
UCommonUserWidget &amp;lt;|-- UCommonActivatableWidget
UCommonActivatableWidget &amp;lt;|-- UGameSettingScreen
UGameSettingScreen &amp;lt;|-- ULyraSettingScreen
ULyraSettingScreen &amp;lt;|-- W_LyraSettingScreen
&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;GameSettings&lt;/code&gt; plugin is based on the &lt;code&gt;CommonUI&lt;/code&gt; plugin. For details, see: &lt;a class="link" href="https://boiltask.com/en/knowledge/ue/plugin-common-ui/"&gt;CommonUI Plugin in Unreal Engine&lt;/a&gt;&lt;/p&gt;
&lt;h3 id="header-tabs"&gt;&lt;a href="#header-tabs" class="header-anchor"&gt;&lt;/a&gt;Header Tabs
&lt;/h3&gt;&lt;p&gt;The tab widget is built with a &lt;code&gt;ULyraTabListWidgetBase&lt;/code&gt;. By defining &lt;code&gt;BindWidget&lt;/code&gt; in C++, you can create a Blueprint widget that is accessible from C++.&lt;/p&gt;
&lt;div class="highlight-wrapper"&gt;
&lt;div class="highlight-header"&gt;
&lt;span class="highlight-language"&gt;cpp&lt;/span&gt;
&lt;/div&gt;
&lt;div class="highlight-body"&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;span class="lnt"&gt;2
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;UPROPERTY&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BlueprintReadOnly&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Category&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Input&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;meta&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BindWidget&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;OptionalWidget&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;AllowPrivateAccess&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;true&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;TObjectPtr&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;ULyraTabListWidgetBase&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;TopSettingsTabs&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;In Blueprint, this widget is set to a &lt;code&gt;W_HorizontalTabList&lt;/code&gt;, making it easy to adjust the specific style.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;See also: &lt;a class="link" href="https://dev.epicgames.com/documentation/zh-cn/unreal-engine/coding-in-unreal-engine-blueprint-vs-cplusplus?application_version=5.5#combining-blueprint-and-c" target="_blank" rel="noopener"&gt;Combining Blueprint and C++&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;During the page&amp;rsquo;s &lt;code&gt;Construct&lt;/code&gt;, &lt;code&gt;RegisterTopLevelTab&lt;/code&gt; is called to register each tab in sequence.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;GameplayCollection&lt;/li&gt;
&lt;li&gt;VideoCollection&lt;/li&gt;
&lt;li&gt;AudioCollection&lt;/li&gt;
&lt;li&gt;MouseAndKeyboardCollection&lt;/li&gt;
&lt;li&gt;GamepadCollection&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For each tab, the actual settings are read via &lt;code&gt;UGameSettingScreen::GetSettingCollection&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The specific settings items depend on &lt;code&gt;GameSetting&lt;/code&gt;&amp;rsquo;s &lt;code&gt;UGameSettingCollection&lt;/code&gt; class.&lt;/p&gt;
&lt;p&gt;After registration, you only need to listen for &lt;code&gt;TopSettingsTabs&lt;/code&gt;&amp;rsquo;s &lt;code&gt;OnTabSelected&lt;/code&gt; to switch to the selected &lt;code&gt;Collection&lt;/code&gt; when the player selects the corresponding tab.&lt;/p&gt;
&lt;h3 id="page-content"&gt;&lt;a href="#page-content" class="header-anchor"&gt;&lt;/a&gt;Page Content
&lt;/h3&gt;&lt;p&gt;This part is mainly orchestrated by the &lt;code&gt;GameSettings&lt;/code&gt; plugin. &lt;code&gt;UGameSettingScreen&lt;/code&gt; defines the variable &lt;code&gt;Settings_Panel&lt;/code&gt; to mark the settings content widget.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Settings_Panel&lt;/code&gt; is the Blueprint &lt;code&gt;W_SettingsPanel&lt;/code&gt;, which is based on the &lt;code&gt;GameSettings&lt;/code&gt; plugin&amp;rsquo;s &lt;code&gt;UGameSettingPanel&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The UI provides the settings item list &lt;code&gt;ListView_Settings&lt;/code&gt;, as well as the settings item details &lt;code&gt;Details_Settings&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id="footer-buttons"&gt;&lt;a href="#footer-buttons" class="header-anchor"&gt;&lt;/a&gt;Footer Buttons
&lt;/h3&gt;&lt;p&gt;TODO&lt;/p&gt;</description></item><item><title>Online Async Task Manager in Unreal Engine</title><link>https://boiltask.com/en/knowledge/ue/online-async-task-manage/</link><pubDate>Wed, 03 Sep 2025 13:22:36 +0800</pubDate><guid>https://boiltask.com/en/knowledge/ue/online-async-task-manage/</guid><description>&lt;h2 id="introduction"&gt;&lt;a href="#introduction" class="header-anchor"&gt;&lt;/a&gt;Introduction
&lt;/h2&gt;&lt;p&gt;&lt;code&gt;FOnlineAsyncTaskManager&lt;/code&gt; is the foundation for asynchronous operations in every online subsystem.&lt;/p&gt;
&lt;p&gt;The task manager runs on its own thread and manages both a serial queue and a parallel queue of FOnlineAsyncTasks.&lt;/p&gt;
&lt;p&gt;For the serial queue, execution proceeds as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Game thread &lt;code&gt;GameThread&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;Initialize &lt;code&gt;Initialize()&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Online thread &lt;code&gt;OnlineThread&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;Execute &lt;code&gt;Tick()&lt;/code&gt; until &lt;code&gt;IsDone()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Add the task to the out queue &lt;code&gt;OutQueue&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Game thread &lt;code&gt;GameThread&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;Finalize &lt;code&gt;Finalize()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Trigger callbacks &lt;code&gt;TriggerDelegates()&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For the parallel queue, the flow is similar to the above, except the tasks do not wait for previous tasks to complete.&lt;/p&gt;</description></item><item><title>Online Subsystem in Unreal Engine</title><link>https://boiltask.com/en/knowledge/ue/online-subsystem/</link><pubDate>Wed, 03 Sep 2025 12:45:19 +0800</pubDate><guid>https://boiltask.com/en/knowledge/ue/online-subsystem/</guid><description>&lt;h2 id="introduction"&gt;&lt;a href="#introduction" class="header-anchor"&gt;&lt;/a&gt;Introduction
&lt;/h2&gt;&lt;p&gt;The Online Subsystem and its interfaces provide a common way to access features from online services such as Steam, Xbox Live, and Facebook. When developing a game that ships on multiple platforms or supports multiple online services, the Online Subsystem ensures that the only change developers need to make is configuration adjustments for all supported services.&lt;/p&gt;
&lt;h2 id="reference-documentation"&gt;&lt;a href="#reference-documentation" class="header-anchor"&gt;&lt;/a&gt;Reference Documentation
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;a class="link" href="https://dev.epicgames.com/documentation/zh-cn/unreal-engine/online-subsystem-in-unreal-engine" target="_blank" rel="noopener"&gt;Online Subsystem in Unreal Engine | Unreal Engine 5.6 Documentation | Epic Developer Community&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Packaging and Cooking Mechanisms in Unreal Engine</title><link>https://boiltask.com/en/knowledge/ue/ue-why-to-cook/</link><pubDate>Wed, 13 Aug 2025 13:17:41 +0800</pubDate><guid>https://boiltask.com/en/knowledge/ue/ue-why-to-cook/</guid><description>&lt;h2 id="introduction"&gt;&lt;a href="#introduction" class="header-anchor"&gt;&lt;/a&gt;Introduction
&lt;/h2&gt;&lt;p&gt;When packaging in &lt;code&gt;UE&lt;/code&gt;, you will notice that one step takes a long time: &lt;code&gt;Cook&lt;/code&gt;. Let&amp;rsquo;s take a closer look at what this step actually does and why.&lt;/p&gt;</description></item><item><title>ShaderPipelineCache in Unreal Engine</title><link>https://boiltask.com/en/knowledge/ue/pso-cache/</link><pubDate>Fri, 01 Aug 2025 21:01:41 +0800</pubDate><guid>https://boiltask.com/en/knowledge/ue/pso-cache/</guid><description>&lt;p&gt;In Unreal Engine, PSO caches are managed via ShaderPipelineCache.&lt;/p&gt;</description></item><item><title>Recording My TODO List</title><link>https://boiltask.com/en/record/boiltask-todo/</link><pubDate>Thu, 05 Jun 2025 12:23:23 +0800</pubDate><guid>https://boiltask.com/en/record/boiltask-todo/</guid><description>&lt;blockquote&gt;
&lt;p&gt;This post records some TODOs, updated irregularly; expired items may be deleted at any time&lt;/p&gt;
&lt;p&gt;[2026-01-06] I feel using a blog for TODOs is still too heavy-handed; better to manage them in Notion and tidy them up periodically&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;input disabled="" type="checkbox"&gt; Portals in Lyra&lt;/li&gt;
&lt;li&gt;&lt;input disabled="" type="checkbox"&gt; Ticket system - Pangu&lt;/li&gt;
&lt;li&gt;&lt;input disabled="" type="checkbox"&gt; Table system
&lt;ul&gt;
&lt;li&gt;&lt;input disabled="" type="checkbox"&gt; Merge multiple files into one for reading&lt;/li&gt;
&lt;li&gt;&lt;input disabled="" type="checkbox"&gt; Dynamically add, delete, and replace rows&lt;/li&gt;
&lt;li&gt;&lt;input disabled="" type="checkbox"&gt; Support ref&lt;/li&gt;
&lt;li&gt;&lt;input disabled="" type="checkbox"&gt; Maybe I should build my own editor?&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Character Movement-Related Mechanisms in Unreal Engine</title><link>https://boiltask.com/en/knowledge/ue/character-movement/</link><pubDate>Wed, 02 Apr 2025 12:54:31 +0800</pubDate><guid>https://boiltask.com/en/knowledge/ue/character-movement/</guid><description>&lt;h2 id="introduction"&gt;&lt;a href="#introduction" class="header-anchor"&gt;&lt;/a&gt;Introduction
&lt;/h2&gt;&lt;p&gt;This article is mainly used to organize the mechanisms related to movement in Unreal Engine.&lt;/p&gt;
&lt;p&gt;The content may be excerpted from various articles, forums, documentation, etc., and is intended only as a record.&lt;/p&gt;
&lt;h2 id="basic-introduction"&gt;&lt;a href="#basic-introduction" class="header-anchor"&gt;&lt;/a&gt;Basic Introduction
&lt;/h2&gt;&lt;p&gt;Movement is a very important and fairly complex module. &lt;code&gt;UnrealEngine&lt;/code&gt; implements movement using the composition pattern; when describing the movement of an &lt;code&gt;Actor&lt;/code&gt;, it means that an &lt;code&gt;Actor&lt;/code&gt; with a movement component can move.&lt;/p&gt;
&lt;p&gt;The base class for movement components is &lt;code&gt;UMovementComponent&lt;/code&gt;, which provides basic movement functionality and has multiple subclasses with different functions. Some subclass movement components are dedicated to serving a special kind of &lt;code&gt;Actor&lt;/code&gt;, such as &lt;code&gt;ACharacter&lt;/code&gt;, which usually represents the player and whose corresponding movement component is &lt;code&gt;UCharacterMovementComponent&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Although an &lt;code&gt;Actor&lt;/code&gt; represents an entity in the &lt;code&gt;World&lt;/code&gt;, it has no concept of position itself. An &lt;code&gt;Actor&lt;/code&gt;&amp;rsquo;s position is given by its &lt;code&gt;USceneComponent&lt;/code&gt;s. Therefore, the essence of movement is that the &lt;code&gt;Actor&lt;/code&gt; changes the position of a certain &lt;code&gt;USceneComponent&lt;/code&gt;, usually the &lt;code&gt;Actor&lt;/code&gt;&amp;rsquo;s &lt;code&gt;RootComponent&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;UMovementComponent&lt;/code&gt; has a property &lt;code&gt;UpdatedComponent&lt;/code&gt;, which is used to set the &lt;code&gt;USceneComponent&lt;/code&gt; modified by the movement component. A parameter &lt;code&gt;bAutoRegisterUpdatedComponent&lt;/code&gt; is exposed to Blueprint; if set to &lt;code&gt;true&lt;/code&gt;, then during component initialization it reads the &lt;code&gt;Owner&lt;/code&gt;&amp;rsquo;s &lt;code&gt;RootComponent&lt;/code&gt; and calls &lt;code&gt;SetUpdatedComponent&lt;/code&gt; to set &lt;code&gt;UpdatedComponent&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id="movement-flow"&gt;&lt;a href="#movement-flow" class="header-anchor"&gt;&lt;/a&gt;Movement Flow
&lt;/h2&gt;&lt;p&gt;Character movement under network replication needs to consider at least the following aspects:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;No latency for player client operations
&lt;ul&gt;
&lt;li&gt;Movement input must be responded to directly and reported to the server&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Position is authoritative on the server
&lt;ul&gt;
&lt;li&gt;Prevent cheating&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Replicated movement should appear smooth
&lt;ul&gt;
&lt;li&gt;Position updates cannot be received every frame, so appropriate interpolation is required&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="self-implementation"&gt;&lt;a href="#self-implementation" class="header-anchor"&gt;&lt;/a&gt;Self Implementation
&lt;/h3&gt;&lt;p&gt;First, consider how one might implement it independently.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;After receiving input locally, perform the movement locally first, and at the same time send the movement operation to the server
&lt;ul&gt;
&lt;li&gt;The information may include: current position, target position, etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;After the server receives the movement operation, it executes the movement on the server and replicates the player&amp;rsquo;s displacement information to all clients
&lt;ul&gt;
&lt;li&gt;The information likewise includes: current position, target position, velocity, etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;After other clients receive the movement information, they modify the character&amp;rsquo;s movement target and adjust the character&amp;rsquo;s position based on interpolation&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="engine-implementation"&gt;&lt;a href="#engine-implementation" class="header-anchor"&gt;&lt;/a&gt;Engine Implementation
&lt;/h3&gt;&lt;p&gt;The movement flow in Unreal Engine under network replication is similar to this, roughly as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;On each frame when TickComponent is executed, the acceleration and rotation change for the frame are calculated; afterward, for the locally controlled Character, ReplicateMoveToServer is called to replicate the movement to the server&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;ReplicateMoveToServer saves the movement to a list, then executes PerformMovement to pre-execute the movement operation locally.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Then it calls ServerMove to replicate the movement to the server, informing it of the movement parameters, the position the client itself moved to, and the timestamp&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;ServerMove is executed on the server; it compares the position declared by the client with the server&amp;rsquo;s position, and if the difference is too large, it calls ClientAdjustPosition to correct the position on the locally controlled client&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If the client receives ClientAdjustPosition, it sets the client character&amp;rsquo;s position to the server&amp;rsquo;s position and marks bUpdatePosition as true, which will affect subsequent movement updates&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;When the client calls TickComponent again, if bUpdatePosition is present, it calls ClientUpdatePositionAfterServerUpdate to replay all movements that occurred after the movement adjustment on the server.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The description of the movement replication flow can be found in the engine source file CharacterMovementComponent.h:&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s how player movement prediction, replication and correction works in network games:&lt;/p&gt;
&lt;p&gt;Every tick, the TickComponent() function is called. It figures out the acceleration and rotation change for the frame,
and then calls PerformMovement() (for locally controlled Characters), or ReplicateMoveToServer() (if it&amp;rsquo;s a network client).&lt;/p&gt;
&lt;p&gt;ReplicateMoveToServer() saves the move (in the PendingMove list), calls PerformMovement(), and then replicates the move
to the server by calling the replicated function ServerMove() - passing the movement parameters, the client&amp;rsquo;s
resultant position, and a timestamp.&lt;/p&gt;
&lt;p&gt;ServerMove() is executed on the server. It decodes the movement parameters and causes the appropriate movement
to occur. It then looks at the resulting position and if enough time has passed since the last response, or the
position error is significant enough, the server calls ClientAdjustPosition(), a replicated function.&lt;/p&gt;
&lt;p&gt;ClientAdjustPosition() is executed on the client. The client sets its position to the servers version of position,
and sets the bUpdatePosition flag to true.&lt;/p&gt;
&lt;p&gt;When TickComponent() is called on the client again, if bUpdatePosition is true, the client will call
ClientUpdatePosition() before calling PerformMovement(). ClientUpdatePosition() replays all the moves in the pending
move list which occurred after the timestamp of the move the server was adjusting.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="player-input"&gt;&lt;a href="#player-input" class="header-anchor"&gt;&lt;/a&gt;Player Input
&lt;/h3&gt;&lt;p&gt;Player input is also managed by a component, &lt;code&gt;UInputComponent&lt;/code&gt;; typically, &lt;code&gt;BindAxis&lt;/code&gt; can be called to register event responses.&lt;/p&gt;
&lt;p&gt;Ultimately, this generally calls &lt;code&gt;UPawnMovementComponent::AddInputVector&lt;/code&gt; to handle movement.&lt;/p&gt;
&lt;h3 id="locally-controlled-character-movement"&gt;&lt;a href="#locally-controlled-character-movement" class="header-anchor"&gt;&lt;/a&gt;Locally Controlled Character Movement
&lt;/h3&gt;&lt;p&gt;In UE&amp;rsquo;s networking framework, characters are mainly divided into three types: ROLE_Authority, ROLE_AutonomousProxy, and ROLE_SimulatedProxy.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;See also: &lt;a class="link" href="content/post/knowledge/ue/network-role/%e8%99%9a%e5%b9%bb%e5%bc%95%e6%93%8e%e4%b8%ad%e7%bd%91%e7%bb%9c%e8%a7%92%e8%89%b2Role%e7%9b%b8%e5%85%b3%e6%a6%82%e5%bf%b5"&gt;Concepts related to network roles in Unreal Engine&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;On the client, the locally controlled character—that is, the Autonomous character—accepts control and then sends movement data to the server.&lt;/p&gt;
&lt;p&gt;Each local movement generates an FSavedMove_Character, and a &lt;code&gt;TArray&amp;lt;FSavedMovePtr&amp;gt; SavedMoves&lt;/code&gt; array is maintained, storing the movements the current player has already performed locally that have not yet been checked by the server.&lt;/p&gt;
&lt;p&gt;If the server acknowledges some movements, those movements can be removed; if the check fails, exception handling can be performed based on them.&lt;/p&gt;
&lt;h3 id="protocol-choice"&gt;&lt;a href="#protocol-choice" class="header-anchor"&gt;&lt;/a&gt;Protocol Choice
&lt;/h3&gt;&lt;p&gt;In UE, UDP is used as the transport protocol by default, which allows packets to be delivered as quickly as possible.&lt;/p&gt;
&lt;p&gt;UDP does not guarantee delivery or ordering, but the application layer can avoid these problems where needed through design.&lt;/p&gt;
&lt;h2 id="server-replicates-movement-to-clients"&gt;&lt;a href="#server-replicates-movement-to-clients" class="header-anchor"&gt;&lt;/a&gt;Server Replicates Movement to Clients
&lt;/h2&gt;&lt;h3 id="basic-actor-replication-scheme"&gt;&lt;a href="#basic-actor-replication-scheme" class="header-anchor"&gt;&lt;/a&gt;Basic Actor Replication Scheme
&lt;/h3&gt;&lt;p&gt;Actor itself supports movement replication. After the ReplicateMovement switch is enabled, when data such as the position and orientation of the Actor&amp;rsquo;s RootComponent changes, the data is replicated to simulated clients.&lt;/p&gt;
&lt;p&gt;When a simulated client receives the replication, it simply sets its own position and orientation. Movement data replication has intervals, so this implementation causes the Actor to pop.&lt;/p&gt;
&lt;h3 id="character-movement-replication"&gt;&lt;a href="#character-movement-replication" class="header-anchor"&gt;&lt;/a&gt;Character Movement Replication
&lt;/h3&gt;&lt;p&gt;To address the shortcomings of the basic Actor replication mode, CharacterMovementComponent specifically performs smoothing to make simulated character movement as smooth and natural as possible.&lt;/p&gt;
&lt;p&gt;Character mainly has two components, Capsule and Mesh; Capsule is Chara&lt;/p&gt;
&lt;h2 id="key-concepts"&gt;&lt;a href="#key-concepts" class="header-anchor"&gt;&lt;/a&gt;Key Concepts
&lt;/h2&gt;&lt;h3 id="ucharactermovement"&gt;&lt;a href="#ucharactermovement" class="header-anchor"&gt;&lt;/a&gt;UCharacterMovement
&lt;/h3&gt;&lt;p&gt;The character movement component is the most complex subclass and requires focused analysis.&lt;/p&gt;
&lt;pre class="mermaid"&gt;
classDiagram
class UCharacterMovementComponent {
+IRVOAvoidanceInterface
+INetworkPredictionInterface
}
UActorComponent &amp;lt;|-- UMovementComponent
UMovementComponent &amp;lt;|-- UNavMovementComponent
UNavMovementComponent &amp;lt;|-- UPawnMovementComponent
UPawnMovementComponent &amp;lt;|-- UCharacterMovementComponent
&lt;/pre&gt;
&lt;h3 id="fsavedmove_character"&gt;&lt;a href="#fsavedmove_character" class="header-anchor"&gt;&lt;/a&gt;FSavedMove_Character
&lt;/h3&gt;&lt;p&gt;Used to describe one movement of the player; it can be regarded as a snapshot of a single movement.&lt;/p&gt;
&lt;p&gt;Its main properties are:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Property&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;TimeStamp&lt;/td&gt;
&lt;td&gt;The time this movement occurred&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DeltaTime&lt;/td&gt;
&lt;td&gt;The time used by this movement&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CustomTimeDilation&lt;/td&gt;
&lt;td&gt;Time dilation coefficient, can be used for fast-forward and slow motion&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;StartPackedMovementMode&lt;/td&gt;
&lt;td&gt;MovementMode before the movement occurs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;StartLocation&lt;/td&gt;
&lt;td&gt;Position before the movement occurs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;StartVelocity&lt;/td&gt;
&lt;td&gt;Velocity before the movement occurs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EndPackedMovementMode&lt;/td&gt;
&lt;td&gt;MovementMode after the movement occurs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SavedLocation&lt;/td&gt;
&lt;td&gt;Position after the movement occurs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SavedVelocity&lt;/td&gt;
&lt;td&gt;Velocity after the movement occurs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Acceleration&lt;/td&gt;
&lt;td&gt;Acceleration used by the movement&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;In theory, as long as this data is available, the entire movement process can be reconstructed, and it can also be used for replay functionality.&lt;/p&gt;
&lt;h3 id="replicatemovetoserver"&gt;&lt;a href="#replicatemovetoserver" class="header-anchor"&gt;&lt;/a&gt;ReplicateMoveToServer
&lt;/h3&gt;&lt;p&gt;First, it finds the earliest ImportantMove from SavedMoves (determined via IsImportantMove), that is, the most recently server-acknowledged Move with a significant difference.&lt;/p&gt;
&lt;p&gt;After that, it creates and initializes an FSavedMove_Character. Then it executes PerformMovement, calculates the character&amp;rsquo;s post-operation properties, and sets the relevant information.&lt;/p&gt;
&lt;p&gt;It then processes it according to whether it can be combined.&lt;/p&gt;
&lt;h3 id="delayed-move-sending"&gt;&lt;a href="#delayed-move-sending" class="header-anchor"&gt;&lt;/a&gt;Delayed Move Sending
&lt;/h3&gt;&lt;p&gt;A Move may be delayed for a while and then sent to the server after being combined with a later Move. Therefore, before a newly created Move is sent to the server, it first checks whether it can be delayed.&lt;/p&gt;
&lt;p&gt;First, it checks whether NetEnableMoveCombining is enabled; if not, it will not delay sending either.&lt;/p&gt;
&lt;p&gt;It also checks whether the current Move can be delayed by checking whether the MovementMode before and after the Move has changed; if it has changed, the change also needs to be sent promptly. In other words, if this Move does not have a significant change, it can be delayed, and in theory the server&amp;rsquo;s calculation based on the previous information should produce the same result.&lt;/p&gt;
&lt;p&gt;Then it calculates the currently expected movement update interval. Based on information such as current network speed and player count, it adjusts the baseline value ClientNetSendMoveDeltaTime to obtain the final interval. If the update interval has not yet been reached during Tick, it delays sending the Move and stores it in PendingMove for later processing.&lt;/p&gt;
&lt;h3 id="callservermove"&gt;&lt;a href="#callservermove" class="header-anchor"&gt;&lt;/a&gt;CallServerMove
&lt;/h3&gt;&lt;p&gt;The function accepts two parameters: the newly created Move and the previously obtained ImportantMove (ImportantMove may be empty). It is not necessary to send the entire Move to the server; only key information such as position, rotation, and acceleration is needed, and this information is compressed.&lt;/p&gt;
&lt;p&gt;Simply put, the compression process tries to sacrifice precision by merging some fields into a single data structure.&lt;/p&gt;
&lt;p&gt;After that, it also calls ServerMoveOld to send some information from ImportantMove to the server, which can be simply understood as redundant insurance.&lt;/p&gt;
&lt;p&gt;If PendingMove exists, it means there is an uncombined Move, and ServerMoveDual needs to be called to send two consecutive Moves at once. Otherwise, it means the send interval is relatively large, or PendingMove has already been combined, so ServerMode is called to send this Move.&lt;/p&gt;
&lt;h3 id="servermoveold"&gt;&lt;a href="#servermoveold" class="header-anchor"&gt;&lt;/a&gt;ServerMoveOld
&lt;/h3&gt;&lt;p&gt;ServerMoveOld mainly serves as a redundant measure to prevent the server, when it newly receives movement data, from falling too far behind due to packet loss, causing the movement check to fail and thereby correcting the client&amp;rsquo;s position. ServerMoveOld allows the server to use the passed acceleration to roughly move quickly from the old position to the new position without validating the movement result.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;TODO: How is security guaranteed?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="todo"&gt;&lt;a href="#todo" class="header-anchor"&gt;&lt;/a&gt;TODO
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Movement under physics simulation&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;How movement is sent via RPC&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="references"&gt;&lt;a href="#references" class="header-anchor"&gt;&lt;/a&gt;References
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;a class="link" href="https://zhuanlan.zhihu.com/p/114341957" target="_blank" rel="noopener"&gt;UE4 Networked Movement Replication - Zhihu&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link" href="https://zhuanlan.zhihu.com/p/664568047" target="_blank" rel="noopener"&gt;Detailed Explanation of Network Replication for UE4/UE5 Character Movement Component - Zhihu&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link" href="https://zhuanlan.zhihu.com/p/650314172" target="_blank" rel="noopener"&gt;Illustrated Character Movement Component with &amp;ldquo;Grow by UE&amp;rdquo; - Zhihu&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link" href="https://zhuanlan.zhihu.com/p/20098342802" target="_blank" rel="noopener"&gt;Analysis of UE Movement Replication Principles (Part 1): Pawn Movement Property Replication - Zhihu&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Using Python in the Unreal Engine Editor</title><link>https://boiltask.com/en/knowledge/ue/editor-python/</link><pubDate>Mon, 02 Dec 2024 12:57:53 +0800</pubDate><guid>https://boiltask.com/en/knowledge/ue/editor-python/</guid><description>&lt;h2 id="feature-overview"&gt;&lt;a href="#feature-overview" class="header-anchor"&gt;&lt;/a&gt;Feature Overview
&lt;/h2&gt;&lt;p&gt;Reference documentation: &lt;a class="link" href="https://dev.epicgames.com/documentation/zh-cn/unreal-engine/scripting-the-unreal-editor-using-python" target="_blank" rel="noopener"&gt;Scripting the Unreal Editor Using Python&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Using DataAsset in Unreal Engine</title><link>https://boiltask.com/en/knowledge/ue/data-asset/</link><pubDate>Thu, 28 Nov 2024 13:14:08 +0800</pubDate><guid>https://boiltask.com/en/knowledge/ue/data-asset/</guid><description>&lt;h2 id="introduction-to-dataasset"&gt;&lt;a href="#introduction-to-dataasset" class="header-anchor"&gt;&lt;/a&gt;Introduction to DataAsset
&lt;/h2&gt;&lt;p&gt;It is generally used to represent a block of data. Its functionality is similar to DataTable, and in some sense it can be understood as a DataTable with only one row.&lt;/p&gt;
&lt;p&gt;Reference documentation: &lt;a class="link" href="https://dev.epicgames.com/documentation/zh-cn/unreal-engine/data-assets-in-unreal-engine" target="_blank" rel="noopener"&gt;Data Assets&lt;/a&gt;&lt;/p&gt;</description></item><item><title>[HDU] [1254] Sokoban</title><link>https://boiltask.com/en/oj/hdu-1254/</link><pubDate>Tue, 26 Jul 2016 17:01:23 +0800</pubDate><guid>https://boiltask.com/en/oj/hdu-1254/</guid><description>&lt;h2 id="problem-description"&gt;&lt;a href="#problem-description" class="header-anchor"&gt;&lt;/a&gt;Problem Description
&lt;/h2&gt;&lt;script&gt;
window.addEventListener('message', function (event) {
if (!event.data) {
return;
}
if (event.data.type === 'boiltask-oj-set-height') {
const iframes = document.querySelectorAll('.boiltask-oj-hdu-1254 iframe');
for (let i = 0; i &lt; iframes.length; i++) {
const iframe = iframes[i];
iframe.style.height = event.data.height + 'px';
}
} else if (event.data.type === 'boiltask-oj-problem-info') {
console.log(event.data);
const leftElements = document.querySelectorAll('.boiltask-oj-hdu-1254 .dida-content-iframe-title-left');
if (leftElements.length &gt; 0) {
if (!leftElements[0].innerHTML) {
leftElements[0].innerHTML = event.data.title;
}
}
const rightElements = document.querySelectorAll('.boiltask-oj-hdu-1254 .dida-content-iframe-title-right-desc');
if (rightElements.length &gt; 0) {
if (!rightElements[0].innerHTML) {
let text = ""
if (event.data.time_limit){
text += "&lt;b&gt;Time:&lt;/b&gt; " + event.data.time_limit
}
if (event.data.memory_limit){
if (text.length &gt; 0){
text += " | "
}
text += " &lt;b&gt;Memory:&lt;/b&gt; " + event.data.memory_limit
}
rightElements[0].innerHTML = text
}
}
}
});
&lt;/script&gt;
&lt;div class="dida-content-card boiltask-oj-hdu-1254"&gt;
&lt;div class="dida-content-iframe-title" style="display: flex; align-items: center; justify-content: space-between;"&gt;
&lt;div class="dida-content-iframe-title-left"&gt;&lt;/div&gt;
&lt;div class="dida-content-iframe-title-right" style="display: flex; align-items: center;"&gt;
&lt;div style="margin-right: 15px;"&gt;
&lt;span class="dida-content-iframe-title-right-desc"&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;div style="display: flex; align-items: center;"&gt;
&lt;button style="margin-left: 10px;" class="dida-boiltask-oj-button"
onclick="refreshBoiltaskOj(this, 'hdu-1254')"&gt;&lt;svg t="1745157575278" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3152"
width="200" height="200"&gt;
&lt;path
d="M934.4 206.933333c-17.066667-4.266667-34.133333 6.4-38.4 23.466667l-23.466667 87.466667C797.866667 183.466667 654.933333 96 497.066667 96 264.533333 96 74.666667 281.6 74.666667 512s189.866667 416 422.4 416c179.2 0 339.2-110.933333 398.933333-275.2 6.4-17.066667-2.133333-34.133333-19.2-40.533333-17.066667-6.4-34.133333 2.133333-40.533333 19.2-51.2 138.666667-187.733333 232.533333-339.2 232.533333C298.666667 864 138.666667 706.133333 138.666667 512S300.8 160 497.066667 160c145.066667 0 277.333333 87.466667 330.666666 217.6l-128-36.266667c-17.066667-4.266667-34.133333 6.4-38.4 23.466667-4.266667 17.066667 6.4 34.133333 23.466667 38.4l185.6 49.066667c2.133333 0 6.4 2.133333 8.533333 2.133333 6.4 0 10.666667-2.133333 17.066667-4.266667 6.4-4.266667 12.8-10.666667 14.933333-19.2l49.066667-185.6c0-17.066667-8.533333-34.133333-25.6-38.4z"
fill="#666666" p-id="3153"&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/button&gt;
&lt;button class="dida-boiltask-oj-button" onclick="openUrl('https:\/\/oj.boiltask.com\/problem\/hdu-1254')"&gt;&lt;svg t="1743933649558" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1626" xmlns:xlink="http://www.w3.org/1999/xlink" height="1em" weight="1em"&gt;&lt;path d="M548 196c15.456 0 28 12.544 28 28v20a8 8 0 0 1-8 8H256A4 4 0 0 0 252 256v512c0 2.208 1.792 4 4 4h512a4 4 0 0 0 4-4V424a8 8 0 0 1 8-8H800c15.456 0 28 12.544 28 28V768c0 33.152-26.88 60-60 60H256A60 60 0 0 1 196 768V256c0-33.152 26.88-60 60-60h292z m314.112-56.288c15.456 0 28 12.544 27.968 28v107.712a56 56 0 0 1-51.424 55.808l-4.608 0.192 0.032-99.296-371.968 364.544a28 28 0 0 1-39.616-0.416l-13.984-14.272a8 8 0 0 1 0.128-11.328L791.264 195.68l-92.896 0.064c0-30.912 25.088-56 56-56h107.744z" fill="#292929" p-id="1627"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style="position: relative; height: auto;"&gt;
&lt;div class="boiltask-oj-loading" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; background-color: #f5f5f5; z-index: 10;"&gt;
&lt;div style="text-align: center;"&gt;
&lt;div style="width: 40px; height: 40px; border: 4px solid #e0e0e0; border-top: 4px solid #4285f4; border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 10px;"&gt;&lt;/div&gt;
&lt;div style="color: #666;"&gt;Loading...&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;iframe src='https://oj.boiltask.com/widget/hdu-1254?hidden_title=1&amp;amp;hidden_limit=1' width="100%" height='500px' frameborder="0" allow="clipboard-write" onload="this.previousElementSibling.style.display='none';"&gt;&lt;/iframe&gt;
&lt;style&gt;
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.boiltask-oj-hdu-1254 { position: relative; }
&lt;/style&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id="problem-analysis"&gt;&lt;a href="#problem-analysis" class="header-anchor"&gt;&lt;/a&gt;Problem Analysis
&lt;/h2&gt;&lt;p&gt;Don&amp;rsquo;t overthink it when writing this kind of search problem…
Once you&amp;rsquo;ve got the idea straight, just write it boldly -.-&lt;/p&gt;
&lt;p&gt;dfs to check whether it&amp;rsquo;s reachable
bfs to find the shortest distance&lt;/p&gt;</description></item><item><title>[POJ] [1006] Biorhythms</title><link>https://boiltask.com/en/oj/poj-1006/</link><pubDate>Fri, 22 Jul 2016 09:23:52 +0800</pubDate><guid>https://boiltask.com/en/oj/poj-1006/</guid><description>&lt;h2 id="problem-description"&gt;&lt;a href="#problem-description" class="header-anchor"&gt;&lt;/a&gt;Problem Description
&lt;/h2&gt;&lt;script&gt;
window.addEventListener('message', function (event) {
if (!event.data) {
return;
}
if (event.data.type === 'boiltask-oj-set-height') {
const iframes = document.querySelectorAll('.boiltask-oj-poj-1006 iframe');
for (let i = 0; i &lt; iframes.length; i++) {
const iframe = iframes[i];
iframe.style.height = event.data.height + 'px';
}
} else if (event.data.type === 'boiltask-oj-problem-info') {
console.log(event.data);
const leftElements = document.querySelectorAll('.boiltask-oj-poj-1006 .dida-content-iframe-title-left');
if (leftElements.length &gt; 0) {
if (!leftElements[0].innerHTML) {
leftElements[0].innerHTML = event.data.title;
}
}
const rightElements = document.querySelectorAll('.boiltask-oj-poj-1006 .dida-content-iframe-title-right-desc');
if (rightElements.length &gt; 0) {
if (!rightElements[0].innerHTML) {
let text = ""
if (event.data.time_limit){
text += "&lt;b&gt;Time:&lt;/b&gt; " + event.data.time_limit
}
if (event.data.memory_limit){
if (text.length &gt; 0){
text += " | "
}
text += " &lt;b&gt;Memory:&lt;/b&gt; " + event.data.memory_limit
}
rightElements[0].innerHTML = text
}
}
}
});
&lt;/script&gt;
&lt;div class="dida-content-card boiltask-oj-poj-1006"&gt;
&lt;div class="dida-content-iframe-title" style="display: flex; align-items: center; justify-content: space-between;"&gt;
&lt;div class="dida-content-iframe-title-left"&gt;&lt;/div&gt;
&lt;div class="dida-content-iframe-title-right" style="display: flex; align-items: center;"&gt;
&lt;div style="margin-right: 15px;"&gt;
&lt;span class="dida-content-iframe-title-right-desc"&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;div style="display: flex; align-items: center;"&gt;
&lt;button style="margin-left: 10px;" class="dida-boiltask-oj-button"
onclick="refreshBoiltaskOj(this, 'poj-1006')"&gt;&lt;svg t="1745157575278" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3152"
width="200" height="200"&gt;
&lt;path
d="M934.4 206.933333c-17.066667-4.266667-34.133333 6.4-38.4 23.466667l-23.466667 87.466667C797.866667 183.466667 654.933333 96 497.066667 96 264.533333 96 74.666667 281.6 74.666667 512s189.866667 416 422.4 416c179.2 0 339.2-110.933333 398.933333-275.2 6.4-17.066667-2.133333-34.133333-19.2-40.533333-17.066667-6.4-34.133333 2.133333-40.533333 19.2-51.2 138.666667-187.733333 232.533333-339.2 232.533333C298.666667 864 138.666667 706.133333 138.666667 512S300.8 160 497.066667 160c145.066667 0 277.333333 87.466667 330.666666 217.6l-128-36.266667c-17.066667-4.266667-34.133333 6.4-38.4 23.466667-4.266667 17.066667 6.4 34.133333 23.466667 38.4l185.6 49.066667c2.133333 0 6.4 2.133333 8.533333 2.133333 6.4 0 10.666667-2.133333 17.066667-4.266667 6.4-4.266667 12.8-10.666667 14.933333-19.2l49.066667-185.6c0-17.066667-8.533333-34.133333-25.6-38.4z"
fill="#666666" p-id="3153"&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/button&gt;
&lt;button class="dida-boiltask-oj-button" onclick="openUrl('https:\/\/oj.boiltask.com\/problem\/poj-1006')"&gt;&lt;svg t="1743933649558" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1626" xmlns:xlink="http://www.w3.org/1999/xlink" height="1em" weight="1em"&gt;&lt;path d="M548 196c15.456 0 28 12.544 28 28v20a8 8 0 0 1-8 8H256A4 4 0 0 0 252 256v512c0 2.208 1.792 4 4 4h512a4 4 0 0 0 4-4V424a8 8 0 0 1 8-8H800c15.456 0 28 12.544 28 28V768c0 33.152-26.88 60-60 60H256A60 60 0 0 1 196 768V256c0-33.152 26.88-60 60-60h292z m314.112-56.288c15.456 0 28 12.544 27.968 28v107.712a56 56 0 0 1-51.424 55.808l-4.608 0.192 0.032-99.296-371.968 364.544a28 28 0 0 1-39.616-0.416l-13.984-14.272a8 8 0 0 1 0.128-11.328L791.264 195.68l-92.896 0.064c0-30.912 25.088-56 56-56h107.744z" fill="#292929" p-id="1627"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style="position: relative; height: auto;"&gt;
&lt;div class="boiltask-oj-loading" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; background-color: #f5f5f5; z-index: 10;"&gt;
&lt;div style="text-align: center;"&gt;
&lt;div style="width: 40px; height: 40px; border: 4px solid #e0e0e0; border-top: 4px solid #4285f4; border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 10px;"&gt;&lt;/div&gt;
&lt;div style="color: #666;"&gt;Loading...&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;iframe src='https://oj.boiltask.com/widget/poj-1006?hidden_title=1&amp;amp;hidden_limit=1' width="100%" height='500px' frameborder="0" allow="clipboard-write" onload="this.previousElementSibling.style.display='none';"&gt;&lt;/iframe&gt;
&lt;style&gt;
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.boiltask-oj-poj-1006 { position: relative; }
&lt;/style&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id="problem-analysis"&gt;&lt;a href="#problem-analysis" class="header-anchor"&gt;&lt;/a&gt;Problem Analysis
&lt;/h2&gt;&lt;p&gt;TODO&lt;/p&gt;</description></item><item><title>[POJ] [1679] The Unique MST</title><link>https://boiltask.com/en/oj/poj-1679/</link><pubDate>Sun, 21 Feb 2016 02:45:55 +0800</pubDate><guid>https://boiltask.com/en/oj/poj-1679/</guid><description>&lt;h2 id="problem-description"&gt;&lt;a href="#problem-description" class="header-anchor"&gt;&lt;/a&gt;Problem Description
&lt;/h2&gt;&lt;script&gt;
window.addEventListener('message', function (event) {
if (!event.data) {
return;
}
if (event.data.type === 'boiltask-oj-set-height') {
const iframes = document.querySelectorAll('.boiltask-oj-poj-1679 iframe');
for (let i = 0; i &lt; iframes.length; i++) {
const iframe = iframes[i];
iframe.style.height = event.data.height + 'px';
}
} else if (event.data.type === 'boiltask-oj-problem-info') {
console.log(event.data);
const leftElements = document.querySelectorAll('.boiltask-oj-poj-1679 .dida-content-iframe-title-left');
if (leftElements.length &gt; 0) {
if (!leftElements[0].innerHTML) {
leftElements[0].innerHTML = event.data.title;
}
}
const rightElements = document.querySelectorAll('.boiltask-oj-poj-1679 .dida-content-iframe-title-right-desc');
if (rightElements.length &gt; 0) {
if (!rightElements[0].innerHTML) {
let text = ""
if (event.data.time_limit){
text += "&lt;b&gt;Time:&lt;/b&gt; " + event.data.time_limit
}
if (event.data.memory_limit){
if (text.length &gt; 0){
text += " | "
}
text += " &lt;b&gt;Memory:&lt;/b&gt; " + event.data.memory_limit
}
rightElements[0].innerHTML = text
}
}
}
});
&lt;/script&gt;
&lt;div class="dida-content-card boiltask-oj-poj-1679"&gt;
&lt;div class="dida-content-iframe-title" style="display: flex; align-items: center; justify-content: space-between;"&gt;
&lt;div class="dida-content-iframe-title-left"&gt;&lt;/div&gt;
&lt;div class="dida-content-iframe-title-right" style="display: flex; align-items: center;"&gt;
&lt;div style="margin-right: 15px;"&gt;
&lt;span class="dida-content-iframe-title-right-desc"&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;div style="display: flex; align-items: center;"&gt;
&lt;button style="margin-left: 10px;" class="dida-boiltask-oj-button"
onclick="refreshBoiltaskOj(this, 'poj-1679')"&gt;&lt;svg t="1745157575278" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3152"
width="200" height="200"&gt;
&lt;path
d="M934.4 206.933333c-17.066667-4.266667-34.133333 6.4-38.4 23.466667l-23.466667 87.466667C797.866667 183.466667 654.933333 96 497.066667 96 264.533333 96 74.666667 281.6 74.666667 512s189.866667 416 422.4 416c179.2 0 339.2-110.933333 398.933333-275.2 6.4-17.066667-2.133333-34.133333-19.2-40.533333-17.066667-6.4-34.133333 2.133333-40.533333 19.2-51.2 138.666667-187.733333 232.533333-339.2 232.533333C298.666667 864 138.666667 706.133333 138.666667 512S300.8 160 497.066667 160c145.066667 0 277.333333 87.466667 330.666666 217.6l-128-36.266667c-17.066667-4.266667-34.133333 6.4-38.4 23.466667-4.266667 17.066667 6.4 34.133333 23.466667 38.4l185.6 49.066667c2.133333 0 6.4 2.133333 8.533333 2.133333 6.4 0 10.666667-2.133333 17.066667-4.266667 6.4-4.266667 12.8-10.666667 14.933333-19.2l49.066667-185.6c0-17.066667-8.533333-34.133333-25.6-38.4z"
fill="#666666" p-id="3153"&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/button&gt;
&lt;button class="dida-boiltask-oj-button" onclick="openUrl('https:\/\/oj.boiltask.com\/problem\/poj-1679')"&gt;&lt;svg t="1743933649558" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1626" xmlns:xlink="http://www.w3.org/1999/xlink" height="1em" weight="1em"&gt;&lt;path d="M548 196c15.456 0 28 12.544 28 28v20a8 8 0 0 1-8 8H256A4 4 0 0 0 252 256v512c0 2.208 1.792 4 4 4h512a4 4 0 0 0 4-4V424a8 8 0 0 1 8-8H800c15.456 0 28 12.544 28 28V768c0 33.152-26.88 60-60 60H256A60 60 0 0 1 196 768V256c0-33.152 26.88-60 60-60h292z m314.112-56.288c15.456 0 28 12.544 27.968 28v107.712a56 56 0 0 1-51.424 55.808l-4.608 0.192 0.032-99.296-371.968 364.544a28 28 0 0 1-39.616-0.416l-13.984-14.272a8 8 0 0 1 0.128-11.328L791.264 195.68l-92.896 0.064c0-30.912 25.088-56 56-56h107.744z" fill="#292929" p-id="1627"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style="position: relative; height: auto;"&gt;
&lt;div class="boiltask-oj-loading" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; background-color: #f5f5f5; z-index: 10;"&gt;
&lt;div style="text-align: center;"&gt;
&lt;div style="width: 40px; height: 40px; border: 4px solid #e0e0e0; border-top: 4px solid #4285f4; border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 10px;"&gt;&lt;/div&gt;
&lt;div style="color: #666;"&gt;Loading...&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;iframe src='https://oj.boiltask.com/widget/poj-1679?hidden_title=1&amp;amp;hidden_limit=1' width="100%" height='500px' frameborder="0" allow="clipboard-write" onload="this.previousElementSibling.style.display='none';"&gt;&lt;/iframe&gt;
&lt;style&gt;
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.boiltask-oj-poj-1679 { position: relative; }
&lt;/style&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id="problem-analysis"&gt;&lt;a href="#problem-analysis" class="header-anchor"&gt;&lt;/a&gt;Problem Analysis
&lt;/h2&gt;&lt;p&gt;It&amp;rsquo;s said to be called…&lt;br&gt;
the Second Minimum Spanning Tree&lt;br&gt;
I first came across this concept in Yu Shen&amp;rsquo;s blog&lt;/p&gt;
&lt;p&gt;The question asks whether the Minimum Spanning Tree is unique&lt;br&gt;
so compute the second minimum spanning tree and compare them&lt;br&gt;
if they are equal, it is not unique&lt;/p&gt;
&lt;p&gt;Problem link: &lt;a class="link" href="http://poj.org/problem?id=1679" target="_blank" rel="noopener"&gt;POJ 1679 The Unique MST&lt;/a&gt;&lt;/p&gt;</description></item><item><title>【POJ】[3026] Borg Maze</title><link>https://boiltask.com/en/oj/poj-3026/</link><pubDate>Sun, 21 Feb 2016 02:40:39 +0800</pubDate><guid>https://boiltask.com/en/oj/poj-3026/</guid><description>&lt;h2 id="problem-description"&gt;&lt;a href="#problem-description" class="header-anchor"&gt;&lt;/a&gt;Problem Description
&lt;/h2&gt;&lt;script&gt;
window.addEventListener('message', function (event) {
if (!event.data) {
return;
}
if (event.data.type === 'boiltask-oj-set-height') {
const iframes = document.querySelectorAll('.boiltask-oj-poj-3026 iframe');
for (let i = 0; i &lt; iframes.length; i++) {
const iframe = iframes[i];
iframe.style.height = event.data.height + 'px';
}
} else if (event.data.type === 'boiltask-oj-problem-info') {
console.log(event.data);
const leftElements = document.querySelectorAll('.boiltask-oj-poj-3026 .dida-content-iframe-title-left');
if (leftElements.length &gt; 0) {
if (!leftElements[0].innerHTML) {
leftElements[0].innerHTML = event.data.title;
}
}
const rightElements = document.querySelectorAll('.boiltask-oj-poj-3026 .dida-content-iframe-title-right-desc');
if (rightElements.length &gt; 0) {
if (!rightElements[0].innerHTML) {
let text = ""
if (event.data.time_limit){
text += "&lt;b&gt;Time:&lt;/b&gt; " + event.data.time_limit
}
if (event.data.memory_limit){
if (text.length &gt; 0){
text += " | "
}
text += " &lt;b&gt;Memory:&lt;/b&gt; " + event.data.memory_limit
}
rightElements[0].innerHTML = text
}
}
}
});
&lt;/script&gt;
&lt;div class="dida-content-card boiltask-oj-poj-3026"&gt;
&lt;div class="dida-content-iframe-title" style="display: flex; align-items: center; justify-content: space-between;"&gt;
&lt;div class="dida-content-iframe-title-left"&gt;&lt;/div&gt;
&lt;div class="dida-content-iframe-title-right" style="display: flex; align-items: center;"&gt;
&lt;div style="margin-right: 15px;"&gt;
&lt;span class="dida-content-iframe-title-right-desc"&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;div style="display: flex; align-items: center;"&gt;
&lt;button style="margin-left: 10px;" class="dida-boiltask-oj-button"
onclick="refreshBoiltaskOj(this, 'poj-3026')"&gt;&lt;svg t="1745157575278" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3152"
width="200" height="200"&gt;
&lt;path
d="M934.4 206.933333c-17.066667-4.266667-34.133333 6.4-38.4 23.466667l-23.466667 87.466667C797.866667 183.466667 654.933333 96 497.066667 96 264.533333 96 74.666667 281.6 74.666667 512s189.866667 416 422.4 416c179.2 0 339.2-110.933333 398.933333-275.2 6.4-17.066667-2.133333-34.133333-19.2-40.533333-17.066667-6.4-34.133333 2.133333-40.533333 19.2-51.2 138.666667-187.733333 232.533333-339.2 232.533333C298.666667 864 138.666667 706.133333 138.666667 512S300.8 160 497.066667 160c145.066667 0 277.333333 87.466667 330.666666 217.6l-128-36.266667c-17.066667-4.266667-34.133333 6.4-38.4 23.466667-4.266667 17.066667 6.4 34.133333 23.466667 38.4l185.6 49.066667c2.133333 0 6.4 2.133333 8.533333 2.133333 6.4 0 10.666667-2.133333 17.066667-4.266667 6.4-4.266667 12.8-10.666667 14.933333-19.2l49.066667-185.6c0-17.066667-8.533333-34.133333-25.6-38.4z"
fill="#666666" p-id="3153"&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/button&gt;
&lt;button class="dida-boiltask-oj-button" onclick="openUrl('https:\/\/oj.boiltask.com\/problem\/poj-3026')"&gt;&lt;svg t="1743933649558" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1626" xmlns:xlink="http://www.w3.org/1999/xlink" height="1em" weight="1em"&gt;&lt;path d="M548 196c15.456 0 28 12.544 28 28v20a8 8 0 0 1-8 8H256A4 4 0 0 0 252 256v512c0 2.208 1.792 4 4 4h512a4 4 0 0 0 4-4V424a8 8 0 0 1 8-8H800c15.456 0 28 12.544 28 28V768c0 33.152-26.88 60-60 60H256A60 60 0 0 1 196 768V256c0-33.152 26.88-60 60-60h292z m314.112-56.288c15.456 0 28 12.544 27.968 28v107.712a56 56 0 0 1-51.424 55.808l-4.608 0.192 0.032-99.296-371.968 364.544a28 28 0 0 1-39.616-0.416l-13.984-14.272a8 8 0 0 1 0.128-11.328L791.264 195.68l-92.896 0.064c0-30.912 25.088-56 56-56h107.744z" fill="#292929" p-id="1627"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style="position: relative; height: auto;"&gt;
&lt;div class="boiltask-oj-loading" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; background-color: #f5f5f5; z-index: 10;"&gt;
&lt;div style="text-align: center;"&gt;
&lt;div style="width: 40px; height: 40px; border: 4px solid #e0e0e0; border-top: 4px solid #4285f4; border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 10px;"&gt;&lt;/div&gt;
&lt;div style="color: #666;"&gt;Loading...&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;iframe src='https://oj.boiltask.com/widget/poj-3026?hidden_title=1&amp;amp;hidden_limit=1' width="100%" height='500px' frameborder="0" allow="clipboard-write" onload="this.previousElementSibling.style.display='none';"&gt;&lt;/iframe&gt;
&lt;style&gt;
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.boiltask-oj-poj-3026 { position: relative; }
&lt;/style&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id="problem-analysis"&gt;&lt;a href="#problem-analysis" class="header-anchor"&gt;&lt;/a&gt;Problem Analysis
&lt;/h2&gt;&lt;p&gt;At least I understood what the problem is asking&lt;br&gt;
Use BFS to find the distances between every pair of points, then compute the Minimum Spanning Tree&lt;/p&gt;
&lt;p&gt;But after trying BFS, I feel like I can&amp;rsquo;t actually write it&amp;hellip;&lt;br&gt;
Let me just leave a placeholder here for now&lt;/p&gt;
&lt;p&gt;Problem link: &lt;a class="link" href="http://poj.org/problem?id=3026" target="_blank" rel="noopener"&gt;POJ [3026] Borg Maze&lt;/a&gt;&lt;/p&gt;</description></item><item><title>【UVa】[210]Concurrency Simulator</title><link>https://boiltask.com/en/oj/uva-210/</link><pubDate>Fri, 12 Feb 2016 23:39:57 +0800</pubDate><guid>https://boiltask.com/en/oj/uva-210/</guid><description>&lt;h2 id="problem-description"&gt;&lt;a href="#problem-description" class="header-anchor"&gt;&lt;/a&gt;Problem Description
&lt;/h2&gt;&lt;script&gt;
window.addEventListener('message', function (event) {
if (!event.data) {
return;
}
if (event.data.type === 'boiltask-oj-set-height') {
const iframes = document.querySelectorAll('.boiltask-oj-uva-210 iframe');
for (let i = 0; i &lt; iframes.length; i++) {
const iframe = iframes[i];
iframe.style.height = event.data.height + 'px';
}
} else if (event.data.type === 'boiltask-oj-problem-info') {
console.log(event.data);
const leftElements = document.querySelectorAll('.boiltask-oj-uva-210 .dida-content-iframe-title-left');
if (leftElements.length &gt; 0) {
if (!leftElements[0].innerHTML) {
leftElements[0].innerHTML = event.data.title;
}
}
const rightElements = document.querySelectorAll('.boiltask-oj-uva-210 .dida-content-iframe-title-right-desc');
if (rightElements.length &gt; 0) {
if (!rightElements[0].innerHTML) {
let text = ""
if (event.data.time_limit){
text += "&lt;b&gt;Time:&lt;/b&gt; " + event.data.time_limit
}
if (event.data.memory_limit){
if (text.length &gt; 0){
text += " | "
}
text += " &lt;b&gt;Memory:&lt;/b&gt; " + event.data.memory_limit
}
rightElements[0].innerHTML = text
}
}
}
});
&lt;/script&gt;
&lt;div class="dida-content-card boiltask-oj-uva-210"&gt;
&lt;div class="dida-content-iframe-title" style="display: flex; align-items: center; justify-content: space-between;"&gt;
&lt;div class="dida-content-iframe-title-left"&gt;&lt;/div&gt;
&lt;div class="dida-content-iframe-title-right" style="display: flex; align-items: center;"&gt;
&lt;div style="margin-right: 15px;"&gt;
&lt;span class="dida-content-iframe-title-right-desc"&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;div style="display: flex; align-items: center;"&gt;
&lt;button style="margin-left: 10px;" class="dida-boiltask-oj-button"
onclick="refreshBoiltaskOj(this, 'uva-210')"&gt;&lt;svg t="1745157575278" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3152"
width="200" height="200"&gt;
&lt;path
d="M934.4 206.933333c-17.066667-4.266667-34.133333 6.4-38.4 23.466667l-23.466667 87.466667C797.866667 183.466667 654.933333 96 497.066667 96 264.533333 96 74.666667 281.6 74.666667 512s189.866667 416 422.4 416c179.2 0 339.2-110.933333 398.933333-275.2 6.4-17.066667-2.133333-34.133333-19.2-40.533333-17.066667-6.4-34.133333 2.133333-40.533333 19.2-51.2 138.666667-187.733333 232.533333-339.2 232.533333C298.666667 864 138.666667 706.133333 138.666667 512S300.8 160 497.066667 160c145.066667 0 277.333333 87.466667 330.666666 217.6l-128-36.266667c-17.066667-4.266667-34.133333 6.4-38.4 23.466667-4.266667 17.066667 6.4 34.133333 23.466667 38.4l185.6 49.066667c2.133333 0 6.4 2.133333 8.533333 2.133333 6.4 0 10.666667-2.133333 17.066667-4.266667 6.4-4.266667 12.8-10.666667 14.933333-19.2l49.066667-185.6c0-17.066667-8.533333-34.133333-25.6-38.4z"
fill="#666666" p-id="3153"&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/button&gt;
&lt;button class="dida-boiltask-oj-button" onclick="openUrl('https:\/\/oj.boiltask.com\/problem\/uva-210')"&gt;&lt;svg t="1743933649558" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1626" xmlns:xlink="http://www.w3.org/1999/xlink" height="1em" weight="1em"&gt;&lt;path d="M548 196c15.456 0 28 12.544 28 28v20a8 8 0 0 1-8 8H256A4 4 0 0 0 252 256v512c0 2.208 1.792 4 4 4h512a4 4 0 0 0 4-4V424a8 8 0 0 1 8-8H800c15.456 0 28 12.544 28 28V768c0 33.152-26.88 60-60 60H256A60 60 0 0 1 196 768V256c0-33.152 26.88-60 60-60h292z m314.112-56.288c15.456 0 28 12.544 27.968 28v107.712a56 56 0 0 1-51.424 55.808l-4.608 0.192 0.032-99.296-371.968 364.544a28 28 0 0 1-39.616-0.416l-13.984-14.272a8 8 0 0 1 0.128-11.328L791.264 195.68l-92.896 0.064c0-30.912 25.088-56 56-56h107.744z" fill="#292929" p-id="1627"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style="position: relative; height: auto;"&gt;
&lt;div class="boiltask-oj-loading" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; background-color: #f5f5f5; z-index: 10;"&gt;
&lt;div style="text-align: center;"&gt;
&lt;div style="width: 40px; height: 40px; border: 4px solid #e0e0e0; border-top: 4px solid #4285f4; border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 10px;"&gt;&lt;/div&gt;
&lt;div style="color: #666;"&gt;Loading...&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;iframe src='https://oj.boiltask.com/widget/uva-210?hidden_title=1&amp;amp;hidden_limit=1' width="100%" height='500px' frameborder="0" allow="clipboard-write" onload="this.previousElementSibling.style.display='none';"&gt;&lt;/iframe&gt;
&lt;style&gt;
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.boiltask-oj-uva-210 { position: relative; }
&lt;/style&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id="problem-analysis"&gt;&lt;a href="#problem-analysis" class="header-anchor"&gt;&lt;/a&gt;Problem Analysis
&lt;/h2&gt;&lt;p&gt;A problem from the Purple Book&lt;br&gt;
First, write a template and save it for reference&lt;/p&gt;
&lt;p&gt;Problem link: &lt;a class="link" href="https://uva.onlinejudge.org/index.php?option=com_onlinejudge&amp;amp;Itemid=8&amp;amp;category=838&amp;amp;page=show_problem&amp;amp;problem=146" target="_blank" rel="noopener"&gt;【UVa】[210]Concurrency Simulator&lt;/a&gt;&lt;/p&gt;</description></item><item><title>[POJ] [1417] True Liars</title><link>https://boiltask.com/en/oj/poj-1417/</link><pubDate>Wed, 10 Feb 2016 00:29:02 +0800</pubDate><guid>https://boiltask.com/en/oj/poj-1417/</guid><description>&lt;h2 id="problem-description"&gt;&lt;a href="#problem-description" class="header-anchor"&gt;&lt;/a&gt;Problem Description
&lt;/h2&gt;&lt;script&gt;
window.addEventListener('message', function (event) {
if (!event.data) {
return;
}
if (event.data.type === 'boiltask-oj-set-height') {
const iframes = document.querySelectorAll('.boiltask-oj-poj-1417 iframe');
for (let i = 0; i &lt; iframes.length; i++) {
const iframe = iframes[i];
iframe.style.height = event.data.height + 'px';
}
} else if (event.data.type === 'boiltask-oj-problem-info') {
console.log(event.data);
const leftElements = document.querySelectorAll('.boiltask-oj-poj-1417 .dida-content-iframe-title-left');
if (leftElements.length &gt; 0) {
if (!leftElements[0].innerHTML) {
leftElements[0].innerHTML = event.data.title;
}
}
const rightElements = document.querySelectorAll('.boiltask-oj-poj-1417 .dida-content-iframe-title-right-desc');
if (rightElements.length &gt; 0) {
if (!rightElements[0].innerHTML) {
let text = ""
if (event.data.time_limit){
text += "&lt;b&gt;Time:&lt;/b&gt; " + event.data.time_limit
}
if (event.data.memory_limit){
if (text.length &gt; 0){
text += " | "
}
text += " &lt;b&gt;Memory:&lt;/b&gt; " + event.data.memory_limit
}
rightElements[0].innerHTML = text
}
}
}
});
&lt;/script&gt;
&lt;div class="dida-content-card boiltask-oj-poj-1417"&gt;
&lt;div class="dida-content-iframe-title" style="display: flex; align-items: center; justify-content: space-between;"&gt;
&lt;div class="dida-content-iframe-title-left"&gt;&lt;/div&gt;
&lt;div class="dida-content-iframe-title-right" style="display: flex; align-items: center;"&gt;
&lt;div style="margin-right: 15px;"&gt;
&lt;span class="dida-content-iframe-title-right-desc"&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;div style="display: flex; align-items: center;"&gt;
&lt;button style="margin-left: 10px;" class="dida-boiltask-oj-button"
onclick="refreshBoiltaskOj(this, 'poj-1417')"&gt;&lt;svg t="1745157575278" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3152"
width="200" height="200"&gt;
&lt;path
d="M934.4 206.933333c-17.066667-4.266667-34.133333 6.4-38.4 23.466667l-23.466667 87.466667C797.866667 183.466667 654.933333 96 497.066667 96 264.533333 96 74.666667 281.6 74.666667 512s189.866667 416 422.4 416c179.2 0 339.2-110.933333 398.933333-275.2 6.4-17.066667-2.133333-34.133333-19.2-40.533333-17.066667-6.4-34.133333 2.133333-40.533333 19.2-51.2 138.666667-187.733333 232.533333-339.2 232.533333C298.666667 864 138.666667 706.133333 138.666667 512S300.8 160 497.066667 160c145.066667 0 277.333333 87.466667 330.666666 217.6l-128-36.266667c-17.066667-4.266667-34.133333 6.4-38.4 23.466667-4.266667 17.066667 6.4 34.133333 23.466667 38.4l185.6 49.066667c2.133333 0 6.4 2.133333 8.533333 2.133333 6.4 0 10.666667-2.133333 17.066667-4.266667 6.4-4.266667 12.8-10.666667 14.933333-19.2l49.066667-185.6c0-17.066667-8.533333-34.133333-25.6-38.4z"
fill="#666666" p-id="3153"&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/button&gt;
&lt;button class="dida-boiltask-oj-button" onclick="openUrl('https:\/\/oj.boiltask.com\/problem\/poj-1417')"&gt;&lt;svg t="1743933649558" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1626" xmlns:xlink="http://www.w3.org/1999/xlink" height="1em" weight="1em"&gt;&lt;path d="M548 196c15.456 0 28 12.544 28 28v20a8 8 0 0 1-8 8H256A4 4 0 0 0 252 256v512c0 2.208 1.792 4 4 4h512a4 4 0 0 0 4-4V424a8 8 0 0 1 8-8H800c15.456 0 28 12.544 28 28V768c0 33.152-26.88 60-60 60H256A60 60 0 0 1 196 768V256c0-33.152 26.88-60 60-60h292z m314.112-56.288c15.456 0 28 12.544 27.968 28v107.712a56 56 0 0 1-51.424 55.808l-4.608 0.192 0.032-99.296-371.968 364.544a28 28 0 0 1-39.616-0.416l-13.984-14.272a8 8 0 0 1 0.128-11.328L791.264 195.68l-92.896 0.064c0-30.912 25.088-56 56-56h107.744z" fill="#292929" p-id="1627"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style="position: relative; height: auto;"&gt;
&lt;div class="boiltask-oj-loading" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; background-color: #f5f5f5; z-index: 10;"&gt;
&lt;div style="text-align: center;"&gt;
&lt;div style="width: 40px; height: 40px; border: 4px solid #e0e0e0; border-top: 4px solid #4285f4; border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 10px;"&gt;&lt;/div&gt;
&lt;div style="color: #666;"&gt;Loading...&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;iframe src='https://oj.boiltask.com/widget/poj-1417?hidden_title=1&amp;amp;hidden_limit=1' width="100%" height='500px' frameborder="0" allow="clipboard-write" onload="this.previousElementSibling.style.display='none';"&gt;&lt;/iframe&gt;
&lt;style&gt;
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.boiltask-oj-poj-1417 { position: relative; }
&lt;/style&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id="problem-analysis"&gt;&lt;a href="#problem-analysis" class="header-anchor"&gt;&lt;/a&gt;Problem Analysis
&lt;/h2&gt;&lt;p&gt;During the Chinese New Year I was also driven crazy by this problem&lt;br&gt;
and had no internet so I couldn&amp;rsquo;t search for editorials&lt;br&gt;
so at the time I was pretty much falling apart&lt;/p&gt;
&lt;p&gt;But it seems the place where I got stuck wasn&amp;rsquo;t really within the scope of Union-Find&lt;br&gt;
Still, this problem is quite easy to connect with Union-Find&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Tell n statements and specify that there are x wizards and y demons&lt;br&gt;
Given xi yi YES/NO&lt;br&gt;
to represent whether xi says yi is a wizard&lt;br&gt;
Finally, if it is possible to determine which ones are wizards&lt;br&gt;
then output these people and append end to finish the output&lt;br&gt;
otherwise output no&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;We can make a table based on the sample input&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;1Y2Y 1N2N——&lt;br&gt;
1Y3N 1N3Y——1Y-2Y-3N 1N-2N-3Y&lt;br&gt;
4Y5Y 4N5N——1Y-2Y-3N 1N-2N-3Y&lt;br&gt;
5Y6Y 5N6N——1Y-2Y-3N 1N-2N-3Y 4Y-5Y-6Y 4N-5N-6N&lt;br&gt;
6Y7N 6N7Y——1Y-2Y-3N 1N-2N-3Y 4Y-5Y-6Y-7N 4N-5N-6N-7Y&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Based on the Food Chain problem, it is easy to think of merging all the possibilities corresponding to the statements and then searching through them&lt;/p&gt;
&lt;p&gt;However&amp;hellip; figuring out exactly which people are the Y ones satisfying the conditions is a bit tough, and there is also my lack of confidence in my English plus the logic of the problem statement; you can ask yourself&lt;br&gt;
so at the time I thought&amp;hellip;&lt;/p&gt;
&lt;p&gt;If a person says he is not a good person, then is he actually a good person?&lt;br&gt;
If he says he is not a good person, then if his statement is true he is a bad person, so his statement should be false; if it is false, then he should be a good person, and his statement is true again.&lt;/p&gt;
&lt;p&gt;So I also didn&amp;rsquo;t find a specific description of this aspect in the problem, so I didn&amp;rsquo;t figure out how to write this problem specifically.&lt;/p&gt;
&lt;p&gt;Then I searched for editorials, and felt I should just put this problem aside for now&lt;br&gt;
I&amp;rsquo;ll come back to fill it in a few days later; this is also to commemorate my problem-solving experience during the Chinese New Year&lt;/p&gt;
&lt;p&gt;Problem link: &lt;a class="link" href="http://poj.org/problem?id=1417" target="_blank" rel="noopener"&gt;POJ 1417 True Liars&lt;/a&gt;&lt;/p&gt;</description></item></channel></rss>