<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Computer Graphics on BoilTask's Blog</title><link>https://boiltask.com/en/tags/computer-graphics/</link><description>Recent content in Computer Graphics 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/computer-graphics/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>GAMES104 Modern Game Engine - Rendering Practices in Game Engines</title><link>https://boiltask.com/en/note/games104-game-engine-4/</link><pubDate>Tue, 27 Jan 2026 23:11:25 +0800</pubDate><guid>https://boiltask.com/en/note/games104-game-engine-4/</guid><description>&lt;h2 id="course-overview"&gt;&lt;a href="#course-overview" class="header-anchor"&gt;&lt;/a&gt;Course Overview
&lt;/h2&gt;&lt;p&gt;In modern game engines, the rendering system occupies an extremely important position. It not only accounts for the largest portion of engine code but is also one of the most technically difficult and specialized fields. Although many people think &amp;ldquo;a game engine is just a drawing engine,&amp;rdquo; in reality rendering in game engines is fundamentally different from textbook computer graphics.&lt;/p&gt;
&lt;h3 id="game-rendering-vs-theoretical-graphics"&gt;&lt;a href="#game-rendering-vs-theoretical-graphics" class="header-anchor"&gt;&lt;/a&gt;Game Rendering vs Theoretical Graphics
&lt;/h3&gt;&lt;p&gt;Computer graphics theory focuses on:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Correctness of specific effects (such as refraction of transparent objects, water rendering, hair algorithms, etc.)&lt;/li&gt;
&lt;li&gt;Mathematical precision of algorithms, without considering hardware implementation details&lt;/li&gt;
&lt;li&gt;A frame can take minutes or even days to render (offline rendering)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Four major challenges faced by game engine rendering:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;All-in-One complexity: a scene must simultaneously handle thousands of objects with different effects such as water, vegetation, hair, skin, and clouds, and all algorithms must be integrated into one container and work together.&lt;/li&gt;
&lt;li&gt;Deep hardware adaptation: algorithms must run efficiently on contemporary hardware (PC, console, mobile devices), requiring an in-depth understanding of GPU architecture.&lt;/li&gt;
&lt;li&gt;Fixed budget constraints: must complete within a strict time budget (30fps ≈ 33ms/frame, 60fps ≈ 16ms/frame, esports requires 120fps+). Whether the scene is a small enclosed room or an open city, the frame rate must remain stable, and &amp;ldquo;frame drops when opening a door&amp;rdquo; must never happen.&lt;/li&gt;
&lt;li&gt;Limited resources: the rendering system usually can only use 10–20% of CPU resources, with the rest left for game logic, physics, networking, and other systems.
Therefore, the rendering system of a game engine is an engineering practice science, a heavily optimized software system iterated and optimized by the industry over the past 30 years, rather than a pure theoretical model.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Therefore, the rendering system of a game engine is an engineering practice science, a heavily optimized software system iterated and optimized by the industry over the past 30 years, rather than a pure theoretical model.&lt;/p&gt;
&lt;h3 id="basic-render-pipeline"&gt;&lt;a href="#basic-render-pipeline" class="header-anchor"&gt;&lt;/a&gt;Basic Render Pipeline
&lt;/h3&gt;&lt;blockquote&gt;
&lt;p&gt;The process of turning data into a visible image:&lt;br&gt;
Vertex $\rightarrow$ Face $\rightarrow$ Projection Matrix $\rightarrow$ Rasterized Pixel $\rightarrow$ Material/Texture $\rightarrow$ Image&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;img src="https://r2.boiltask.com/2026/01/eede983c0252f5a3ec33b7d43ee85a0e.png"
loading="lazy"
alt="image-20260127164820371"
&gt;&lt;/p&gt;
&lt;p&gt;The entire rendering module is divided into four parts:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Fundamentals&lt;/strong&gt;: basic concepts such as GPU hardware architecture, rendering data management, and visibility culling&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Lighting and Materials&lt;/strong&gt;: modern lighting models (IBL), PBR material systems, and the Shader model&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Subsystems&lt;/strong&gt;: terrain system, sky system, post-processing system, etc.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Render Pipeline&lt;/strong&gt;: advanced pipeline designs such as Deferred Shading&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="gpu-architecture-fundamentals-understanding-hardware-is-a-prerequisite-for-optimization"&gt;&lt;a href="#gpu-architecture-fundamentals-understanding-hardware-is-a-prerequisite-for-optimization" class="header-anchor"&gt;&lt;/a&gt;GPU Architecture Fundamentals: Understanding Hardware Is a Prerequisite for Optimization
&lt;/h2&gt;&lt;p&gt;To become an excellent graphics programmer, one must deeply understand GPU architecture. The design philosophies of modern GPUs and CPUs are completely different.&lt;/p&gt;
&lt;p&gt;CPU: Each core is powerful, and there are few cores; suitable for complex computational tasks such as game logic and physics simulation.&lt;br&gt;
GPU: Each core is weaker, and there are many cores; suitable for large-scale parallel computation such as pixel rendering.&lt;/p&gt;
&lt;h3 id="gpu-parallel-architecture-characteristics"&gt;&lt;a href="#gpu-parallel-architecture-characteristics" class="header-anchor"&gt;&lt;/a&gt;GPU Parallel Architecture Characteristics
&lt;/h3&gt;&lt;p&gt;The core characteristic of modern GPUs is &lt;strong&gt;large-scale parallel computing&lt;/strong&gt;, with a large number of small cores. This architecture determines the design philosophy of the rendering system:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Data parallelism first&lt;/strong&gt;: decompose complex tasks into a large number of simple, uniform computational units&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Move computation forward&lt;/strong&gt;: shift operations from the CPU to the GPU as much as possible&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Batching mindset&lt;/strong&gt;: reduce Draw Calls and set up once for multiple reuses&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="simd-and-simt-architectures"&gt;&lt;a href="#simd-and-simt-architectures" class="header-anchor"&gt;&lt;/a&gt;SIMD and SIMT Architectures
&lt;/h3&gt;&lt;p&gt;SIMD (Single Instruction Multiple Data):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;One instruction processes multiple data items simultaneously (e.g., simultaneous operations on the XYZW of a 4D vector)&lt;/li&gt;
&lt;li&gt;Widely supported by modern CPUs as well (e.g., the SSE instruction set)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;SIMT (Single Instruction Multiple Threads):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The core idea of GPUs: make computational units very small but extremely numerous (thousands)&lt;/li&gt;
&lt;li&gt;One instruction can execute the same operation simultaneously on hundreds or thousands of cores&lt;/li&gt;
&lt;li&gt;Modern GPU compute power can reach 10+ TeraFLOPs, far exceeding CPUs (usually &amp;lt;1 TeraFLOP)&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;
&lt;p&gt;TeraFLOP: one trillion floating-point operations per second, $10^{12}$ floating-point operations (FLOP), $10^{15}$ double-precision floating-point operations (DFLOP)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3 id="modern-gpu-hardware-structure-using-nvidia-fermi-architecture-as-an-example"&gt;&lt;a href="#modern-gpu-hardware-structure-using-nvidia-fermi-architecture-as-an-example" class="header-anchor"&gt;&lt;/a&gt;Modern GPU Hardware Structure (Using NVIDIA Fermi Architecture as an Example)
&lt;/h3&gt;&lt;p&gt;A GPU consists of multiple GPCs (Graphics Processing Clusters), and each GPC contains:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;SM (Stream Multiprocessor): contains dozens of CUDA cores and performs mathematical operations&lt;/li&gt;
&lt;li&gt;Dedicated hardware units:
&lt;ul&gt;
&lt;li&gt;Texture Unit: dedicated to texture sampling (with filtering and Mipmap)&lt;/li&gt;
&lt;li&gt;SFU (Special Function Unit): handles complex mathematical operations such as trigonometric functions&lt;/li&gt;
&lt;li&gt;Tensor Core (after Ampere architecture): AI computation&lt;/li&gt;
&lt;li&gt;RT Core: ray tracing acceleration&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://r2.boiltask.com/2026/01/17ae9a58e54034d459c9dc77d0686ea4.png"
loading="lazy"
alt="image-20260127163232589"
&gt;&lt;/p&gt;
&lt;h3 id="memory-architecture-and-data-flow"&gt;&lt;a href="#memory-architecture-and-data-flow" class="header-anchor"&gt;&lt;/a&gt;Memory Architecture and Data Flow
&lt;/h3&gt;&lt;p&gt;Von Neumann architecture: computation and data are separated, resulting in relatively high data movement costs.&lt;/p&gt;
&lt;p&gt;Key concepts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;VRAM and memory: transfer from CPU memory to GPU VRAM is a major bottleneck, and the one-way data transfer principle must be followed (CPU→GPU, avoid readback as much as possible)&lt;/li&gt;
&lt;li&gt;Cache: key to modern computing performance. Accessing main memory may require 100+ clock cycles, while accessing cache takes only a few cycles
&lt;ul&gt;
&lt;li&gt;Cache Hit: data is in the cache, fast access&lt;/li&gt;
&lt;li&gt;Cache Miss: data is not in the cache, requiring a wait&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Bandwidth: a common bottleneck in rendering, including texture bandwidth, vertex bandwidth, etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="render-data-organization-from-logical-objects-to-drawable-entities"&gt;&lt;a href="#render-data-organization-from-logical-objects-to-drawable-entities" class="header-anchor"&gt;&lt;/a&gt;Render Data Organization: From Logical Objects to Drawable Entities
&lt;/h2&gt;&lt;p&gt;A GameObject in a game (such as a car or a character) is a logical object and cannot be drawn directly. It must be expressed through a Renderable (drawable object).&lt;/p&gt;
&lt;h3 id="composition-of-a-renderable"&gt;&lt;a href="#composition-of-a-renderable" class="header-anchor"&gt;&lt;/a&gt;Composition of a Renderable
&lt;/h3&gt;&lt;p&gt;To draw an object (Renderable), you generally need:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Mesh&lt;/strong&gt;: vertex data, triangle indices
&lt;ol&gt;
&lt;li&gt;Vertex Data: vertex position, normal, UV coordinates, etc.&lt;/li&gt;
&lt;li&gt;Index Data: triangle indices, reusing vertices to save memory (typically the number of vertices is about half the number of triangles)&lt;/li&gt;
&lt;li&gt;Triangle Strip: an optimized vertex storage method that improves cache friendliness&lt;/li&gt;
&lt;li&gt;
&lt;blockquote&gt;
&lt;p&gt;Important note: vertex normals must be stored separately and cannot simply be averaged from triangle face normals. For example, at the edges/corners of a cube, vertices at the same position need to store multiple normals in different directions.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Material&lt;/strong&gt;:
&lt;ol&gt;
&lt;li&gt;Expresses surface properties of objects (metal, plastic, stone, etc.)&lt;/li&gt;
&lt;li&gt;Modern engines use the PBR (Physically Based Rendering) model&lt;/li&gt;
&lt;li&gt;Note the distinction from Physics Material: the former is used for visuals, while the latter is used for physical properties such as friction coefficient and elasticity&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Texture&lt;/strong&gt;:
&lt;ol&gt;
&lt;li&gt;Materials reference textures for sampling; one material may reference multiple textures, and the same texture may be referenced by multiple materials&lt;/li&gt;
&lt;li&gt;Stores not only color (Albedo) but also roughness (Roughness), normal (Normal), metallic (Metallic), etc.&lt;/li&gt;
&lt;li&gt;Texture sampling is an expensive operation: a single sample requires accessing 8 pixels and performing 7 interpolations (considering Mipmap and bilinear filtering)&lt;/li&gt;
&lt;li&gt;
&lt;blockquote&gt;
&lt;p&gt;I already have a Texture, so why do I still need a Material?&lt;br&gt;
Because the GPU does not know:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Is this image color? Normal? Or roughness?&lt;/li&gt;
&lt;li&gt;Should it participate in lighting?&lt;/li&gt;
&lt;li&gt;Is it transparent or opaque?&lt;/li&gt;
&lt;li&gt;How should Gamma / Linear be handled?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Material tells the GPU how to interpret this image and how it should participate in computation&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Shader Code&lt;/strong&gt;:
&lt;ol&gt;
&lt;li&gt;A unique &amp;ldquo;code as data&amp;rdquo; existence: it is both source code and managed as a data asset&lt;/li&gt;
&lt;li&gt;Modern engines support Shader Graph, allowing artists to compose material logic like building blocks and automatically generate Shader code&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="submesh-the-key-to-resource-reuse"&gt;&lt;a href="#submesh-the-key-to-resource-reuse" class="header-anchor"&gt;&lt;/a&gt;SubMesh: The Key to Resource Reuse
&lt;/h3&gt;&lt;h4 id="submesh-concept"&gt;&lt;a href="#submesh-concept" class="header-anchor"&gt;&lt;/a&gt;SubMesh Concept
&lt;/h4&gt;&lt;p&gt;A face/patch may include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Vertices&lt;/li&gt;
&lt;li&gt;Orientation&lt;/li&gt;
&lt;li&gt;Color&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Different parts of a complex model (such as a soldier) (helmet, cloth, skin, weapon) require different materials.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://r2.boiltask.com/2026/01/9607113ef8ffab849070859b0c00e4c7.png"
loading="lazy"
alt="image-20260127182306364"
&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Why does every vertex need to store a normal instead of simply averaging the triangle face normals?&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The object surface is a continuous surface, not triangles; therefore, calculating from triangles will produce discontinuities.&lt;/li&gt;
&lt;li&gt;A pixel belongs to only one triangle and cannot know which surrounding faces exist.&lt;/li&gt;
&lt;li&gt;GPU interpolation is at the vertex level, so normals need to be recorded on vertices.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src="https://r2.boiltask.com/2026/01/510f23b535a6f2fdb71ee289aa4593be.png"
loading="lazy"
alt="image-20260127183531617"
&gt;&lt;/p&gt;
&lt;p&gt;Vertex normal = weighted average of adjacent triangle face normals (usually weighted by triangle area), then normalized&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Split a Mesh into multiple SubMeshes by material&lt;/li&gt;
&lt;li&gt;All SubMeshes share the same Vertex Buffer / Index Buffer, but each records its own Offset (&lt;strong&gt;offset&lt;/strong&gt;) range&lt;/li&gt;
&lt;li&gt;Each SubMesh corresponds to a specific material, texture, and Shader&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;Memory efficiency: multiple objects share the same geometry data&lt;/li&gt;
&lt;li&gt;Rendering optimization: batch render after sorting by material, reducing state changes&lt;/li&gt;
&lt;li&gt;Industry standard: mainstream engines such as Unreal Engine use similar structures&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="resource-pool-design"&gt;&lt;a href="#resource-pool-design" class="header-anchor"&gt;&lt;/a&gt;Resource Pool Design
&lt;/h4&gt;&lt;p&gt;Modern engines solve data redundancy through resource pools:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Mesh Pool&lt;/strong&gt;: centrally manages all mesh data&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Texture Pool&lt;/strong&gt;: textures are shared across objects (e.g., skins and clothing for multiplayer characters)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Material Pool&lt;/strong&gt;: material instancing system&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="rendering-optimization-strategies"&gt;&lt;a href="#rendering-optimization-strategies" class="header-anchor"&gt;&lt;/a&gt;Rendering Optimization Strategies
&lt;/h4&gt;&lt;ul&gt;
&lt;li&gt;Material sorting: group SubMeshes with the same material to reduce GPU state change overhead&lt;/li&gt;
&lt;li&gt;Instance: for identical geometry (such as minions or trees), store only one Definition and draw multiple copies through instance data (position, rotation, etc.)&lt;/li&gt;
&lt;li&gt;GPU-based Batch Rendering: modern engines use GPU compute shaders to handle the drawing of large numbers of identical objects at once, further reducing CPU submission overhead&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="gpu-based-batch-rendering"&gt;&lt;a href="#gpu-based-batch-rendering" class="header-anchor"&gt;&lt;/a&gt;GPU Based Batch Rendering
&lt;/h3&gt;&lt;p&gt;For large numbers of repeated objects (trees, grass, buildings), the traditional approach requires setting VBO/IBO once per object. Modern techniques use &lt;strong&gt;Computer Shader&lt;/strong&gt; to achieve:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Render hundreds of instances in a single Draw Call&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;GPU-side instancing&lt;/strong&gt;: pass transform data as a buffer, and the GPU computes the final position of each instance in parallel&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Applicable scenarios&lt;/strong&gt;: large-scale vegetation, building clusters, particle systems&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="migrating-computation-from-cpu-to-gpu"&gt;&lt;a href="#migrating-computation-from-cpu-to-gpu" class="header-anchor"&gt;&lt;/a&gt;Migrating Computation from CPU to GPU
&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;Core idea&lt;/strong&gt;: migrate complex operations originally handled by the CPU to the GPU&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Animation system: GPU-based skeletal animation computation&lt;/li&gt;
&lt;li&gt;Physics simulation: particle and cloth simulation&lt;/li&gt;
&lt;li&gt;Visibility determination: Occlusion Query, Frustum Culling&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Performance advantage&lt;/strong&gt;: GPU parallel compute power is usually more than 10× that of the CPU, making it suitable for large-scale data.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="visibility-culling"&gt;&lt;a href="#visibility-culling" class="header-anchor"&gt;&lt;/a&gt;Visibility Culling
&lt;/h2&gt;&lt;p&gt;The highest level of rendering optimization: &lt;strong&gt;&amp;ldquo;Do Nothing&amp;rdquo;&lt;/strong&gt; — use algorithms to make the computer do as little work as possible.&lt;/p&gt;
&lt;h3 id="basic-culling-methods"&gt;&lt;a href="#basic-culling-methods" class="header-anchor"&gt;&lt;/a&gt;Basic Culling Methods
&lt;/h3&gt;&lt;h4 id="view-frustum-culling"&gt;&lt;a href="#view-frustum-culling" class="header-anchor"&gt;&lt;/a&gt;View Frustum Culling
&lt;/h4&gt;&lt;p&gt;Use a Bounding Volume to quickly determine whether an object is inside the camera frustum&lt;/p&gt;
&lt;p&gt;Bounding volume types:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Bounding Sphere: fastest test, but loose bounds&lt;/li&gt;
&lt;li&gt;AABB (Axis-Aligned Bounding Box): axis-aligned bounding box; only two vertices need to be stored, and computation efficiency is extremely high&lt;/li&gt;
&lt;li&gt;OBB (Object-Oriented Bounding Box): object-aligned bounding box; fits more tightly but is more complex to compute&lt;/li&gt;
&lt;li&gt;Convex Hull: commonly used in physics computation&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://r2.boiltask.com/2026/01/7b44e02361e6880496fc935ac5b50877.png"
loading="lazy"
alt="image-20260128105845049"
&gt;&lt;/p&gt;
&lt;h4 id="spatial-acceleration-structures"&gt;&lt;a href="#spatial-acceleration-structures" class="header-anchor"&gt;&lt;/a&gt;Spatial Acceleration Structures
&lt;/h4&gt;&lt;ul&gt;
&lt;li&gt;Quadtree/Octree: suitable for large static scenes&lt;/li&gt;
&lt;li&gt;BVH (Bounding Volume Hierarchy): tree structure, suitable for dynamic scenes (FPS games with frequent object movement)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="bvh-bounding-volume-hierarchy"&gt;&lt;a href="#bvh-bounding-volume-hierarchy" class="header-anchor"&gt;&lt;/a&gt;BVH (Bounding Volume Hierarchy)
&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;Applicable scenarios&lt;/strong&gt;: scenes with many dynamic objects (such as large numbers of units in RTS games)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Principle&lt;/strong&gt;:&lt;/p&gt;
&lt;div class="highlight-wrapper"&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;span class="lnt"&gt;3
&lt;/span&gt;&lt;span class="lnt"&gt;4
&lt;/span&gt;&lt;span class="lnt"&gt;5
&lt;/span&gt;&lt;span class="lnt"&gt;6
&lt;/span&gt;&lt;span class="lnt"&gt;7
&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-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;根节点（整个场景）
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── 子节点1（建筑区域）
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│ ├── 叶节点：建筑A
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│ └── 叶节点：建筑B
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;└── 子节点2（单位区域）
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; ├── 叶节点：士兵1
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; └── 叶节点：士兵2&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;ul&gt;
&lt;li&gt;&lt;strong&gt;Hierarchical bounding boxes&lt;/strong&gt;: test from top to bottom; cull entire branches of invisible nodes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Dynamic rebuild&lt;/strong&gt;: BVH has low rebuild cost when objects move, making it suitable for dynamic scenes&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="pvs-potential-visibility-set"&gt;&lt;a href="#pvs-potential-visibility-set" class="header-anchor"&gt;&lt;/a&gt;PVS (Potential Visibility Set)
&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;Origin of the idea&lt;/strong&gt;: John Carmack&amp;rsquo;s pioneering work in Doom/Quake&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Core principle&lt;/strong&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Divide space into &lt;strong&gt;Cells&lt;/strong&gt; (rooms) connected by &lt;strong&gt;Portals&lt;/strong&gt; (doors/windows)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Precomputation&lt;/strong&gt;: each Cell records which other Cells are visible from that position through Portals&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Runtime&lt;/strong&gt;: only render objects in the PVS of the current Cell&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Modern application extensions&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Level Streaming&lt;/strong&gt;: open worlds load by Zone&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Resource preloading&lt;/strong&gt;: use PVS to predict the area the player is about to enter and asynchronously load resources in advance&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Although pure PVS culling is rarely used now, its ideas guide resource scheduling&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="gpu-based-culling"&gt;&lt;a href="#gpu-based-culling" class="header-anchor"&gt;&lt;/a&gt;GPU Based Culling
&lt;/h3&gt;&lt;p&gt;Modern hardware performance allows some culling to be done directly on the GPU, using GPU parallel computing capability to parallelize bounding-box tests for thousands of objects.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Occlusion Query&lt;/strong&gt;: the GPU returns a visibility 0/1 array&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Early-Z / Hi-Z&lt;/strong&gt;: hardware-level depth testing; occluded pixels do not execute the Fragment Shader&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Compute Shader Hierarchy&lt;/strong&gt;: build BVH on the GPU and cull in parallel&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="texture-compression-technology"&gt;&lt;a href="#texture-compression-technology" class="header-anchor"&gt;&lt;/a&gt;Texture Compression Technology
&lt;/h2&gt;&lt;p&gt;Texture compression is an important module of the engine resource system and directly affects VRAM bandwidth and loading performance.&lt;/p&gt;
&lt;h3 id="texture-compression-formats"&gt;&lt;a href="#texture-compression-formats" class="header-anchor"&gt;&lt;/a&gt;Texture Compression Formats
&lt;/h3&gt;&lt;p&gt;The special requirements of game engines differ from ordinary image compression (JPEG); texture compression must support:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Random access&lt;/strong&gt;: quickly read any texel&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Real-time decompression&lt;/strong&gt;: extremely low decompression overhead&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Fixed compression ratio&lt;/strong&gt;: predictable VRAM usage&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="block-based-compression"&gt;&lt;a href="#block-based-compression" class="header-anchor"&gt;&lt;/a&gt;Block-based Compression
&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;Core idea&lt;/strong&gt;: split the texture into 4×4 or larger blocks and compress each block independently.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Split the texture into small 4×4 pixel blocks&lt;/li&gt;
&lt;li&gt;Record the maximum and minimum colors within the block; other pixels store interpolation ratios&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;DXT/BC series&lt;/strong&gt; (PC/console): DXT1/3/5, BC1-7, supporting real-time compression/decompression&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;ASTC (mobile devices)&lt;/strong&gt;: supports non-square blocks (such as 4×4, 6×6, 8×8), with higher compression ratios but more complex compression computation&lt;/p&gt;
&lt;h2 id="asset-production-pipeline"&gt;&lt;a href="#asset-production-pipeline" class="header-anchor"&gt;&lt;/a&gt;Asset Production Pipeline
&lt;/h2&gt;&lt;p&gt;Modern game assets come from diverse sources, driving advances in rendering technology:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Production Method&lt;/th&gt;
&lt;th&gt;Tools&lt;/th&gt;
&lt;th&gt;Advantages&lt;/th&gt;
&lt;th&gt;Disadvantages&lt;/th&gt;
&lt;th&gt;Applicable Scenarios&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Manual Modeling&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;3D Max, Maya, Blender&lt;/td&gt;
&lt;td&gt;Precise modeling based on points, lines, and faces; flexible and controllable&lt;/td&gt;
&lt;td&gt;Time-consuming and labor-intensive&lt;/td&gt;
&lt;td&gt;Machinery, architecture&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Sculpting&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;ZBrush&lt;/td&gt;
&lt;td&gt;Freely add details like sculpting; highly unrestricted&lt;/td&gt;
&lt;td&gt;Difficult to parameterize&lt;/td&gt;
&lt;td&gt;Characters, creatures&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;3D Scanning&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;RealityCapture&lt;/td&gt;
&lt;td&gt;Acquired through photogrammetry; ultra-high precision&lt;/td&gt;
&lt;td&gt;Requires a physical prototype&lt;/td&gt;
&lt;td&gt;Artifacts, realistic props&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Procedural Generation&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Houdini, AI&lt;/td&gt;
&lt;td&gt;Automatically generated based on algorithms; efficient at scale&lt;/td&gt;
&lt;td&gt;Difficult to control&lt;/td&gt;
&lt;td&gt;Terrain, vegetation&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;Trend&lt;/strong&gt;: AI generation technology frees artists from tedious details so they can focus on creativity itself.&lt;/p&gt;
&lt;h2 id="development-directions-of-modern-render-pipelines"&gt;&lt;a href="#development-directions-of-modern-render-pipelines" class="header-anchor"&gt;&lt;/a&gt;Development Directions of Modern Render Pipelines
&lt;/h2&gt;&lt;p&gt;Technology keeps advancing, and render pipelines are also evolving, requiring developers to keep learning.&lt;/p&gt;
&lt;h3 id="cluster-based-mesh-pipeline"&gt;&lt;a href="#cluster-based-mesh-pipeline" class="header-anchor"&gt;&lt;/a&gt;Cluster Based Mesh Pipeline
&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;Driving force&lt;/strong&gt;: open worlds cause data volume to grow more than 10×, and traditional pipelines (CPU prepares vertex data → submits to GPU) cannot handle it.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Core idea&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Split high-detail models into &lt;strong&gt;fixed-size Meshlets&lt;/strong&gt; (32–64 triangles)&lt;/li&gt;
&lt;li&gt;Mesh Shader: the GPU &amp;ldquo;conjures&amp;rdquo; geometric detail from algorithms and data, without the CPU pre-preparing vertex Buffers&lt;/li&gt;
&lt;li&gt;Amplification Shader: determines which Meshlets need subdivision (distance-based LOD) or culling&lt;/li&gt;
&lt;li&gt;GPU-driven: all culling, LOD selection, and rejection are completed entirely on the GPU, and the CPU only submits high-level commands&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;Supports pixel-level geometric density (such as Nanite in Unreal Engine)&lt;/li&gt;
&lt;li&gt;Fine-grained culling: can cull just one hand of a monster instead of the entire model&lt;/li&gt;
&lt;li&gt;Artists do not need to consider the polygon budget and can freely use models with hundreds of millions of triangles&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Representative technologies&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Ubisoft 2015&lt;/strong&gt;: &lt;em&gt;Assassin&amp;rsquo;s Creed Unity&lt;/em&gt; was the first to apply Cluster Based Mesh Pipeline at scale&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Unreal Engine 5&lt;/strong&gt;: Nanite virtual geometry technology, achieving &amp;ldquo;pixel-level mesh density&amp;rdquo;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Requirements for developers&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Deeper understanding of GPU architecture&lt;/li&gt;
&lt;li&gt;More complex Shader programming models&lt;/li&gt;
&lt;li&gt;But in exchange for ultimate detail expressiveness&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="pipeline-evolution-summary"&gt;&lt;a href="#pipeline-evolution-summary" class="header-anchor"&gt;&lt;/a&gt;Pipeline Evolution Summary
&lt;/h3&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Stage&lt;/th&gt;
&lt;th&gt;Technology&lt;/th&gt;
&lt;th&gt;Characteristics&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Traditional Pipeline&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;VS+PS&lt;/td&gt;
&lt;td&gt;Prebuilt Vertex/Index Buffer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Intermediate Pipeline&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Hull/Domain/Geometry Shader&lt;/td&gt;
&lt;td&gt;GPU-side geometry subdivision&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Modern Pipeline&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Mesh Shader&lt;/td&gt;
&lt;td&gt;Fully GPU-driven, dynamically generates geometry&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id="summary-of-the-core-cognitive-framework"&gt;&lt;a href="#summary-of-the-core-cognitive-framework" class="header-anchor"&gt;&lt;/a&gt;Summary of the Core Cognitive Framework
&lt;/h2&gt;&lt;h3 id="four-core-concepts"&gt;&lt;a href="#four-core-concepts" class="header-anchor"&gt;&lt;/a&gt;Four Core Concepts
&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Hardware-driven thinking&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Rendering is an engineering science that deeply depends on understanding GPU architecture&lt;/li&gt;
&lt;li&gt;Be familiar with the language of &amp;ldquo;performance bottlenecks&amp;rdquo;: bandwidth, fill rate, ALU utilization&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Data relationship thinking&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The core is resolving the relationships among Mesh, SubMesh, material, and Shader&lt;/li&gt;
&lt;li&gt;Instancing is a general pattern for resource management (sound, particles, vegetation)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Extreme culling thinking&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Optimization = making the computer do the least work (the Do Nothing philosophy)&lt;/li&gt;
&lt;li&gt;Visibility is the first factor in rendering performance&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;GPU Responsibility thinking&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;GPU Driven&lt;/strong&gt;: migrate CPU logic to the GPU&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Future trend&lt;/strong&gt;: animation, physics, and AI fully GPU-ified&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="advice-for-developers"&gt;&lt;a href="#advice-for-developers" class="header-anchor"&gt;&lt;/a&gt;Advice for Developers
&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Render pipeline selection&lt;/strong&gt;: in-house engines should follow industry standards and avoid excessive innovation that makes maintenance difficult&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Debugging methodology&lt;/strong&gt;:
&lt;ul&gt;
&lt;li&gt;Graphics debugging is extremely difficult (second only to server debugging)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Step-by-step verification&lt;/strong&gt;: split the algorithm into multiple steps and verify each step separately&lt;/li&gt;
&lt;li&gt;Use vendor tools: NVIDIA NSight, AMD Radeon GPU Profiler&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Learning path&lt;/strong&gt;: first read the code and set breakpoints to understand the flow, then start modifying it&lt;/li&gt;
&lt;/ol&gt;
&lt;hr&gt;
&lt;p&gt;The game engine rendering system is a bridge connecting hardware and art; it requires both solid engineering ability and a sense of aesthetics. Understand hardware, optimize data, cull to the extreme, and embrace the GPU—these four principles will run through the entire rendering module. The next lesson will dive into lighting models and the PBR material system, exploring how to make the image &amp;ldquo;look like the real deal.&amp;rdquo;&lt;/p&gt;
&lt;p&gt;The game engine rendering system is a highly practical engineering endeavor—it does not pursue theoretical optimality, but rather finds the best balance among hardware limitations, development efficiency, and image quality.&lt;/p&gt;
&lt;h2 id="reference-information"&gt;&lt;a href="#reference-information" class="header-anchor"&gt;&lt;/a&gt;Reference Information
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;a class="link" href="https://www.bilibili.com/video/BV14r4y1p7tt" target="_blank" rel="noopener"&gt;Rendering in Game Engines | GAMES104-Modern Game Engine: From Beginner to Practice&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Fundamentals of Computer Graphics - Computer Graphics Review Notes</title><link>https://boiltask.com/en/note/computer-graphics-opengl/</link><pubDate>Mon, 30 Apr 2018 00:00:00 +0800</pubDate><guid>https://boiltask.com/en/note/computer-graphics-opengl/</guid><description>&lt;blockquote&gt;
&lt;p&gt;Reference: &lt;em&gt;Fundamentals of Computer Graphics (OpenGL Edition)&lt;/em&gt; and online materials.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="chapter-1"&gt;&lt;a href="#chapter-1" class="header-anchor"&gt;&lt;/a&gt;Chapter 1
&lt;/h2&gt;&lt;h3 id="what-is-computer-graphics-and-what-does-it-mainly-study"&gt;&lt;a href="#what-is-computer-graphics-and-what-does-it-mainly-study" class="header-anchor"&gt;&lt;/a&gt;What is computer graphics, and what does it mainly study?
&lt;/h3&gt;&lt;p&gt;Computer graphics is a discipline that studies converting data into graphics with computers and displaying and processing them on dedicated devices. It focuses on the principles, methods, and techniques of graphics generation and processing, and is a new multi-disciplinary applied technology.&lt;/p&gt;
&lt;p&gt;It covers graphics theory, applied mathematics, computer science, and other disciplines.&lt;/p&gt;
&lt;p&gt;Main research content:&lt;/p&gt;
&lt;p&gt;Centered on: software and hardware technology in the graphics processing pipeline, and the accuracy, realism, and real-time performance of representing graphics and images.&lt;/p&gt;
&lt;p&gt;Includes: the research content is divided into nine directions.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Device-based basic graphics generation algorithms, such as lines and arcs;&lt;/li&gt;
&lt;li&gt;Clipping and geometric transformation techniques for graphics primitives;&lt;/li&gt;
&lt;li&gt;Curve and surface processing techniques: interpolation, approximation, joining, and decomposition;&lt;/li&gt;
&lt;li&gt;3D geometric modeling techniques;&lt;/li&gt;
&lt;li&gt;Real-time display of 3D shapes and parallel graphics processing techniques;&lt;/li&gt;
&lt;li&gt;Photorealistic image generation techniques and simulation systems;&lt;/li&gt;
&lt;li&gt;Simulation and generation techniques for random shapes or fuzzy scenes;&lt;/li&gt;
&lt;li&gt;Generation and control techniques for virtual reality environments;&lt;/li&gt;
&lt;li&gt;Visualization techniques for 3D or high-dimensional data fields.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="what-are-the-constituent-elements-and-representation-methods-of-graphics"&gt;&lt;a href="#what-are-the-constituent-elements-and-representation-methods-of-graphics" class="header-anchor"&gt;&lt;/a&gt;What are the constituent elements and representation methods of graphics?
&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;Constituent elements of graphics
&lt;ul&gt;
&lt;li&gt;Geometric elements: describe the contour, shape, etc. of an object;&lt;/li&gt;
&lt;li&gt;Non-geometric elements: describe the color, material, etc. of an object.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Representation methods of graphics
&lt;ul&gt;
&lt;li&gt;Raster representation: enumerate all points in the graphic, referred to as an image;&lt;/li&gt;
&lt;li&gt;Parametric representation: shape parameters + attribute parameters, referred to as a graphic.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="chapter-2"&gt;&lt;a href="#chapter-2" class="header-anchor"&gt;&lt;/a&gt;Chapter 2
&lt;/h2&gt;&lt;h3 id="briefly-summarize-the-tasks-content-and-characteristics-of-the-three-stages-of-graphics-system-architecture"&gt;&lt;a href="#briefly-summarize-the-tasks-content-and-characteristics-of-the-three-stages-of-graphics-system-architecture" class="header-anchor"&gt;&lt;/a&gt;Briefly summarize the tasks, content, and characteristics of the three stages of graphics system architecture.
&lt;/h3&gt;&lt;p&gt;The three stages of graphics system architecture: the application stage, the geometry processing stage, and the pixel processing stage.&lt;/p&gt;
&lt;p&gt;Application stage: provides data to graphics hardware in the form of primitives, and also provides images or bitmaps used for surface texture mapping. Developers have full control over what happens in this stage and can change actual performance by changing the implementation method. At the end of the application stage, the geometry to be drawn is fed into the next stage of the rendering pipeline.&lt;/p&gt;
&lt;p&gt;Geometry processing stage: the process of processing geometric primitives on a per-vertex basis and transforming them from 3D coordinates to 2D screen coordinates. The geometry processing stage is mainly responsible for most polygon and vertex operations, and can be divided into several functional stages such as model and viewing transformations, lighting, projection, clipping, and screen mapping. Depending on the specific implementation, this stage may or may not be equivalent to a pipeline pass. The geometry processing stage performs highly computation-intensive tasks.&lt;/p&gt;
&lt;p&gt;Pixel processing stage: screen objects are first sent to the pixel processor for rasterization, then each pixel is shaded, and then output to the framebuffer, and finally output to the display. After primitives are sent through the raster stage, what is seen from the camera viewpoint can be displayed on the screen. These primitives can be drawn with a suitable shading model, and if texture techniques are applied, texture effects will be displayed. Unlike the polygon operations performed in the geometry stage, the raster stage performs per-pixel operations. For high-performance graphics systems, the raster stage must be completed in hardware.&lt;/p&gt;
&lt;h3 id="from-the-perspective-of-graphics-hardware-display-principles-think-about-and-analyze-how-to-display-a-straight-line"&gt;&lt;a href="#from-the-perspective-of-graphics-hardware-display-principles-think-about-and-analyze-how-to-display-a-straight-line" class="header-anchor"&gt;&lt;/a&gt;From the perspective of graphics hardware display principles, think about and analyze how to display a straight line.
&lt;/h3&gt;&lt;p&gt;When the electron beam scans to the position (coordinates) of a certain pixel on the screen, the processor DPU in the display simultaneously retrieves the pixel value from the corresponding display buffer unit, uses it to look up the address in the color table, obtains the red, green, and blue components of the pixel from that address, and after D/A conversion controls the three primary-color electron guns respectively, so that the pixel on the screen displays the mixed color of the three primary colors. To display a straight line, it is only necessary to find all points that satisfy the equation of the line according to the line equation, and fully display on the screen the graphic drawn by the computer.&lt;/p&gt;
&lt;h3 id="what-parts-does-a-computer-graphics-system-consist-of-and-what-functions-does-each-implement"&gt;&lt;a href="#what-parts-does-a-computer-graphics-system-consist-of-and-what-functions-does-each-implement" class="header-anchor"&gt;&lt;/a&gt;What parts does a computer graphics system consist of, and what functions does each implement?
&lt;/h3&gt;&lt;p&gt;It consists of graphics software and graphics hardware. Hardware devices are the material basis for the existence and development of computer graphics, and mainly consist of a central host (graphics display processor), graphics input devices, and graphics output devices. Graphics software is divided into three parts: graphics application software, graphics support software, and graphics application data structures, and interfaces with external graphics devices. The three are interconnected, call each other, and support each other, forming the software part of the graphics system.&lt;/p&gt;
&lt;h3 id="what-are-the-commonly-used-graphics-input-and-output-devices-what-are-their-characteristics"&gt;&lt;a href="#what-are-the-commonly-used-graphics-input-and-output-devices-what-are-their-characteristics" class="header-anchor"&gt;&lt;/a&gt;What are the commonly used graphics input and output devices? What are their characteristics?
&lt;/h3&gt;&lt;p&gt;Locator devices: implement the positioning function, that is, input the coordinates of a point, including light pens, digitizers, mice, and numeric keys on keyboards.&lt;/p&gt;
&lt;p&gt;Stroke devices: implement the stroke function, input a series of point coordinates; their physical devices are the same as locator devices.&lt;/p&gt;
&lt;p&gt;Valuator devices: implement the value-setting function, including knobs, numeric keys, direction keys, and programmable function keys.&lt;/p&gt;
&lt;p&gt;Choice devices: obtain a certain choice according to a positive integer, including light pens, touchpads, digitizers, and mice.&lt;/p&gt;
&lt;p&gt;Pick devices: implement the picking function, that is, identify a displayed graphics element, including various locator devices, programmable function keys, and string input devices.&lt;/p&gt;
&lt;p&gt;String devices: implement string input, including keyboards, light pens, and voice recognition devices.&lt;/p&gt;
&lt;p&gt;Graphics display devices: display devices such as liquid crystal displays that display graphics.&lt;/p&gt;
&lt;p&gt;Graphics drawing devices: output devices such as printers and plotters that output visualizations and can preserve graphics for a long time.&lt;/p&gt;
&lt;h3 id="how-many-layers-is-graphics-software-divided-into-what-are-the-characteristics-of-each-layer"&gt;&lt;a href="#how-many-layers-is-graphics-software-divided-into-what-are-the-characteristics-of-each-layer" class="header-anchor"&gt;&lt;/a&gt;How many layers is graphics software divided into? What are the characteristics of each layer?
&lt;/h3&gt;&lt;p&gt;The software system consists of layer-0 graphics software (drivers, interface programs), layer-1 graphics software (basic subroutines), layer-2 graphics software (general programs), and layer-3 graphics software (application programs). Layers zero through two are called basic graphics software or support software; layer three and above are application graphics software.&lt;/p&gt;
&lt;p&gt;Graphics support software can generally be divided into the following three levels. The first level is system-oriented and is the lowest-level software, also called device drivers. It mainly addresses issues such as the communication interface between graphics devices and computers, and includes some of the most basic input and output programs. The second level is both system-oriented and user-oriented. It is built on top of device drivers and is also called basic subroutines, including program modules such as primitive generation and device management. The third level is user-oriented and is written on the basis of basic subroutines; it is also called functional subroutines, and its main task is to establish graphics data structures, define, modify, and output graphics.&lt;/p&gt;
&lt;h3 id="be-familiar-with-the-structure-of-a-raster-scan-display-system"&gt;&lt;a href="#be-familiar-with-the-structure-of-a-raster-scan-display-system" class="header-anchor"&gt;&lt;/a&gt;Be familiar with the structure of a raster scan display system.
&lt;/h3&gt;&lt;p&gt;The logical composition of a raster scan display system mainly consists of three parts: the display, the video controller, and the framebuffer memory. The classic structure of early raster scan display systems: CPU, system main memory, display controller, display. The framebuffer can be located anywhere in system main memory, and the display controller accesses the framebuffer to refresh the screen. However, at this time the display controller must access the framebuffer through the system bus, so the bus becomes the main bottleneck of the system. Currently commonly used: CPU, system main memory-framebuffer, display controller, display. The framebuffer is directly accessed by the display controller; it can use either a fixed area of system main memory or dedicated display memory. The computational load of scan conversion is considerable and increases the burden on the CPU. In addition to the framebuffer and display controller, an advanced raster graphics system structure also includes a display processor and independent display processor memory.&lt;/p&gt;
&lt;h3 id="understand-the-meanings-of-common-terms-such-as-resolution-framebuffer-pixel-and-image-distance"&gt;&lt;a href="#understand-the-meanings-of-common-terms-such-as-resolution-framebuffer-pixel-and-image-distance" class="header-anchor"&gt;&lt;/a&gt;Understand the meanings of common terms such as resolution, framebuffer, pixel, and image distance.
&lt;/h3&gt;&lt;p&gt;Resolution: the total number of pixels on the display screen, divided into horizontal resolution and vertical resolution, commonly expressed by the number of pixels on the screen. The higher the resolution, the smaller the image distance, and the clearer the displayed characters or images.&lt;/p&gt;
&lt;p&gt;Framebuffer: framebuffer memory, abbreviated as framebuffer or video memory, is a direct image of the picture displayed on the screen, also called a bitmap or raster. The framebuffer is a contiguous block of computer memory used to store graphics and image information for dynamic refresh. Each storage unit of the framebuffer corresponds to one pixel on the screen, and the entire framebuffer corresponds to one frame of image.&lt;/p&gt;
&lt;p&gt;Pixel: in a raster scan graphics display, the smallest unit on the screen that can be lit or turned off.&lt;/p&gt;
&lt;p&gt;Image distance: the distance from the image to the screen.&lt;/p&gt;
&lt;p&gt;Horizontal frequency, frame frequency: the horizontal scanning frequency is the horizontal frequency. The vertical scanning frequency is the frame frequency.&lt;/p&gt;
&lt;p&gt;Interlaced scanning: scan the even-numbered scan lines first, then the odd-numbered scan lines.&lt;/p&gt;
&lt;p&gt;Display speed: the speed of displaying characters, graphics, and images.&lt;/p&gt;
&lt;p&gt;Dot pitch: the dot pitch of an LCD is the distance between two liquid crystal particles, that is, the width or height of the liquid crystal panel divided by the number of horizontal or vertical pixels.&lt;/p&gt;
&lt;p&gt;Refresh rate: in an LCD, each pixel continuously emits light under a certain signal (voltage) until another signal (voltage) arrives, at which point the luminous intensity changes. Therefore, LCDs actually do not have a refresh rate problem.&lt;/p&gt;
&lt;p&gt;Viewing angle: the visible angle.&lt;/p&gt;
&lt;p&gt;Response time: an excessively long response time will cause ghosting when the picture changes rapidly.&lt;/p&gt;
&lt;p&gt;Brightness: brightness refers to the degree of brightness of the picture; the maximum brightness is usually determined by the backlight.&lt;/p&gt;
&lt;p&gt;Contrast ratio: the ratio of the brightness of the same point on the screen when it is brightest (white) to when it is darkest (black). High contrast means relatively high brightness and vividness.&lt;/p&gt;
&lt;h2 id="chapter-3"&gt;&lt;a href="#chapter-3" class="header-anchor"&gt;&lt;/a&gt;Chapter 3
&lt;/h2&gt;&lt;h3 id="briefly-describe-the-algorithmic-ideas-of-the-dda-algorithm-the-midpoint-line-algorithm-and-the-bresenham-algorithm"&gt;&lt;a href="#briefly-describe-the-algorithmic-ideas-of-the-dda-algorithm-the-midpoint-line-algorithm-and-the-bresenham-algorithm" class="header-anchor"&gt;&lt;/a&gt;Briefly describe the algorithmic ideas of the DDA algorithm, the midpoint line algorithm, and the Bresenham algorithm.
&lt;/h3&gt;&lt;p&gt;The DDA algorithm is called the digital differential analyzer line drawing algorithm. According to the degree of slope deviation, it decides whether to use x or y as the stepping direction. Then, in the corresponding stepping direction, the step vector increases by one pixel each time, and the other related coordinate variable can also be obtained from the slope.&lt;/p&gt;
&lt;p&gt;The midpoint line algorithm assumes that the line slope k is between 0 and 1, and the current pixel point is (xp, yp). Then the next pixel point has two possible choices: P1 (xp+1, yp) or P2 (xp+1, yp+1). If the midpoint of P1 and P2, (xp+1, yp+0.5), is called M, and Q is the intersection of the ideal line with the vertical line x=xp+1, then when M is below Q, P2 should be taken as the next pixel point; when M is above Q, P1 should be taken as the next pixel point. Other slopes are handled similarly.&lt;/p&gt;
&lt;p&gt;The Bresenham algorithm constructs a set of virtual grid lines through the centers of pixels in each row and column, computes the intersections of the line with each vertical grid line in order from the start point to the end point, and then determines the pixel in that column closest to the intersection. Incremental computation can be used, so that for each column, it is only necessary to check the sign of an error term to determine the pixel sought in that column.&lt;/p&gt;
&lt;h3 id="write-out-the-process-of-the-bresenham-line-drawing-algorithm-or-draw-its-flowchart"&gt;&lt;a href="#write-out-the-process-of-the-bresenham-line-drawing-algorithm-or-draw-its-flowchart" class="header-anchor"&gt;&lt;/a&gt;Write out the process of the Bresenham line drawing algorithm or draw its flowchart.
&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;Assign the line start point to the moving point P(x, y);&lt;/li&gt;
&lt;li&gt;Compute the endpoint coordinate differences: dx and dy;&lt;/li&gt;
&lt;li&gt;Compute the total number of loop steps N
&lt;ol&gt;
&lt;li&gt;The value of di at the start point;&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;Loop to compute the coordinates of intermediate interpolated points:
&lt;ol&gt;
&lt;li&gt;If the current step count ≥ N, the program ends.&lt;/li&gt;
&lt;li&gt;Otherwise:
&lt;ol&gt;
&lt;li&gt;Display the current point P;&lt;/li&gt;
&lt;li&gt;If di is greater than 0, add 1 to the y coordinate;&lt;/li&gt;
&lt;li&gt;Compute the current value of di;&lt;/li&gt;
&lt;li&gt;Add 1 to the x coordinate.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="what-are-the-attributes-of-a-line"&gt;&lt;a href="#what-are-the-attributes-of-a-line" class="header-anchor"&gt;&lt;/a&gt;What are the attributes of a line?
&lt;/h3&gt;&lt;p&gt;The attributes of a line include line style, line width, and line color, etc.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Line style: line style represents different solid shapes.&lt;/li&gt;
&lt;li&gt;Line width: lines with width are used to represent the shape and position of solid surfaces.&lt;/li&gt;
&lt;li&gt;Line color: system color, defined by a color model space, such as the RGB model. Calling method: use dedicated functions to set different color values. Graphics use two colors: background color and foreground color. Background color: the color defined for drawing the system background interface. Foreground color: the various colors required for drawing graphics.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="what-are-the-commonly-used-algorithms-for-arc-generation"&gt;&lt;a href="#what-are-the-commonly-used-algorithms-for-arc-generation" class="header-anchor"&gt;&lt;/a&gt;What are the commonly used algorithms for arc generation?
&lt;/h3&gt;&lt;p&gt;The point-by-point comparison method, the midpoint circle algorithm, the Bresenham algorithm, the angle discretization method, etc.&lt;/p&gt;
&lt;p&gt;Point-by-point comparison method: set the stepping direction in different quadrants, with the principle of minimizing the approximation error and keeping the pen movement direction consistent with the drawing trend, and determine the next pixel according to the error discriminant.&lt;/p&gt;
&lt;p&gt;Midpoint circle algorithm: use the 8-way symmetry of a circle, consider the one-eighth arc in the first quadrant of a circle centered at the origin with radius R, and determine this arc clockwise from point (0, R) to point (R&amp;rsquo;, R&amp;rsquo;). Assume that a point Pi(xi, yi) is already the point on this arc closest to the actual arc; then the next point after Pi can only be one of P1 directly to the right or P2 to the lower right. Construct the discriminant function F(x, y) = x2 + y2 - R2, substitute the midpoint M into the function. If F(M) &amp;lt; 0, M is inside the circle, and the next point is T; if F(M) ≥ 0, M is on or outside the circle, and the next point is S, and so on.&lt;/p&gt;
&lt;p&gt;Bresenham algorithm: the Bresenham circle drawing algorithm is suitable for generating a complete circle. It uses an error quantity to measure how closely the selected point approximates the circle. It uses the 8-way symmetry method and only computes points within 90° to 45°, with movement direction +x, -y. Let (xi, yi) be the coordinates selected at step i of the scan; the next selected point may be T or S. According to the relationship between the difference of the square of the distance from the coordinate to the origin and the square of the radius, T or S can be chosen, and thus the complete circle can be generated.&lt;/p&gt;
&lt;h3 id="which-model-is-used-for-the-error-discriminant-in-arc-generation-algorithms"&gt;&lt;a href="#which-model-is-used-for-the-error-discriminant-in-arc-generation-algorithms" class="header-anchor"&gt;&lt;/a&gt;Which model is used for the error discriminant in arc generation algorithms?
&lt;/h3&gt;&lt;p&gt;The difference between the square of the distance from the current point to the center and the square of the radius.&lt;/p&gt;
&lt;h3 id="what-is-the-fastest-algorithm-for-a-complete-arc"&gt;&lt;a href="#what-is-the-fastest-algorithm-for-a-complete-arc" class="header-anchor"&gt;&lt;/a&gt;What is the fastest algorithm for a complete arc?
&lt;/h3&gt;&lt;p&gt;The Bresenham algorithm.&lt;/p&gt;
&lt;h3 id="explain-the-terms-approximation-interpolation-control-point-and-data-point"&gt;&lt;a href="#explain-the-terms-approximation-interpolation-control-point-and-data-point" class="header-anchor"&gt;&lt;/a&gt;Explain the terms approximation, interpolation, control point, and data point.
&lt;/h3&gt;&lt;p&gt;Approximation: by establishing a mathematical model, the constructed curve is required to be closest to the given data points in some sense; this is called approximating these data points, and the constructed curve is called an approximating curve.&lt;/p&gt;
&lt;p&gt;Interpolation: given a set of ordered data points Pi (i=0, 1, 2, &amp;hellip;, n), construct a curve by establishing a mathematical model so that it passes through the data points in order; the constructed curve is called an interpolating curve.&lt;/p&gt;
&lt;p&gt;Fitting: the collective term for interpolation and approximation methods.&lt;/p&gt;
&lt;p&gt;Data point: a data point on a curve obtained by measurement or computation that describes the geometric shape of the curve.&lt;/p&gt;
&lt;p&gt;Control point: a special shape point used to control or adjust the shape of a curve, while the curve itself does not pass through this point.&lt;/p&gt;
&lt;h3 id="explain-the-terms-region-region-filling-seed-active-edge"&gt;&lt;a href="#explain-the-terms-region-region-filling-seed-active-edge" class="header-anchor"&gt;&lt;/a&gt;Explain the terms: region, region filling, seed, active edge.
&lt;/h3&gt;&lt;p&gt;Region: a set of adjacent and connected pixels forming a closed region with the same attributes.&lt;/p&gt;
&lt;p&gt;Region filling: the process of determining a seed within a region and extending this attribute to the entire region.&lt;/p&gt;
&lt;p&gt;Seed: a pixel or pixel combination with a certain filling attribute unit.&lt;/p&gt;
&lt;p&gt;Active edge: an edge of the boundary that intersects the current scan line.&lt;/p&gt;
&lt;h3 id="master-the-methods-for-testing-whether-a-point-is-inside-a-region"&gt;&lt;a href="#master-the-methods-for-testing-whether-a-point-is-inside-a-region" class="header-anchor"&gt;&lt;/a&gt;Master the methods for testing whether a point is inside a region.
&lt;/h3&gt;&lt;p&gt;Ray method: cast a ray from point P in any direction. If the number of intersections of the ray with the polygon is odd, then P is inside the polygon; if even, then P is outside the polygon. Note, however, that when the ray intersects the polygon boundary at a vertex (singular point), different calculation methods must be used depending on whether it is an extremum point (the two edges adjacent to the vertex are on the same side of the ray) or a non-extremum point (intersections at extremum points are counted as two intersections, otherwise as one).&lt;/p&gt;
&lt;p&gt;Arc length method: assume the polygon consists of directed edges. With the tested point as the center, draw a unit circle, project all directed edges radially onto the unit circle, and compute the algebraic sum of the projections of all edges on the unit circle. If the algebraic sum is 0, the tested point is outside the polygon; if the algebraic sum is 2π, the tested point is inside the polygon.&lt;/p&gt;
&lt;p&gt;Combined method: cast a ray to the right from the start point P. If it encounters an upward-directed edge intersecting the ray, increment the counter by 1; if it encounters a downward-directed edge intersecting the ray, decrement the counter by 1. When the final counter is 0, P is outside the polygon, but singular points also need to be handled.&lt;/p&gt;
&lt;h3 id="be-able-to-accurately-distinguish-the-connectivity-of-regions"&gt;&lt;a href="#be-able-to-accurately-distinguish-the-connectivity-of-regions" class="header-anchor"&gt;&lt;/a&gt;Be able to accurately distinguish the connectivity of regions.
&lt;/h3&gt;&lt;p&gt;4-connected region: starting from a point in the region, visit the 4-neighbors of known points and traverse all pixel points in the region without leaving the region.&lt;/p&gt;
&lt;p&gt;8-connected region: starting from a point in the region, visit the 8-neighbors of known points and traverse all pixel points in the region without leaving the region.&lt;/p&gt;
&lt;h3 id="understand-and-master-regions-scan-lines-and-boundary-continuity"&gt;&lt;a href="#understand-and-master-regions-scan-lines-and-boundary-continuity" class="header-anchor"&gt;&lt;/a&gt;Understand and master regions, scan lines, and boundary continuity.
&lt;/h3&gt;&lt;p&gt;A contiguous block of pixels with the same color or pattern attributes is a region. The process of filling and coloring all pixels in a region is called region filling. There are two types of region definitions: one is a closed polygon defined by a given vertex sequence. The second type of region is the part enclosed by all known boundary pixels, and it is a region described in raster form. The second type of region also has two different definitions: one is a boundary-defined region, and the other is an interior-defined region.&lt;/p&gt;
&lt;p&gt;The scan line algorithm uses region continuity, scan line continuity, and boundary continuity to determine the intersection intervals of horizontal scan lines with the polygon, and assigns a new color value to all pixels in the interval at once.&lt;/p&gt;
&lt;p&gt;Boundary continuity: arrange the endpoints of the boundary according to their y coordinates, y0, y1, &amp;hellip;, yi, yik ≥ yik+1, 0 ≤ k ≤ n-1, with equal numbers of intersection points; points with the same number lie on the same edge.&lt;/p&gt;
&lt;h3 id="understand-and-master-the-principles-and-steps-of-the-scan-line-filling-algorithm"&gt;&lt;a href="#understand-and-master-the-principles-and-steps-of-the-scan-line-filling-algorithm" class="header-anchor"&gt;&lt;/a&gt;Understand and master the principles and steps of the scan line filling algorithm.
&lt;/h3&gt;&lt;p&gt;The scan line filling algorithm makes full use of the continuity between the intersections of the polygon boundary with two adjacent scan lines and the continuity between pixels on the same scan line.&lt;/p&gt;
&lt;p&gt;For each scan line, perform the following 3 steps:&lt;/p&gt;
&lt;p&gt;Find intersections: compute the intersections of the current scan line with all edges of the polygon.&lt;/p&gt;
&lt;p&gt;Sort and pair: sort all intersections in increasing order of x value, and pair the sorted intersections into intervals.&lt;/p&gt;
&lt;p&gt;Fill color: set the pixel values in each interval to the target color value.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Sort the region boundary vertices by Y coordinate;&lt;/li&gt;
&lt;li&gt;Determine the intervals of the scan lines;&lt;/li&gt;
&lt;li&gt;Build the active edge table of boundary edges;&lt;/li&gt;
&lt;li&gt;Find intersections;&lt;/li&gt;
&lt;li&gt;Sort intersections;&lt;/li&gt;
&lt;li&gt;Pair intersections;&lt;/li&gt;
&lt;li&gt;Fill colors.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="write-out-the-principle-of-the-dda-line-drawing-algorithm"&gt;&lt;a href="#write-out-the-principle-of-the-dda-line-drawing-algorithm" class="header-anchor"&gt;&lt;/a&gt;Write out the principle of the DDA line drawing algorithm.
&lt;/h3&gt;&lt;p&gt;Write out the principle of the DDA line drawing algorithm.&lt;/p&gt;
&lt;h3 id="master-the-classification-of-region-filling-algorithms-and-the-steps-of-the-scan-line-algorithm"&gt;&lt;a href="#master-the-classification-of-region-filling-algorithms-and-the-steps-of-the-scan-line-algorithm" class="header-anchor"&gt;&lt;/a&gt;Master the classification of region filling algorithms and the steps of the scan line algorithm.
&lt;/h3&gt;&lt;p&gt;Region filling algorithms&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Scan line filling algorithms — scan line order
&lt;ul&gt;
&lt;li&gt;Ordered edge table algorithm&lt;/li&gt;
&lt;li&gt;Edge filling algorithm&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Seed filling algorithms — starting from an interior point
&lt;ul&gt;
&lt;li&gt;Simple seed algorithm&lt;/li&gt;
&lt;li&gt;Scan line seed algorithm&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Pattern filling algorithms — filling structured graphics
&lt;ul&gt;
&lt;li&gt;Hatch filling algorithm&lt;/li&gt;
&lt;li&gt;Image filling algorithm&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="how-many-kinds-of-characters-are-commonly-used-in-graphics-systems"&gt;&lt;a href="#how-many-kinds-of-characters-are-commonly-used-in-graphics-systems" class="header-anchor"&gt;&lt;/a&gt;How many kinds of characters are commonly used in graphics systems?
&lt;/h3&gt;&lt;p&gt;Character generation methods include dot matrix, vector, and encoding.&lt;/p&gt;
&lt;p&gt;Commonly used characters include:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;ASCII codes&lt;/li&gt;
&lt;li&gt;Chinese characters&lt;/li&gt;
&lt;li&gt;Other characters&lt;/li&gt;
&lt;li&gt;Other engineering-specific symbols.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="how-many-graphical-representation-methods-are-there-for-characters-what-are-their-characteristics"&gt;&lt;a href="#how-many-graphical-representation-methods-are-there-for-characters-what-are-their-characteristics" class="header-anchor"&gt;&lt;/a&gt;How many graphical representation methods are there for characters? What are their characteristics?
&lt;/h3&gt;&lt;p&gt;Dot matrix characters represent a character as a rectangular dot matrix, and the shape of the character is expressed by different values of the dots in the matrix.&lt;/p&gt;
&lt;p&gt;Vector characters represent a character as a sequence of point coordinates; two adjacent points represent a vector, and the shape of the character is characterized by the vector sequence.&lt;/p&gt;
&lt;h2 id="chapter-4"&gt;&lt;a href="#chapter-4" class="header-anchor"&gt;&lt;/a&gt;Chapter 4
&lt;/h2&gt;&lt;h3 id="memorize-the-basic-transformation-matrices-of-2d-transformations-and-their-geometric-characteristics"&gt;&lt;a href="#memorize-the-basic-transformation-matrices-of-2d-transformations-and-their-geometric-characteristics" class="header-anchor"&gt;&lt;/a&gt;Memorize the basic transformation matrices of 2D transformations and their geometric characteristics.
&lt;/h3&gt;&lt;h4 id="translation-transformation"&gt;&lt;a href="#translation-transformation" class="header-anchor"&gt;&lt;/a&gt;Translation transformation
&lt;/h4&gt;&lt;p&gt;Original point: $P=\begin{bmatrix} x \\ y \end{bmatrix}$, transformed point: $P&amp;rsquo;=\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \end{bmatrix}$, transformation matrix: $T=\begin{bmatrix} t_{x} \\ t_{y} \end{bmatrix}$&lt;/p&gt;
&lt;p&gt;Translation equation: $P&amp;rsquo;=P+T$&lt;/p&gt;
&lt;h4 id="rotation-transformation-about-the-coordinate-origin"&gt;&lt;a href="#rotation-transformation-about-the-coordinate-origin" class="header-anchor"&gt;&lt;/a&gt;Rotation transformation about the coordinate origin
&lt;/h4&gt;&lt;p&gt;Original point: $P=\begin{bmatrix} x \\ y \end{bmatrix}$, transformed point: $P&amp;rsquo;=\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \end{bmatrix}$, transformation matrix: $R=\begin{bmatrix} \cos \theta &amp;amp; -\sin \theta \\ \sin \theta &amp;amp; \cos \theta \end{bmatrix}$&lt;/p&gt;
&lt;p&gt;Transformation equation: $P&amp;rsquo;=R\cdot P$, $\begin{cases}x&amp;rsquo;=x\cos \theta -y\sin \theta \\ y&amp;rsquo;=x\sin \theta -y\cos \theta \end{cases}$&lt;/p&gt;
&lt;h4 id="scaling-transformation-with-the-coordinate-origin-as-the-reference-point"&gt;&lt;a href="#scaling-transformation-with-the-coordinate-origin-as-the-reference-point" class="header-anchor"&gt;&lt;/a&gt;Scaling transformation with the coordinate origin as the reference point
&lt;/h4&gt;&lt;p&gt;Original point: $P=\begin{bmatrix} x \\ y \end{bmatrix}$, transformed point: $P&amp;rsquo;=\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \end{bmatrix}$, transformation matrix: $R=\begin{bmatrix} s_{x} &amp;amp; 0 \\ 0 &amp;amp; s_{y} \end{bmatrix}$&lt;/p&gt;
&lt;p&gt;Transformation equation: $P&amp;rsquo;=S\cdot P$&lt;/p&gt;
&lt;h4 id="reflection-transformation"&gt;&lt;a href="#reflection-transformation" class="header-anchor"&gt;&lt;/a&gt;Reflection transformation
&lt;/h4&gt;&lt;p&gt;Transformation equation: $P&amp;rsquo;=T\cdot P$&lt;/p&gt;
&lt;h5 id="reflection-about-the-y-axis"&gt;&lt;a href="#reflection-about-the-y-axis" class="header-anchor"&gt;&lt;/a&gt;Reflection about the y-axis
&lt;/h5&gt;&lt;p&gt;Original point: $P=\begin{bmatrix} x \\ y \end{bmatrix}$, transformed point: $P&amp;rsquo;=\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \end{bmatrix}$, transformation matrix: $S=\begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; -1 \end{bmatrix}$&lt;/p&gt;
&lt;h5 id="reflection-about-the-x-axis"&gt;&lt;a href="#reflection-about-the-x-axis" class="header-anchor"&gt;&lt;/a&gt;Reflection about the x-axis
&lt;/h5&gt;&lt;p&gt;Original point: $P=\begin{bmatrix} x \\ y \end{bmatrix}$, transformed point: $P&amp;rsquo;=\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \end{bmatrix}$, transformation matrix: $S=\begin{bmatrix} -1 &amp;amp; 0 \\ 0 &amp;amp; 1 \end{bmatrix}$&lt;/p&gt;
&lt;h5 id="reflection-about-the-coordinate-origin"&gt;&lt;a href="#reflection-about-the-coordinate-origin" class="header-anchor"&gt;&lt;/a&gt;Reflection about the coordinate origin
&lt;/h5&gt;&lt;p&gt;Original point: $P=\begin{bmatrix} x \\ y \end{bmatrix}$, transformed point: $P&amp;rsquo;=\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \end{bmatrix}$, transformation matrix: $S=\begin{bmatrix} -1 &amp;amp; 0 \\ 0 &amp;amp; -1 \end{bmatrix}$&lt;/p&gt;
&lt;h5 id="reflection-about-an-arbitrary-point"&gt;&lt;a href="#reflection-about-an-arbitrary-point" class="header-anchor"&gt;&lt;/a&gt;Reflection about an arbitrary point
&lt;/h5&gt;&lt;p&gt;Original point: $P=\begin{bmatrix} x \\ y \end{bmatrix}$, transformed point: $P&amp;rsquo;=\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \end{bmatrix}$, transformation matrix: translate first, then rotate, then translate&lt;/p&gt;
&lt;h5 id="reflection-about-the-diagonal-yx"&gt;&lt;a href="#reflection-about-the-diagonal-yx" class="header-anchor"&gt;&lt;/a&gt;Reflection about the diagonal y=x
&lt;/h5&gt;&lt;p&gt;Original point: $P=\begin{bmatrix} x \\ y \end{bmatrix}$, transformed point: $P&amp;rsquo;=\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \end{bmatrix}$, transformation matrix: $S=\begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 1 \end{bmatrix}$&lt;/p&gt;
&lt;h5 id="reflection-about-the-diagonal-y-x"&gt;&lt;a href="#reflection-about-the-diagonal-y-x" class="header-anchor"&gt;&lt;/a&gt;Reflection about the diagonal y=-x
&lt;/h5&gt;&lt;p&gt;First rotate 45° clockwise, reflect about the y-axis, and finally rotate 45° counterclockwise.&lt;/p&gt;
&lt;p&gt;Original point: $P=\begin{bmatrix} x \\ y \end{bmatrix}$, transformed point: $P&amp;rsquo;=\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \end{bmatrix}$, transformation matrix: $S=\begin{bmatrix} 0 &amp;amp; -1 \\ -1 &amp;amp; 0 \end{bmatrix}$&lt;/p&gt;
&lt;h5 id="reflection-about-an-arbitrary-line-ymxb"&gt;&lt;a href="#reflection-about-an-arbitrary-line-ymxb" class="header-anchor"&gt;&lt;/a&gt;Reflection about an arbitrary line y=mx+b
&lt;/h5&gt;&lt;p&gt;Original point: $P=\begin{bmatrix} x \\ y \end{bmatrix}$, transformed point: $P&amp;rsquo;=\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \end{bmatrix}$, transformation matrix: translation-rotation-reflection transformation&lt;/p&gt;
&lt;h4 id="shear-transformation"&gt;&lt;a href="#shear-transformation" class="header-anchor"&gt;&lt;/a&gt;Shear transformation
&lt;/h4&gt;&lt;h5 id="x-direction-shear-along-the-x-axis"&gt;&lt;a href="#x-direction-shear-along-the-x-axis" class="header-anchor"&gt;&lt;/a&gt;x-direction shear along the x-axis
&lt;/h5&gt;&lt;p&gt;Original point: $P=\begin{bmatrix} x \\ y \end{bmatrix}$, transformed point: $P&amp;rsquo;=\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \end{bmatrix}$, transformation matrix: $S=\begin{bmatrix} 1 &amp;amp; sh_{x} \\ 0 &amp;amp; 1 \end{bmatrix}$&lt;/p&gt;
&lt;p&gt;Transformation equation: $P&amp;rsquo;=S\cdot P$, $x&amp;rsquo;=x+ sh_{x} \cdot y$, $y&amp;rsquo;=y$&lt;/p&gt;
&lt;h5 id="y-direction-shear-along-the-y-axis"&gt;&lt;a href="#y-direction-shear-along-the-y-axis" class="header-anchor"&gt;&lt;/a&gt;y-direction shear along the y-axis
&lt;/h5&gt;&lt;p&gt;Original point: $P=\begin{bmatrix} x \\ y \end{bmatrix}$, transformed point: $P&amp;rsquo;=\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \end{bmatrix}$, transformation matrix: $S=\begin{bmatrix} 1 &amp;amp; 0 \\ sh_{y} &amp;amp; 1 \end{bmatrix}$&lt;/p&gt;
&lt;p&gt;Transformation equation: $P&amp;rsquo;=S\cdot P$, $x&amp;rsquo;=x$, $y&amp;rsquo;=y+ sh_{y} \cdot x$&lt;/p&gt;
&lt;h4 id="general-transformation-form"&gt;&lt;a href="#general-transformation-form" class="header-anchor"&gt;&lt;/a&gt;General transformation form
&lt;/h4&gt;&lt;p&gt;Original point: $P=\begin{bmatrix} x \\ y \end{bmatrix}$, transformed point: $P&amp;rsquo;=\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \end{bmatrix}$&lt;/p&gt;
&lt;p&gt;Transformation equation: $P&amp;rsquo;=M_{1}\cdot P + M_{2}$&lt;/p&gt;
&lt;h3 id="what-is-the-definition-of-homogeneous-coordinates"&gt;&lt;a href="#what-is-the-definition-of-homogeneous-coordinates" class="header-anchor"&gt;&lt;/a&gt;What is the definition of homogeneous coordinates?
&lt;/h3&gt;&lt;p&gt;The method of representing an n-dimensional vector with an (n+1)-dimensional vector is called homogeneous coordinate representation, and coordinates in (n+1)-dimensional space are called homogeneous coordinates.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Represent various transformations with matrices of uniform order.&lt;/li&gt;
&lt;li&gt;Convenient for representing points at infinity.&lt;/li&gt;
&lt;li&gt;The homogeneous coordinate transformation matrix maps lines to line segments, planes to planes, polygons to polygons, and polyhedra to polyhedra.&lt;/li&gt;
&lt;li&gt;Transformations have the advantage of a unified representation, which facilitates transformation composition and hardware implementation.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="master-the-homogeneous-coordinate-forms-of-basic-2d-and-3d-transformations"&gt;&lt;a href="#master-the-homogeneous-coordinate-forms-of-basic-2d-and-3d-transformations" class="header-anchor"&gt;&lt;/a&gt;Master the homogeneous coordinate forms of basic 2D and 3D transformations.
&lt;/h3&gt;&lt;h4 id="translation-transformation-1"&gt;&lt;a href="#translation-transformation-1" class="header-anchor"&gt;&lt;/a&gt;Translation transformation
&lt;/h4&gt;&lt;p&gt;$\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \\ 1 \end{bmatrix}=\begin{bmatrix} 1 &amp;amp; 0 &amp;amp; t_{x} \\ 0 &amp;amp; 1 &amp;amp; t_{y} \\ 0 &amp;amp; 0 &amp;amp; 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}$&lt;/p&gt;
&lt;h4 id="rotation-transformation"&gt;&lt;a href="#rotation-transformation" class="header-anchor"&gt;&lt;/a&gt;Rotation transformation
&lt;/h4&gt;&lt;p&gt;$\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \\ 1 \end{bmatrix}=\begin{bmatrix} \cos \theta &amp;amp; -\sin \theta &amp;amp; 0 \\ \sin \theta &amp;amp; \cos \theta &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}$&lt;/p&gt;
&lt;h4 id="scaling-transformation"&gt;&lt;a href="#scaling-transformation" class="header-anchor"&gt;&lt;/a&gt;Scaling transformation
&lt;/h4&gt;&lt;p&gt;$\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \\ 1 \end{bmatrix}=\begin{bmatrix} s_{x} &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; s_{y} &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}$&lt;/p&gt;
&lt;h4 id="reflection-transformation-1"&gt;&lt;a href="#reflection-transformation-1" class="header-anchor"&gt;&lt;/a&gt;Reflection transformation
&lt;/h4&gt;&lt;h5 id="reflection-about-the-x-axis-1"&gt;&lt;a href="#reflection-about-the-x-axis-1" class="header-anchor"&gt;&lt;/a&gt;Reflection about the x-axis
&lt;/h5&gt;&lt;p&gt;$\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \\ 1 \end{bmatrix}=\begin{bmatrix} 1 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; -1 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}$&lt;/p&gt;
&lt;h5 id="reflection-about-the-y-axis-1"&gt;&lt;a href="#reflection-about-the-y-axis-1" class="header-anchor"&gt;&lt;/a&gt;Reflection about the y-axis
&lt;/h5&gt;&lt;p&gt;$\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \\ 1 \end{bmatrix}=\begin{bmatrix} -1 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 1 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}$&lt;/p&gt;
&lt;h5 id="reflection-about-the-origin"&gt;&lt;a href="#reflection-about-the-origin" class="header-anchor"&gt;&lt;/a&gt;Reflection about the origin
&lt;/h5&gt;&lt;p&gt;$\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \\ 1 \end{bmatrix}=\begin{bmatrix} -1 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; -1 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}$&lt;/p&gt;
&lt;h5 id="reflection-about-the-diagonal-yx-1"&gt;&lt;a href="#reflection-about-the-diagonal-yx-1" class="header-anchor"&gt;&lt;/a&gt;Reflection about the diagonal y=x
&lt;/h5&gt;&lt;p&gt;$\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \\ 1 \end{bmatrix}=\begin{bmatrix} 0 &amp;amp; 1 &amp;amp; 0 \\ 1 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}$&lt;/p&gt;
&lt;h5 id="reflection-about-the-diagonal-y-x-1"&gt;&lt;a href="#reflection-about-the-diagonal-y-x-1" class="header-anchor"&gt;&lt;/a&gt;Reflection about the diagonal y=-x
&lt;/h5&gt;&lt;p&gt;$\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \\ 1 \end{bmatrix}=\begin{bmatrix} 0 &amp;amp; -1 &amp;amp; 0 \\ -1 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}$&lt;/p&gt;
&lt;h4 id="shear-transformation-1"&gt;&lt;a href="#shear-transformation-1" class="header-anchor"&gt;&lt;/a&gt;Shear transformation
&lt;/h4&gt;&lt;h5 id="x-direction-shear-relative-to-the-line-yy_ref"&gt;&lt;a href="#x-direction-shear-relative-to-the-line-yy_ref" class="header-anchor"&gt;&lt;/a&gt;x-direction shear relative to the line $y=y_{ref}$
&lt;/h5&gt;&lt;p&gt;$\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \\ 1 \end{bmatrix}=\begin{bmatrix} 1 &amp;amp; sh_{x} &amp;amp; -sh_{x}\cdot y_{ref} \\ 0 &amp;amp; 1 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}$&lt;/p&gt;
&lt;h5 id="y-direction-shear-relative-to-the-line-xx_ref"&gt;&lt;a href="#y-direction-shear-relative-to-the-line-xx_ref" class="header-anchor"&gt;&lt;/a&gt;y-direction shear relative to the line $x=x_{ref}$
&lt;/h5&gt;&lt;p&gt;$\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \\ 1 \end{bmatrix}=\begin{bmatrix} 1 &amp;amp; 0 &amp;amp; 0 \\ sh_{y} &amp;amp; 1 &amp;amp; -sh_{y}\cdot x_{ref} \\ 0 &amp;amp; 0 &amp;amp; 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}$&lt;/p&gt;
&lt;h3 id="memorize-the-basic-transformation-matrices-of-3d-transformations-and-their-geometric-characteristics"&gt;&lt;a href="#memorize-the-basic-transformation-matrices-of-3d-transformations-and-their-geometric-characteristics" class="header-anchor"&gt;&lt;/a&gt;Memorize the basic transformation matrices of 3D transformations and their geometric characteristics.
&lt;/h3&gt;&lt;h4 id="translation-transformation-2"&gt;&lt;a href="#translation-transformation-2" class="header-anchor"&gt;&lt;/a&gt;Translation transformation
&lt;/h4&gt;&lt;p&gt;$\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \\ z&amp;rsquo; \\ 1 \end{bmatrix}=\begin{bmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; t_{x} \\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; t_{y} \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; t_{z} \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix}$&lt;/p&gt;
&lt;h4 id="scaling-transformation-relative-to-the-origin"&gt;&lt;a href="#scaling-transformation-relative-to-the-origin" class="header-anchor"&gt;&lt;/a&gt;Scaling transformation relative to the origin
&lt;/h4&gt;&lt;p&gt;$\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \\ z&amp;rsquo; \\ 1 \end{bmatrix}=\begin{bmatrix} s_{x} &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; s_{y} &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; s_{z} &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix}$&lt;/p&gt;
&lt;h4 id="rotation-transformations-about-the-3d-coordinate-axes"&gt;&lt;a href="#rotation-transformations-about-the-3d-coordinate-axes" class="header-anchor"&gt;&lt;/a&gt;Rotation transformations about the 3D coordinate axes
&lt;/h4&gt;&lt;h5 id="rotation-about-the-z-axis"&gt;&lt;a href="#rotation-about-the-z-axis" class="header-anchor"&gt;&lt;/a&gt;Rotation about the z-axis
&lt;/h5&gt;&lt;p&gt;$\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \\ z&amp;rsquo; \\ 1 \end{bmatrix}=\begin{bmatrix} \cos \theta &amp;amp; -\sin \theta &amp;amp; 0 &amp;amp; 0 \\ \sin \theta &amp;amp; \cos \theta &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix}$&lt;/p&gt;
&lt;h5 id="rotation-about-the-x-axis"&gt;&lt;a href="#rotation-about-the-x-axis" class="header-anchor"&gt;&lt;/a&gt;Rotation about the x-axis
&lt;/h5&gt;&lt;p&gt;$\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \\ z&amp;rsquo; \\ 1 \end{bmatrix}=\begin{bmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; \cos \theta &amp;amp; -\sin \theta &amp;amp; 0 \\ 0 &amp;amp; \sin \theta &amp;amp; \cos \theta &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix}$&lt;/p&gt;
&lt;h5 id="rotation-about-the-y-axis"&gt;&lt;a href="#rotation-about-the-y-axis" class="header-anchor"&gt;&lt;/a&gt;Rotation about the y-axis
&lt;/h5&gt;&lt;p&gt;$\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \\ z&amp;rsquo; \\ 1 \end{bmatrix}=\begin{bmatrix} \cos \theta &amp;amp; 0 &amp;amp; \sin \theta &amp;amp; 0 \\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ -\sin \theta &amp;amp; 0 &amp;amp; \cos \theta &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix}$&lt;/p&gt;
&lt;h4 id="reflection-transformation-2"&gt;&lt;a href="#reflection-transformation-2" class="header-anchor"&gt;&lt;/a&gt;Reflection transformation
&lt;/h4&gt;&lt;h5 id="about-the-xy-plane"&gt;&lt;a href="#about-the-xy-plane" class="header-anchor"&gt;&lt;/a&gt;About the xy plane
&lt;/h5&gt;&lt;p&gt;$\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \\ z&amp;rsquo; \\ 1 \end{bmatrix}=\begin{bmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix}$&lt;/p&gt;
&lt;h5 id="about-the-yz-plane"&gt;&lt;a href="#about-the-yz-plane" class="header-anchor"&gt;&lt;/a&gt;About the yz plane
&lt;/h5&gt;&lt;p&gt;$\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \\ z&amp;rsquo; \\ 1 \end{bmatrix}=\begin{bmatrix} -1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix}$&lt;/p&gt;
&lt;h5 id="about-the-xz-plane"&gt;&lt;a href="#about-the-xz-plane" class="header-anchor"&gt;&lt;/a&gt;About the xz plane
&lt;/h5&gt;&lt;p&gt;$\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \\ z&amp;rsquo; \\ 1 \end{bmatrix}=\begin{bmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; -1 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix}$&lt;/p&gt;
&lt;h4 id="shear-transformation-2"&gt;&lt;a href="#shear-transformation-2" class="header-anchor"&gt;&lt;/a&gt;Shear transformation
&lt;/h4&gt;&lt;p&gt;z-axis&lt;/p&gt;
&lt;p&gt;$\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \\ z&amp;rsquo; \\ 1 \end{bmatrix}=\begin{bmatrix} 1 &amp;amp; 0 &amp;amp; sh_{zx} &amp;amp; -sh_{zx} \cdot z_{ref} \\ 0 &amp;amp; 1 &amp;amp; sh_{zy} &amp;amp; -sh_{zy} \cdot z_{ref} \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix}$&lt;/p&gt;
&lt;h4 id="general-transformation-form-1"&gt;&lt;a href="#general-transformation-form-1" class="header-anchor"&gt;&lt;/a&gt;General transformation form
&lt;/h4&gt;&lt;p&gt;$T_{3D}=\begin{bmatrix} a &amp;amp; b &amp;amp; c &amp;amp; l \\ d &amp;amp; e &amp;amp; f &amp;amp; m \\ h &amp;amp; i &amp;amp; j &amp;amp; n \\ p &amp;amp; q &amp;amp; r &amp;amp; s \end{bmatrix}$&lt;/p&gt;
&lt;p&gt;where $\begin{bmatrix} a &amp;amp; b &amp;amp; c \\ d &amp;amp; e &amp;amp; f \\ h &amp;amp; i &amp;amp; j \end{bmatrix}$ produces geometric transformations such as scaling, rotation, symmetry, and shear; $\begin{bmatrix} 1 \\ m \\ n \end{bmatrix}$ produces translation; $\begin{bmatrix} p &amp;amp; q &amp;amp; r \end{bmatrix}$ produces perspective transformation; $\begin{bmatrix} s \end{bmatrix}$ produces overall scaling.&lt;/p&gt;
&lt;h3 id="according-to-the-graphics-changes-write-out-the-transformation-matrix-for-2d-composition"&gt;&lt;a href="#according-to-the-graphics-changes-write-out-the-transformation-matrix-for-2d-composition" class="header-anchor"&gt;&lt;/a&gt;According to the graphics changes, write out the transformation matrix for 2D composition.
&lt;/h3&gt;&lt;p&gt;Refer to the comprehensive transformation application problems in the exam papers.&lt;/p&gt;
&lt;h2 id="chapter-5"&gt;&lt;a href="#chapter-5" class="header-anchor"&gt;&lt;/a&gt;Chapter 5
&lt;/h2&gt;&lt;h3 id="what-are-the-disadvantages-of-cohen-sutherland-encoding-clipping-how-does-the-liang-barsky-parametric-clipping-algorithm-improve-on-it"&gt;&lt;a href="#what-are-the-disadvantages-of-cohen-sutherland-encoding-clipping-how-does-the-liang-barsky-parametric-clipping-algorithm-improve-on-it" class="header-anchor"&gt;&lt;/a&gt;What are the disadvantages of Cohen-Sutherland encoding clipping? How does the Liang-Barsky parametric clipping algorithm improve on it?
&lt;/h3&gt;&lt;p&gt;Because it uses bitwise AND operations, it imposes special requirements on program implementation, and it is inconvenient in some high-level languages.&lt;/p&gt;
&lt;p&gt;The all-reject test is only suitable for line segments that lie entirely on the same window side; for line segments that cross the entire region, it cannot make a single judgment and reject them.&lt;/p&gt;
&lt;p&gt;The Liang-Barsky parametric clipping algorithm requires less computation. Each modification requires only one division, and after u1 and u2 are determined, the intersection of the line with the window boundary needs to be computed only once.&lt;/p&gt;
&lt;h3 id="understand-and-master-the-definitions-of-the-5-coordinate-systems"&gt;&lt;a href="#understand-and-master-the-definitions-of-the-5-coordinate-systems" class="header-anchor"&gt;&lt;/a&gt;Understand and master the definitions of the 5 coordinate systems.
&lt;/h3&gt;&lt;h4 id="modeling-coordinate-system"&gt;&lt;a href="#modeling-coordinate-system" class="header-anchor"&gt;&lt;/a&gt;Modeling coordinate system
&lt;/h4&gt;&lt;p&gt;The modeling coordinate system is a local coordinate system and also a typical planar rectangular coordinate system. It mainly exists to facilitate model construction and transformation.&lt;/p&gt;
&lt;h4 id="world-coordinate-system"&gt;&lt;a href="#world-coordinate-system" class="header-anchor"&gt;&lt;/a&gt;World coordinate system
&lt;/h4&gt;&lt;p&gt;To determine the position of each object and its relative position with respect to other objects, it is necessary to abandon each object&amp;rsquo;s own coordinate system and place it into a unified coordinate system. This coordinate system is called the world coordinate system, also called the user coordinate system, and it is a global coordinate system.&lt;/p&gt;
&lt;h4 id="viewing-coordinate-system"&gt;&lt;a href="#viewing-coordinate-system" class="header-anchor"&gt;&lt;/a&gt;Viewing coordinate system
&lt;/h4&gt;&lt;p&gt;Once a 2D graphics scene is determined, the user can define the viewing region and viewing direction according to the requirements of graphic display to obtain the desired display result. This actually requires defining the position and direction of the viewpoint (or camera), completing the repositioning and description of objects in the entire world coordinate system from the observer&amp;rsquo;s perspective, and simplifying the derivation and computation of subsequent 2D graphics imaging on the projection plane. Therefore, it is necessary to introduce the viewing coordinate system.&lt;/p&gt;
&lt;h4 id="normalized-device-coordinate-system"&gt;&lt;a href="#normalized-device-coordinate-system" class="header-anchor"&gt;&lt;/a&gt;Normalized device coordinate system
&lt;/h4&gt;&lt;p&gt;To make viewing processing independent of output devices, we can transform the object description into an intermediate coordinate system that is both device-independent and easily convertible to a device coordinate system. This intermediate coordinate system is usually called the normalized device coordinate system.&lt;/p&gt;
&lt;h4 id="device-coordinate-system"&gt;&lt;a href="#device-coordinate-system" class="header-anchor"&gt;&lt;/a&gt;Device coordinate system
&lt;/h4&gt;&lt;p&gt;To facilitate the output of 2D viewing results, the device coordinate system is used to define image space, and may also be called the screen coordinate system or pixel coordinate system.&lt;/p&gt;
&lt;h3 id="explain-the-concepts-of-user-domain-window-screen-domain-and-viewport"&gt;&lt;a href="#explain-the-concepts-of-user-domain-window-screen-domain-and-viewport" class="header-anchor"&gt;&lt;/a&gt;Explain the concepts of user domain, window, screen domain, and viewport.
&lt;/h3&gt;&lt;p&gt;User domain: user space, the real-number domain used by users to define and design objects; it is continuous and infinite.&lt;/p&gt;
&lt;p&gt;Window region: the user outputs an arbitrary specified region in the user domain to the screen.&lt;/p&gt;
&lt;p&gt;Screen domain: the maximum region on a graphics device used to output graphics; it is a finite, discrete integer domain.&lt;/p&gt;
&lt;p&gt;Viewport: the region defined in the screen domain for displaying graphics is called the viewport.&lt;/p&gt;
&lt;h3 id="understand-and-master-the-matrix-form-of-the-window-to-viewport-transformation-equation"&gt;&lt;a href="#understand-and-master-the-matrix-form-of-the-window-to-viewport-transformation-equation" class="header-anchor"&gt;&lt;/a&gt;Understand and master the matrix form of the window-to-viewport transformation equation.
&lt;/h3&gt;&lt;p&gt;Window w, viewport v: $\begin{bmatrix} x_{v} &amp;amp; y_{v} &amp;amp; 1 \end{bmatrix}=\begin{bmatrix} x_{w} &amp;amp; y_{w} &amp;amp; 1 \end{bmatrix} \cdot \begin{bmatrix} a &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; -c &amp;amp; 0 \\ b &amp;amp; d &amp;amp; 1 \end{bmatrix}$&lt;/p&gt;
&lt;p&gt;$X_{v}=X_{v1}+\dfrac{X_{v2}-X_{v1}}{X_{w2}-X_{w1}}(X_{w} - X_{w1})$&lt;/p&gt;
&lt;p&gt;$Y_{v}=Y_{v1}+\dfrac{Y_{v2}-Y_{v1}}{Y_{w2}-Y_{w1}}(Y_{w} - Y_{w1})$&lt;/p&gt;
&lt;p&gt;If the viewport size remains unchanged and the window is reduced or enlarged, the graphic will be enlarged or reduced.&lt;/p&gt;
&lt;p&gt;If the window size remains unchanged and the viewport is reduced or enlarged, the graphic will be reduced or enlarged accordingly.&lt;/p&gt;
&lt;p&gt;If the window and viewport have the same size, the graphic size ratio remains unchanged.&lt;/p&gt;
&lt;p&gt;If the viewport and window have different aspect ratios, the graphic will be stretched and deformed.&lt;/p&gt;
&lt;h3 id="write-out-the-principles-and-steps-of-the-line-segment-encoding-clipping-algorithm"&gt;&lt;a href="#write-out-the-principles-and-steps-of-the-line-segment-encoding-clipping-algorithm" class="header-anchor"&gt;&lt;/a&gt;Write out the principles and steps of the line segment encoding clipping algorithm.
&lt;/h3&gt;&lt;h4 id="encoding-clipping-algorithm"&gt;&lt;a href="#encoding-clipping-algorithm" class="header-anchor"&gt;&lt;/a&gt;Encoding clipping algorithm
&lt;/h4&gt;&lt;p&gt;Extend the window boundaries to divide the plane into 9 regions, encode each region with a 4-bit binary number, and determine positions according to the encoded values or logical operations.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;If the 4-bit codes of both endpoints of a line segment are all 0, then the line segment is inside the window and can be output directly;&lt;/li&gt;
&lt;li&gt;If the logical AND (bitwise product) of the codes of the two endpoints is not 0, then the line segment is entirely outside the window and is discarded;&lt;/li&gt;
&lt;li&gt;Otherwise, the line segment intersects the window, so find the intersection. Find the intersection of the line with the window boundary, use the intersection to split the line segment, and discard the part beyond the intersection; use the intersection as a boundary to further test for intersections and split; clipping order: according to the encoded value; termination criterion: all encoded values are zero.&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 id="midpoint-subdivision-algorithm"&gt;&lt;a href="#midpoint-subdivision-algorithm" class="header-anchor"&gt;&lt;/a&gt;Midpoint subdivision algorithm
&lt;/h4&gt;&lt;p&gt;A binary recursive search method: check whether the midpoint is inside the region and compute recursively.&lt;/p&gt;
&lt;h4 id="vector-liang-barsky-clipping-algorithm"&gt;&lt;a href="#vector-liang-barsky-clipping-algorithm" class="header-anchor"&gt;&lt;/a&gt;Vector (Liang-Barsky) clipping algorithm
&lt;/h4&gt;&lt;p&gt;Determine the start and end edges; find the intersections of the line with the window edges; among the two intersections with the start edge, take the point closest to P2 and assign it to Ps; among the two intersections with the end edge, take the point closest to P1 and assign it to Pe; output the valid line segment PsPe.&lt;/p&gt;
&lt;h4 id="fast-clipping-algorithm"&gt;&lt;a href="#fast-clipping-algorithm" class="header-anchor"&gt;&lt;/a&gt;Fast clipping algorithm
&lt;/h4&gt;&lt;ol&gt;
&lt;li&gt;Determine whether the line is completely inside the window&lt;/li&gt;
&lt;li&gt;If the X coordinates of the endpoints are the same, if not&lt;/li&gt;
&lt;li&gt;Compute the slope of line P1 P2&lt;/li&gt;
&lt;li&gt;Compute the value of the discriminant according to k; if it is not greater than 0&lt;/li&gt;
&lt;li&gt;Compute the intersections of the line with the four window boundaries and sort them in one direction&lt;/li&gt;
&lt;li&gt;Take the two middle points to form the line segment inside the window and output it.&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 id="sorted-clipping-algorithm"&gt;&lt;a href="#sorted-clipping-algorithm" class="header-anchor"&gt;&lt;/a&gt;Sorted clipping algorithm
&lt;/h4&gt;&lt;p&gt;See the reference materials for details.&lt;/p&gt;
&lt;h3 id="write-out-the-principles-and-steps-of-the-polygon-edge-by-edge-clipping-algorithm"&gt;&lt;a href="#write-out-the-principles-and-steps-of-the-polygon-edge-by-edge-clipping-algorithm" class="header-anchor"&gt;&lt;/a&gt;Write out the principles and steps of the polygon edge-by-edge clipping algorithm.
&lt;/h3&gt;&lt;p&gt;Polygon clipping algorithms are divided into: edge-by-edge clipping and dual-edge clipping.&lt;/p&gt;
&lt;h4 id="edge-by-edge-clipping"&gt;&lt;a href="#edge-by-edge-clipping" class="header-anchor"&gt;&lt;/a&gt;Edge-by-edge clipping
&lt;/h4&gt;&lt;ol&gt;
&lt;li&gt;First form an ordered point sequence from the vertices of the polygon to be clipped;&lt;/li&gt;
&lt;li&gt;Adjacent two points form an edge, such as P1P2, P3P4, &amp;hellip;, PnP1, for a total of N edges;&lt;/li&gt;
&lt;li&gt;Use the four window edges to clip each edge of the polygon in turn and find the valid intersection points.&lt;/li&gt;
&lt;li&gt;Connect the valid endpoints to form a new polygon.&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 id="dual-edge-clipping"&gt;&lt;a href="#dual-edge-clipping" class="header-anchor"&gt;&lt;/a&gt;Dual-edge clipping
&lt;/h4&gt;&lt;ol&gt;
&lt;li&gt;Arrange the polygon vertices counterclockwise into an ordered point loop;&lt;/li&gt;
&lt;li&gt;Sort the window vertices according to the polygon sorting method;&lt;/li&gt;
&lt;li&gt;Starting from any vertex of the polygon, search along the loop direction for polygon vertices, vertices inside the window, and valid intersections between the polygon and the window;
&lt;ol&gt;
&lt;li&gt;When an entry point is encountered, do not change the search direction.&lt;/li&gt;
&lt;li&gt;When an exit point is encountered, change the search direction:
&lt;ol&gt;
&lt;li&gt;Turn at the exit point, with the turning direction consistent with the vertex sorting direction;&lt;/li&gt;
&lt;li&gt;Proceed along the direction of the valid window edge, searching for intersections between that edge and the polygon until a new intersection is encountered.&lt;/li&gt;
&lt;li&gt;When a new intersection is encountered, lift the pen and return to the original exit point.&lt;/li&gt;
&lt;li&gt;Then continue searching along the original direction.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;End when the search start point is reached.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="the-code-of-a-line-endpoint-is-0010-write-out-the-relationship-between-its-endpoint-coordinates-and-the-four-window-boundaries"&gt;&lt;a href="#the-code-of-a-line-endpoint-is-0010-write-out-the-relationship-between-its-endpoint-coordinates-and-the-four-window-boundaries" class="header-anchor"&gt;&lt;/a&gt;The code of a line endpoint is 0010. Write out the relationship between its endpoint coordinates and the four window boundaries.
&lt;/h3&gt;&lt;p&gt;It should be in the middle region on the far right, outside the window.&lt;/p&gt;
&lt;h2 id="chapter-6"&gt;&lt;a href="#chapter-6" class="header-anchor"&gt;&lt;/a&gt;Chapter 6
&lt;/h2&gt;&lt;h3 id="understand-and-master-the-definition-and-classification-of-projection"&gt;&lt;a href="#understand-and-master-the-definition-and-classification-of-projection" class="header-anchor"&gt;&lt;/a&gt;Understand and master the definition and classification of projection.
&lt;/h3&gt;&lt;p&gt;The process of transforming a 3D object into a 2D graphic representation is generally called projection transformation.&lt;/p&gt;
&lt;p&gt;According to the distance between the projection center and the projection plane, projection can be divided into parallel projection and perspective projection.&lt;/p&gt;
&lt;h3 id="understand-and-master-the-transformation-matrices-formed-by-the-three-views"&gt;&lt;a href="#understand-and-master-the-transformation-matrices-formed-by-the-three-views" class="header-anchor"&gt;&lt;/a&gt;Understand and master the transformation matrices formed by the three views.
&lt;/h3&gt;&lt;h4 id="front-view"&gt;&lt;a href="#front-view" class="header-anchor"&gt;&lt;/a&gt;Front view
&lt;/h4&gt;&lt;p&gt;$\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \\ z&amp;rsquo; \\ 1 \end{bmatrix}=T_{v} \cdot \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix} = \begin{bmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix}$&lt;/p&gt;
&lt;h4 id="top-view"&gt;&lt;a href="#top-view" class="header-anchor"&gt;&lt;/a&gt;Top view
&lt;/h4&gt;&lt;p&gt;$\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \\ z&amp;rsquo; \\ 1 \end{bmatrix}=T_{v} \cdot \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix} = \begin{bmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; -1 &amp;amp; 0 &amp;amp; -z_{0} \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix}$&lt;/p&gt;
&lt;h4 id="side-view"&gt;&lt;a href="#side-view" class="header-anchor"&gt;&lt;/a&gt;Side view
&lt;/h4&gt;&lt;p&gt;$\begin{bmatrix} x&amp;rsquo; \\ y&amp;rsquo; \\ z&amp;rsquo; \\ 1 \end{bmatrix}=T_{v} \cdot \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix} = \begin{bmatrix} 0 &amp;amp; -1 &amp;amp; 0 &amp;amp; -x_{0} \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix}$&lt;/p&gt;
&lt;h3 id="understand-the-coordinate-forms-and-their-transformations-in-the-3d-viewing-process"&gt;&lt;a href="#understand-the-coordinate-forms-and-their-transformations-in-the-3d-viewing-process" class="header-anchor"&gt;&lt;/a&gt;Understand the coordinate forms and their transformations in the 3D viewing process.
&lt;/h3&gt;&lt;p&gt;An axonometric drawing is a kind of stereoscopic drawing produced on a 2D plane by parallel projection that simultaneously reflects the shape of an object in the three directions of length, width, and height.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;First rotate the shape around the z-axis by angle α:&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;$T_{1}=\begin{bmatrix} \cos \alpha &amp;amp; \sin \alpha &amp;amp; 0 &amp;amp; 0 \\ -\sin \alpha &amp;amp; \cos \alpha &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \end{bmatrix}$&lt;/p&gt;
&lt;ol start="2"&gt;
&lt;li&gt;Then rotate the shape around the x-axis by angle β in the reverse direction (β&amp;lt;0):&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;$T_{2}=\begin{bmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; \cos \beta &amp;amp; \sin \beta &amp;amp; 0 \\ 0 &amp;amp; -\sin \beta &amp;amp; \cos \beta &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \end{bmatrix}$&lt;/p&gt;
&lt;ol start="3"&gt;
&lt;li&gt;Compress the shape toward the xoz plane:&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;$T_{3}=\begin{bmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \end{bmatrix}$&lt;/p&gt;
&lt;ol start="4"&gt;
&lt;li&gt;Transformation matrix of the axonometric drawing:&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;$T=T_{1}\cdot T_{2}\cdot T_{3}$&lt;/p&gt;
&lt;h2 id="chapter-7"&gt;&lt;a href="#chapter-7" class="header-anchor"&gt;&lt;/a&gt;Chapter 7
&lt;/h2&gt;&lt;h3 id="what-is-a-solid-what-attributes-does-a-solid-have"&gt;&lt;a href="#what-is-a-solid-what-attributes-does-a-solid-have" class="header-anchor"&gt;&lt;/a&gt;What is a solid? What attributes does a solid have?
&lt;/h3&gt;&lt;p&gt;A set of spatial points, or a space enclosed by closed surfaces; it is a non-empty, bounded, closed point set.&lt;/p&gt;
&lt;p&gt;Shape invariance: a solid must have an invariant shape, and the shape is independent of the solid&amp;rsquo;s position and orientation.&lt;/p&gt;
&lt;p&gt;Dimensional consistency: every part of a solid must be three-dimensional; there are no isolated points or dangling edges.&lt;/p&gt;
&lt;p&gt;Spatial finiteness: it occupies finite space, and its boundary is determinate and closed.&lt;/p&gt;
&lt;p&gt;Properties of a solid boundary:&lt;/p&gt;
&lt;p&gt;Connectivity: there is always a path between any two points.&lt;/p&gt;
&lt;p&gt;Boundedness: the solid surface divides space into two parts, one of which is bounded.&lt;/p&gt;
&lt;p&gt;Orientability: the two sides of the surface clearly define the inside and outside belonging to the solid.&lt;/p&gt;
&lt;p&gt;Non-self-intersection: the solid surface cannot intersect itself.&lt;/p&gt;
&lt;p&gt;Closure: each edge has two and only two points, and each edge connects two or more faces.&lt;/p&gt;
&lt;h3 id="what-are-the-basic-elements-that-constitute-a-solid-what-parts-of-information-describe-a-solid"&gt;&lt;a href="#what-are-the-basic-elements-that-constitute-a-solid-what-parts-of-information-describe-a-solid" class="header-anchor"&gt;&lt;/a&gt;What are the basic elements that constitute a solid? What parts of information describe a solid?
&lt;/h3&gt;&lt;p&gt;Basic elements constituting a solid: point, edge, loop, face, body&lt;/p&gt;
&lt;p&gt;Information describing a solid: geometric information, topological information&lt;/p&gt;
&lt;h3 id="what-are-the-conditions-and-formula-of-the-euler-formula-for-judging-solids"&gt;&lt;a href="#what-are-the-conditions-and-formula-of-the-euler-formula-for-judging-solids" class="header-anchor"&gt;&lt;/a&gt;What are the conditions and formula of the Euler formula for judging solids?
&lt;/h3&gt;&lt;p&gt;A polyhedron that satisfies the Euler formula is not necessarily a solid; the Euler formula is only a necessary condition for checking the validity of a solid.&lt;/p&gt;
&lt;p&gt;Simple polyhedron:
V: number of vertices, E: number of edges, F: number of faces&lt;/p&gt;
$$V-E+F=2$$&lt;p&gt;Non-simple polyhedron:
H: number of holes on the polyhedron surface, G: number of holes passing through the polyhedron, C: number of independent, disconnected polyhedra.&lt;/p&gt;
$$V–E+F–H=2(C–G)$$&lt;h3 id="how-many-representation-methods-are-there-for-solids"&gt;&lt;a href="#how-many-representation-methods-are-there-for-solids" class="header-anchor"&gt;&lt;/a&gt;How many representation methods are there for solids?
&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;Boundary representation&lt;/li&gt;
&lt;li&gt;Sweep representation&lt;/li&gt;
&lt;li&gt;Constructive solid geometry representation (CSG)&lt;/li&gt;
&lt;li&gt;Spatial subdivision representation&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="understand-the-mathematical-and-geometric-significance-of-parametric-curve-continuity"&gt;&lt;a href="#understand-the-mathematical-and-geometric-significance-of-parametric-curve-continuity" class="header-anchor"&gt;&lt;/a&gt;Understand the mathematical and geometric significance of parametric curve continuity.
&lt;/h3&gt;&lt;p&gt;Curves used in engineering are generally required to be smooth curves and to be generated according to a specified point sequence; these are spline curves. A spline curve is a curve formed by connecting polynomial curve segments, and adjacent segments are required to satisfy specific continuity conditions at their boundaries.&lt;/p&gt;
&lt;h3 id="master-the-matrix-form-and-blending-functions-of-the-h-curve-and-the-influence-of-endpoint-tangent-vectors-on-curve-shape"&gt;&lt;a href="#master-the-matrix-form-and-blending-functions-of-the-h-curve-and-the-influence-of-endpoint-tangent-vectors-on-curve-shape" class="header-anchor"&gt;&lt;/a&gt;Master the matrix form and blending functions of the H curve, and the influence of endpoint tangent vectors on curve shape.
&lt;/h3&gt;&lt;p&gt;Matrix form:&lt;/p&gt;
$$Q(t)=\begin{bmatrix} t^{3} &amp; t^{2} &amp; t &amp; 1 \end{bmatrix} \cdot \begin{bmatrix} a \\\ b \\\ c \\\ d \end{bmatrix}(0 \le t \le 1)$$&lt;p&gt;Blending functions:&lt;/p&gt;
$$
\begin{aligned}
Fh(t) &amp;= T \cdot Mh \\
&amp;= \begin{bmatrix} t^3 &amp; t^2 &amp; t &amp; 1 \end{bmatrix} \cdot \begin{bmatrix} 2 &amp; -2 &amp; 1 &amp; 1 \\ -3 &amp; 3 &amp; -2 &amp; -1 \\ 0 &amp; 0 &amp; 1 &amp; 0 \\ 1 &amp; 0 &amp; 0 &amp; 0 \end{bmatrix} \\
&amp;= \begin{bmatrix} Fh1 &amp; Fh2 &amp; Fh3 &amp; Fh4 \end{bmatrix}
\end{aligned}
$$&lt;p&gt;Tangent vectors:&lt;/p&gt;
&lt;p&gt;Tangent direction: when its length remains unchanged, as the tangent angle increases, the convex hull property of the tangent also increases.&lt;/p&gt;
&lt;p&gt;Tangent magnitude: the tangent vectors at the two endpoints of the curve are Q&amp;rsquo;(0) and Q&amp;rsquo;(1), and the unit vectors are respectively: $E_{0}=\dfrac{Q&amp;rsquo;\left( 0\right) }{\left| Q&amp;rsquo;\left( 0\right) \right| }$, $E_{1}=\dfrac{Q&amp;rsquo;\left( 1\right) }{\left| Q&amp;rsquo;\left( 1\right) \right| }$
Let: |Q&amp;rsquo;(0)|=k0, |Q&amp;rsquo;(1)|=k1, then: Q&amp;rsquo;(0)= R0=k0E0, Q&amp;rsquo;(1)=R1=k1E1. Changing the values of k0 and k1 changes the tangent length, and the convex hull property of the tangent also increases.&lt;/p&gt;
&lt;h3 id="master-the-continuity-conditions-and-boundary-conditions-of-h-curve-segments"&gt;&lt;a href="#master-the-continuity-conditions-and-boundary-conditions-of-h-curve-segments" class="header-anchor"&gt;&lt;/a&gt;Master the continuity conditions and boundary conditions of H curve segments?
&lt;/h3&gt;&lt;h4 id="continuity-conditions"&gt;&lt;a href="#continuity-conditions" class="header-anchor"&gt;&lt;/a&gt;Continuity conditions
&lt;/h4&gt;&lt;p&gt;At the connection point, the second derivative is continuous (the first derivative is equal).&lt;/p&gt;
&lt;h4 id="boundary-conditions"&gt;&lt;a href="#boundary-conditions" class="header-anchor"&gt;&lt;/a&gt;Boundary conditions
&lt;/h4&gt;&lt;p&gt;Boundary conditions are divided into free end, clamped end, parabolic end, and cyclic end.&lt;/p&gt;
&lt;p&gt;Free end: according to mechanical conditions, the second derivative at both endpoints is 0.&lt;/p&gt;
&lt;h3 id="understand-and-master-the-relationship-between-the-characteristic-polygon-and-the-shape-and-degree-of-the-b-curve"&gt;&lt;a href="#understand-and-master-the-relationship-between-the-characteristic-polygon-and-the-shape-and-degree-of-the-b-curve" class="header-anchor"&gt;&lt;/a&gt;Understand and master the relationship between the characteristic polygon and the shape and degree of the B curve.
&lt;/h3&gt;&lt;p&gt;A B curve is defined by the vertices of a set of polygonal polylines. If the vertices of the polyline are fixed, the Bezier curve defined by them is unique. Among the vertices of the polyline, only the first and last points lie on the curve and serve as the start and end of the curve; the other points are used to control the shape and degree of the curve.&lt;/p&gt;
&lt;h3 id="understand-the-properties-of-the-b-curve-and-the-relationship-between-endpoint-tangent-vectors-and-edge-lengths"&gt;&lt;a href="#understand-the-properties-of-the-b-curve-and-the-relationship-between-endpoint-tangent-vectors-and-edge-lengths" class="header-anchor"&gt;&lt;/a&gt;Understand the properties of the B curve and the relationship between endpoint tangent vectors and edge lengths.
&lt;/h3&gt;&lt;h4 id="endpoint-property"&gt;&lt;a href="#endpoint-property" class="header-anchor"&gt;&lt;/a&gt;Endpoint property
&lt;/h4&gt;&lt;p&gt;A Bezier curve is tangent to the corresponding control polygon at the start and end points, and the tangent directions at the start and end points are consistent with the directions of the first and last edges of the control polygon.&lt;/p&gt;
&lt;h4 id="symmetry"&gt;&lt;a href="#symmetry" class="header-anchor"&gt;&lt;/a&gt;Symmetry
&lt;/h4&gt;&lt;p&gt;As long as the vertex positions of the characteristic polygon remain unchanged but their order is reversed, the shape of the resulting new Bezier curve remains unchanged, only the direction of parameter variation is reversed.&lt;/p&gt;
&lt;h4 id="convex-hull-property"&gt;&lt;a href="#convex-hull-property" class="header-anchor"&gt;&lt;/a&gt;Convex hull property
&lt;/h4&gt;&lt;p&gt;A Bezier curve always lies within the convex hull of its control polygon.&lt;/p&gt;
&lt;h4 id="geometric-invariance"&gt;&lt;a href="#geometric-invariance" class="header-anchor"&gt;&lt;/a&gt;Geometric invariance
&lt;/h4&gt;&lt;p&gt;The shape of a Bezier curve does not change with coordinate transformation; it depends only on the relative positions of the control vertices.&lt;/p&gt;
&lt;p&gt;The tangent length at the endpoints is equal to n times the length of the first and last edges of the characteristic polygon.&lt;/p&gt;
&lt;p&gt;The degree of curves used in engineering is not greater than 3.&lt;/p&gt;
&lt;h3 id="understand-and-master-the-conditions-for-joining-b-curves"&gt;&lt;a href="#understand-and-master-the-conditions-for-joining-b-curves" class="header-anchor"&gt;&lt;/a&gt;Understand and master the conditions for joining B curves.
&lt;/h3&gt;&lt;p&gt;Satisfy C¹ and C² continuity at the connection.&lt;/p&gt;
&lt;p&gt;Master the matrix forms of Bezier and B-spline curves.&lt;/p&gt;
&lt;p&gt;Linear Bezier curve:&lt;/p&gt;
&lt;p&gt;$Q(t)=\begin{bmatrix} t &amp;amp; 1 \end{bmatrix}\begin{bmatrix} -1 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{bmatrix}\begin{bmatrix} P_{0} \\ P_{1} \end{bmatrix}$&lt;/p&gt;
&lt;p&gt;Quadratic Bezier curve:&lt;/p&gt;
&lt;p&gt;$Q(t)=\begin{bmatrix} t^{2} &amp;amp; t &amp;amp; 1 \end{bmatrix}\begin{bmatrix} 1 &amp;amp; -2 &amp;amp; 1 \\ -2 &amp;amp; 2 &amp;amp; 0 \\ 1 &amp;amp; 0 &amp;amp; 0 \end{bmatrix}\begin{bmatrix} P_{0} \\ P_{1} \\ P_{2} \end{bmatrix}$&lt;/p&gt;
&lt;p&gt;Cubic Bezier curve:&lt;/p&gt;
&lt;p&gt;$Q(t)=\begin{bmatrix} t^{3} &amp;amp; t^{2} &amp;amp; t &amp;amp; 1 \end{bmatrix}\begin{bmatrix} -1 &amp;amp; 3 &amp;amp; -3 &amp;amp; 1 \\ 3 &amp;amp; -6 &amp;amp; 3 &amp;amp; 0 \\ -3 &amp;amp; 3 &amp;amp; 0 &amp;amp; 0 \\ 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \end{bmatrix}\begin{bmatrix} P_{0} \\ P_{1} \\ P_{2} \\ P_{3} \end{bmatrix}$&lt;/p&gt;
&lt;p&gt;Linear B-spline curve:&lt;/p&gt;
&lt;p&gt;$Q_{i,1}(t)=\begin{bmatrix} t &amp;amp; 1 \end{bmatrix}\begin{bmatrix} -1 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{bmatrix}\begin{bmatrix} P_{0} \\ P_{1} \end{bmatrix}$&lt;/p&gt;
&lt;p&gt;Quadratic B-spline curve:&lt;/p&gt;
&lt;p&gt;$Q_{i,2}(t)=\begin{bmatrix} t^{2} &amp;amp; t &amp;amp; 1 \end{bmatrix}\begin{bmatrix} 1 &amp;amp; -2 &amp;amp; 1 \\ -2 &amp;amp; 2 &amp;amp; 0 \\ 1 &amp;amp; 1 &amp;amp; 0 \end{bmatrix}\begin{bmatrix} P_{0} \\ P_{1} \\ P_{2} \end{bmatrix}$&lt;/p&gt;
&lt;p&gt;Cubic B-spline curve:&lt;/p&gt;
&lt;p&gt;$Q_{i,3}(t)=\begin{bmatrix} t^{3} &amp;amp; t^{2} &amp;amp; t &amp;amp; 1 \end{bmatrix}\begin{bmatrix} -1 &amp;amp; 3 &amp;amp; -3 &amp;amp; 1 \\ 3 &amp;amp; -6 &amp;amp; 3 &amp;amp; 0 \\ -3 &amp;amp; 0 &amp;amp; 3 &amp;amp; 0 \\ 1 &amp;amp; 4 &amp;amp; 1 &amp;amp; 0 \end{bmatrix}\begin{bmatrix} P_{0} \\ P_{1} \\ P_{2} \\ P_{3} \end{bmatrix}$&lt;/p&gt;
&lt;h3 id="master-the-relationship-between-the-characteristic-polygon-and-the-shape-and-degree-of-bezier-and-b-spline-curves"&gt;&lt;a href="#master-the-relationship-between-the-characteristic-polygon-and-the-shape-and-degree-of-bezier-and-b-spline-curves" class="header-anchor"&gt;&lt;/a&gt;Master the relationship between the characteristic polygon and the shape and degree of Bezier and B-spline curves.
&lt;/h3&gt;&lt;p&gt;If m+n+1 vertices are given, then the B-spline curve function of the i-th segment with n-th degree equal-distance subdivision is&lt;/p&gt;
$$Q_{i,n}\left( t\right) =\sum ^{n}_{i=0}P_{i+1}F_{l,n}\left( t\right) , l=0,l\dots n, t\in [0,1]$$&lt;h3 id="understand-the-properties-and-endpoint-conditions-of-bezier-and-b-spline-curves"&gt;&lt;a href="#understand-the-properties-and-endpoint-conditions-of-bezier-and-b-spline-curves" class="header-anchor"&gt;&lt;/a&gt;Understand the properties and endpoint conditions of Bezier and B-spline curves.
&lt;/h3&gt;&lt;p&gt;The start and end points of the curve are located at the midpoints of the first and last segments.&lt;/p&gt;
&lt;h3 id="understand-and-master-the-conditions-for-joining-bezier-curves"&gt;&lt;a href="#understand-and-master-the-conditions-for-joining-bezier-curves" class="header-anchor"&gt;&lt;/a&gt;Understand and master the conditions for joining Bezier curves.
&lt;/h3&gt;&lt;p&gt;Have first and second derivative continuity at the connection.&lt;/p&gt;
&lt;h3 id="be-proficient-in-the-drawing-method-and-geometric-characteristics-of-the-endpoints-of-cubic-b-spline-curve-segments"&gt;&lt;a href="#be-proficient-in-the-drawing-method-and-geometric-characteristics-of-the-endpoints-of-cubic-b-spline-curve-segments" class="header-anchor"&gt;&lt;/a&gt;Be proficient in the drawing method and geometric characteristics of the endpoints of cubic B-spline curve segments.
&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;Determine the data points Qi (i=1, 2, &amp;hellip;, n);&lt;/li&gt;
&lt;li&gt;According to the curve type, establish the matrix form for back-solving the characteristic points;&lt;/li&gt;
&lt;li&gt;Compute the vertex table of the polygon;&lt;/li&gt;
&lt;li&gt;Determine the number of interpolation points according to the accuracy requirement, and draw the spline curve.
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Reverse extension:
Take a point $P_{-1}$ on the extension line of $P_{1} P_{0}$ such that:
&lt;/p&gt;
$$P_{-1} P_{0}= P_{0} P_{1}$$&lt;p&gt;
&lt;/p&gt;
$$P_{n} P_{n+1}= P_{n-1}P_{n}$$&lt;p&gt;
&lt;img src="https://r2.boiltask.com/2026/01/baa4e13d4c15e9c099ca04b8f81b3161.png"
loading="lazy"
alt="image-1"
&gt;
Obtain:
&lt;/p&gt;
$$P_{-1}= 2 P_{0} - P_{1}$$&lt;p&gt;
&lt;/p&gt;
$$P_{4}= 2 P_{3} - P_{2}$$&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Key technique:
&lt;img src="https://r2.boiltask.com/2026/01/ad3d526dd8ae8e79c1d8bc2415496081.png"
loading="lazy"
alt="image-2"
&gt;
Use coincident points at the start and end points, such that:
&lt;/p&gt;
$$P_{-2}\equiv P_{-1} \equiv P_{0}$$&lt;p&gt;
&lt;/p&gt;
$$P_{n+2}\equiv P_{n+1} \equiv P_{n}$$&lt;p&gt;
$Q_{-1}$ is located at one third of $P_{0} P_{1}$.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="understand-and-master-the-local-modification-and-extension-properties-of-b-spline-curves"&gt;&lt;a href="#understand-and-master-the-local-modification-and-extension-properties-of-b-spline-curves" class="header-anchor"&gt;&lt;/a&gt;Understand and master the local modification and extension properties of B-spline curves.
&lt;/h3&gt;&lt;p&gt;When the position of a control point is changed, at most four curve segments are affected.&lt;/p&gt;
&lt;p&gt;Adding a control point adds one B-spline curve segment; the original B-spline curve is unaffected, and the new curve segment and the original curve have first and second derivative continuity at the connection.&lt;/p&gt;
&lt;h3 id="understand-and-master-the-construction-conditions-of-surface-patches"&gt;&lt;a href="#understand-and-master-the-construction-conditions-of-surface-patches" class="header-anchor"&gt;&lt;/a&gt;Understand and master the construction conditions of surface patches
&lt;/h3&gt;&lt;p&gt;Curves intersect to form a spatial grid, and the set of all intersection points constitutes a surface patch.&lt;/p&gt;
&lt;h3 id="master-the-matrix-form-and-boundary-conditions-of-the-coons-surface"&gt;&lt;a href="#master-the-matrix-form-and-boundary-conditions-of-the-coons-surface" class="header-anchor"&gt;&lt;/a&gt;Master the matrix form and boundary conditions of the Coons surface
&lt;/h3&gt;&lt;p&gt;$C=\begin{bmatrix} P_{00} &amp;amp; P_{01} &amp;amp; P_{00}^{v} &amp;amp; P_{01}^{v} \\ P_{10} &amp;amp; P_{11} &amp;amp; P_{10}^{v} &amp;amp; P_{11}^{v} \\ P_{00}^{u} &amp;amp; P_{10}^{u} &amp;amp; 0 &amp;amp; 0 \\ P_{10}^{u} &amp;amp; P_{11}^{u} &amp;amp; 0 &amp;amp; 0 \end{bmatrix}$&lt;/p&gt;
&lt;p&gt;Four corner points, four boundary curves, eight tangent vectors&lt;/p&gt;
&lt;h3 id="be-able-to-write-the-matrix-form-of-an-arbitrary-position-vector-on-the-boundary-of-a-coons-surface"&gt;&lt;a href="#be-able-to-write-the-matrix-form-of-an-arbitrary-position-vector-on-the-boundary-of-a-coons-surface" class="header-anchor"&gt;&lt;/a&gt;Be able to write the matrix form of an arbitrary position vector on the boundary of a Coons surface
&lt;/h3&gt;&lt;p&gt;Refer to the textbook and PPT&lt;/p&gt;
&lt;h3 id="understand-and-master-the-conditions-for-joining-coons-surface-patches"&gt;&lt;a href="#understand-and-master-the-conditions-for-joining-coons-surface-patches" class="header-anchor"&gt;&lt;/a&gt;Understand and master the conditions for joining Coons surface patches
&lt;/h3&gt;&lt;p&gt;C1 continuity at the join.&lt;/p&gt;
&lt;p&gt;$P_{10} \equiv Q_{00}$, $P_{11} \equiv Q_{01}$&lt;/p&gt;
&lt;p&gt;$P_{10}^{w} \equiv Q_{00}^{w}$, $P_{11}^{w} \equiv Q_{01}^{w}$&lt;/p&gt;
&lt;p&gt;$P_{1j}^{u} \equiv Q_{0j}^{u}$&lt;/p&gt;
&lt;p&gt;$P_{1j}^{u} \equiv a Q_{0j}^{u}$&lt;/p&gt;
&lt;h2 id="chapter-8"&gt;&lt;a href="#chapter-8" class="header-anchor"&gt;&lt;/a&gt;Chapter 8
&lt;/h2&gt;&lt;h3 id="how-many-categories-can-hidden-surface-removal-algorithms-be-divided-into-what-is-the-classification-principle"&gt;&lt;a href="#how-many-categories-can-hidden-surface-removal-algorithms-be-divided-into-what-is-the-classification-principle" class="header-anchor"&gt;&lt;/a&gt;How many categories can hidden surface removal algorithms be divided into? What is the classification principle?
&lt;/h3&gt;&lt;p&gt;According to the hidden object: line hidden surface removal, surface hidden surface removal&lt;/p&gt;
&lt;p&gt;According to the hidden surface removal algorithm space: object space hidden surface removal algorithms, image space hidden surface removal algorithms&lt;/p&gt;
&lt;p&gt;Hidden surface removal: the process of eliminating hidden lines (surfaces) in a shape view&lt;/p&gt;
&lt;p&gt;Basic principles of hidden surface removal: sorting, coherence&lt;/p&gt;
&lt;h3 id="what-is-the-basic-principle-of-the-outward-normal-hidden-surface-removal-algorithm-write-out-its-algorithm-steps"&gt;&lt;a href="#what-is-the-basic-principle-of-the-outward-normal-hidden-surface-removal-algorithm-write-out-its-algorithm-steps" class="header-anchor"&gt;&lt;/a&gt;What is the basic principle of the outward normal hidden surface removal algorithm? Write out its algorithm steps.
&lt;/h3&gt;&lt;p&gt;Visibility is determined according to the direction cosine of the outward normal in the projection direction.&lt;/p&gt;
&lt;h4 id="convex-polyhedron"&gt;&lt;a href="#convex-polyhedron" class="header-anchor"&gt;&lt;/a&gt;Convex polyhedron
&lt;/h4&gt;&lt;ol&gt;
&lt;li&gt;According to the surface data structure, take the vertex data and compute the outward normal of the surface
&lt;ul&gt;
&lt;li&gt;line vector;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Compute the value of the component of the outward normal in the projection direction;&lt;/li&gt;
&lt;li&gt;Determine the visibility of the surface according to the value of the component;&lt;/li&gt;
&lt;li&gt;When B&amp;gt;0, 0o≤a &amp;lt; 90o, the surface faces the observer and is visible.&lt;/li&gt;
&lt;li&gt;If the surface is visible, draw it; otherwise process the next surface.&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 id="concave-polyhedron"&gt;&lt;a href="#concave-polyhedron" class="header-anchor"&gt;&lt;/a&gt;Concave polyhedron
&lt;/h4&gt;&lt;ol&gt;
&lt;li&gt;First compute the outward normal of the surface, and compute the direction cosine value cosa in its projection direction;&lt;/li&gt;
&lt;li&gt;Determine visibility according to the direction cosine value;&lt;/li&gt;
&lt;li&gt;For front-facing surfaces, compute the maximum depth value of the surface;&lt;/li&gt;
&lt;li&gt;Compute the coordinates of the box corners of the front-facing surface;&lt;/li&gt;
&lt;li&gt;Take the surface with the maximum depth value as the current surface;&lt;/li&gt;
&lt;li&gt;Loop to compute the occlusion relationship between other surfaces and the current surface.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="what-is-the-basic-principle-of-the-depth-buffer-hidden-surface-removal-algorithm-write-out-its-algorithm-steps"&gt;&lt;a href="#what-is-the-basic-principle-of-the-depth-buffer-hidden-surface-removal-algorithm-write-out-its-algorithm-steps" class="header-anchor"&gt;&lt;/a&gt;What is the basic principle of the depth buffer hidden surface removal algorithm? Write out its algorithm steps.
&lt;/h3&gt;&lt;p&gt;For each pixel on the screen, record the depth value of the scene surface within that pixel closest to the observer, and at the same time record all recorded values of the color (or grayscale) of that scene surface, and output the graphic according to the recorded data.&lt;/p&gt;
&lt;p&gt;Allocate a memory array; initialize the array; loop to compute the depth value of each pixel.&lt;/p&gt;
&lt;h3 id="explain-outward-normal-front-facing-surface-and-convex-polygon"&gt;&lt;a href="#explain-outward-normal-front-facing-surface-and-convex-polygon" class="header-anchor"&gt;&lt;/a&gt;Explain outward normal, front-facing surface, and convex polygon.
&lt;/h3&gt;&lt;p&gt;Outward normal: a line pointing from the interior of the shape to the exterior, or from the shape surface to external space.&lt;/p&gt;
&lt;p&gt;Front-facing surface: indicates that the surface normal points forward, and the surface is visible.&lt;/p&gt;
&lt;p&gt;Back-facing surface: indicates that the surface normal points backward, and the surface is not visible.&lt;/p&gt;
&lt;p&gt;Convex polygon: the line segment connecting any two points of the polygon lies inside the polygon.&lt;/p&gt;
&lt;h3 id="briefly-describe-color-models-and-be-able-to-explain-the-rgb-model-space-and-common-colors"&gt;&lt;a href="#briefly-describe-color-models-and-be-able-to-explain-the-rgb-model-space-and-common-colors" class="header-anchor"&gt;&lt;/a&gt;Briefly describe color models, and be able to explain the RGB model space and common colors
&lt;/h3&gt;&lt;p&gt;A color model refers to a set of visible photons in a 3D color space, which contains all colors in a certain color gamut. Most color graphics display devices generally use the three primary colors red, green, and blue, and the main color model in our photorealistic graphics is also the RGB model.&lt;/p&gt;
&lt;h3 id="explain-illumination-model-ambient-light-pure-specular-reflected-light"&gt;&lt;a href="#explain-illumination-model-ambient-light-pure-specular-reflected-light" class="header-anchor"&gt;&lt;/a&gt;Explain: illumination model, ambient light, pure specular reflected light
&lt;/h3&gt;&lt;p&gt;Illumination model: a mathematical expression, based on relevant laws of optical physics, for computing the luminous intensity and color composition of light projected from each point on an object&amp;rsquo;s surface into the observer&amp;rsquo;s eye. (A mathematical model capable of computing the lighting effect of a scene given the physical form of the object and the properties of the light source)&lt;/p&gt;
$$incident light=diffuse reflected light+specular reflection+ambient light$$&lt;ul&gt;
&lt;li&gt;Diffuse reflected light: the optical phenomenon when light strikes a rough, lusterless surface.
&lt;ul&gt;
&lt;li&gt;Characteristics: comes from one direction and is reflected in all directions.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Ambient light: the optical phenomenon when light strikes a rough, lusterless surface. (The indirect influence of the light source on the object; it is the light that finally reaches equilibrium after multiple reflections between the object and the environment.)
&lt;ul&gt;
&lt;li&gt;Characteristics: comes from one direction and is reflected in all directions.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Specular reflected light: the optical phenomenon when light strikes a very smooth object surface
&lt;ul&gt;
&lt;li&gt;Characteristics: the light source comes from one direction, and the reflected light is concentrated in the reflection direction.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="briefly-describe-the-composition-and-construction-steps-of-the-simple-light-reflection-model"&gt;&lt;a href="#briefly-describe-the-composition-and-construction-steps-of-the-simple-light-reflection-model" class="header-anchor"&gt;&lt;/a&gt;Briefly describe the composition and construction steps of the simple light reflection model.
&lt;/h3&gt;&lt;p&gt;Assumptions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The light source is a point light source&lt;/li&gt;
&lt;li&gt;The object is opaque&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Simulate the reflection phenomenon produced when light strikes an object surface.&lt;/p&gt;
$$incident light=diffuse reflected light+specular reflected light+ambient light$$&lt;h3 id="briefly-describe-the-computation-process-of-the-bilinear-interpolation-intensity-or-normal-algorithm"&gt;&lt;a href="#briefly-describe-the-computation-process-of-the-bilinear-interpolation-intensity-or-normal-algorithm" class="header-anchor"&gt;&lt;/a&gt;Briefly describe the computation process of the bilinear interpolation (intensity or normal) algorithm.
&lt;/h3&gt;&lt;h4 id="intensity-interpolation-method"&gt;&lt;a href="#intensity-interpolation-method" class="header-anchor"&gt;&lt;/a&gt;Intensity interpolation method
&lt;/h4&gt;&lt;ol&gt;
&lt;li&gt;Compute the outward normal vector of the polygon surface;&lt;/li&gt;
&lt;li&gt;Compute the normal vector at each vertex of the polygon;&lt;/li&gt;
&lt;li&gt;Compute the intensity value at each vertex;&lt;/li&gt;
&lt;li&gt;Compute the intensity values at the intersections of the scan line with the polygon edges;&lt;/li&gt;
&lt;li&gt;Compute the intensity values at each point on the scan line.&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 id="normal-vector-interpolation-method"&gt;&lt;a href="#normal-vector-interpolation-method" class="header-anchor"&gt;&lt;/a&gt;Normal vector interpolation method
&lt;/h4&gt;&lt;ol&gt;
&lt;li&gt;Compute the outward normal vector of each polygon face according to the vertex information;&lt;/li&gt;
&lt;li&gt;Compute the normal vector at each vertex of the polygon;&lt;/li&gt;
&lt;li&gt;Compute the normal vectors at the intersections of the scan line with the polygon edges;&lt;/li&gt;
&lt;li&gt;Compute the normal vectors at points on the scan line;&lt;/li&gt;
&lt;li&gt;Compute the intensity values at each point on the scan line.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="chapter-9"&gt;&lt;a href="#chapter-9" class="header-anchor"&gt;&lt;/a&gt;Chapter 9
&lt;/h2&gt;&lt;h3 id="what-techniques-are-included-in-basic-interaction-techniques"&gt;&lt;a href="#what-techniques-are-included-in-basic-interaction-techniques" class="header-anchor"&gt;&lt;/a&gt;What techniques are included in basic interaction techniques?
&lt;/h3&gt;&lt;p&gt;Positioning, selection, numeric input, text output.&lt;/p&gt;
&lt;h3 id="what-are-the-ways-of-graphics-picking"&gt;&lt;a href="#what-are-the-ways-of-graphics-picking" class="header-anchor"&gt;&lt;/a&gt;What are the ways of graphics picking?
&lt;/h3&gt;&lt;p&gt;Point picking, line segment picking, region picking, accelerated graphics picking.&lt;/p&gt;
&lt;h3 id="what-are-rubber-banding-and-double-buffering-what-is-the-relationship-between-them"&gt;&lt;a href="#what-are-rubber-banding-and-double-buffering-what-is-the-relationship-between-them" class="header-anchor"&gt;&lt;/a&gt;What are rubber banding and double buffering? What is the relationship between them?
&lt;/h3&gt;&lt;p&gt;Rubber banding technique: rubber banding refers to the straight lines and curves that follow the cursor during drawing; when the cursor moves, the shape changes accordingly, that is, a dynamically changing process.&lt;/p&gt;
&lt;p&gt;Double buffering technique: create another buffer in memory. When the graphics on the screen change, the refresh of the framebuffer is performed in the background, and what is seen on the screen is only the refreshed and redrawn graphics, so screen changes become coherent and smooth.&lt;/p&gt;
&lt;h3 id="what-is-a-primitive-group"&gt;&lt;a href="#what-is-a-primitive-group" class="header-anchor"&gt;&lt;/a&gt;What is a primitive group?
&lt;/h3&gt;&lt;p&gt;Primitive group: a group formed by merging a set of related primitives&lt;/p&gt;
&lt;h3 id="what-constraints-does-geometric-constraint-mainly-include"&gt;&lt;a href="#what-constraints-does-geometric-constraint-mainly-include" class="header-anchor"&gt;&lt;/a&gt;What constraints does geometric constraint mainly include?
&lt;/h3&gt;&lt;p&gt;Positioning constraints, orientation constraints, regularity constraints.&lt;/p&gt;
&lt;h2 id="terminology"&gt;&lt;a href="#terminology" class="header-anchor"&gt;&lt;/a&gt;Terminology
&lt;/h2&gt;&lt;h3 id="constructed-curve"&gt;&lt;a href="#constructed-curve" class="header-anchor"&gt;&lt;/a&gt;Constructed curve
&lt;/h3&gt;&lt;p&gt;Given a set of ordered discrete points Pi (i=0, 1, &amp;hellip;, n), a curve can be constructed through these control points.&lt;/p&gt;
&lt;h3 id="interpolating-curve"&gt;&lt;a href="#interpolating-curve" class="header-anchor"&gt;&lt;/a&gt;Interpolating curve
&lt;/h3&gt;&lt;p&gt;Construct a curve by establishing a mathematical model so that the curve passes through the given data points in order; the constructed curve is called an interpolating curve.&lt;/p&gt;
&lt;h3 id="data-point"&gt;&lt;a href="#data-point" class="header-anchor"&gt;&lt;/a&gt;Data point
&lt;/h3&gt;&lt;p&gt;When constructing a curve, the curve passes through each given point in order; these points are called data points.&lt;/p&gt;
&lt;h3 id="curve-approximation"&gt;&lt;a href="#curve-approximation" class="header-anchor"&gt;&lt;/a&gt;Curve approximation
&lt;/h3&gt;&lt;p&gt;When a set of given discrete points is used and a mathematical model is established so that the constructed curve is closest to the given data points in some sense, this is called approximating these data points, and the constructed curve is called an approximating curve.&lt;/p&gt;
&lt;h3 id="control-point"&gt;&lt;a href="#control-point" class="header-anchor"&gt;&lt;/a&gt;Control point
&lt;/h3&gt;&lt;p&gt;A special shape point used to control or adjust the shape of a curve, while the curve itself does not pass through this point.&lt;/p&gt;
&lt;h3 id="fitting"&gt;&lt;a href="#fitting" class="header-anchor"&gt;&lt;/a&gt;Fitting
&lt;/h3&gt;&lt;p&gt;The collective term for interpolation and approximation methods.&lt;/p&gt;
&lt;h3 id="computer-graphics"&gt;&lt;a href="#computer-graphics" class="header-anchor"&gt;&lt;/a&gt;Computer graphics
&lt;/h3&gt;&lt;p&gt;The theories, methods, and techniques for using computers to build, store, and process a model of an object, and to produce graphical output of that object according to the model, are called computer graphics.&lt;/p&gt;
&lt;h3 id="computer-graphics-standards"&gt;&lt;a href="#computer-graphics-standards" class="header-anchor"&gt;&lt;/a&gt;Computer graphics standards
&lt;/h3&gt;&lt;p&gt;Computer graphics standards refer to interface standards for data transmission and communication between the graphics system and its related application programs.&lt;/p&gt;
&lt;h3 id="graphics-hidden-surface-removal"&gt;&lt;a href="#graphics-hidden-surface-removal" class="header-anchor"&gt;&lt;/a&gt;Graphics hidden surface removal
&lt;/h3&gt;&lt;p&gt;In order to reflect real graphics, the computer eliminates hidden parts from the image.&lt;/p&gt;
&lt;h3 id="geometric-transformation"&gt;&lt;a href="#geometric-transformation" class="header-anchor"&gt;&lt;/a&gt;Geometric transformation
&lt;/h3&gt;&lt;p&gt;The basic method of geometric transformation is to treat the transformation matrix as an operator and apply it to the position vectors of a series of vertices of the graphic, thereby obtaining a new vertex sequence for these vertices after the geometric transformation. Connecting the new vertex sequence yields the transformed graphic.&lt;/p&gt;
&lt;h3 id="computational-geometry"&gt;&lt;a href="#computational-geometry" class="header-anchor"&gt;&lt;/a&gt;Computational geometry
&lt;/h3&gt;&lt;p&gt;Computational geometry is the discipline that studies geometric models and data processing. It discusses the computer representation, analysis, and synthesis of geometric shapes, and studies how to conveniently, flexibly, and effectively establish mathematical models of geometric shapes and better store and manage these model data in computers.&lt;/p&gt;
&lt;h3 id="clipping"&gt;&lt;a href="#clipping" class="header-anchor"&gt;&lt;/a&gt;Clipping
&lt;/h3&gt;&lt;p&gt;The process of identifying the parts of a graphic inside and outside a specified region is called a clipping algorithm, or clipping for short.&lt;/p&gt;
&lt;h3 id="perspective-projection"&gt;&lt;a href="#perspective-projection" class="header-anchor"&gt;&lt;/a&gt;Perspective projection
&lt;/h3&gt;&lt;p&gt;The perspective projection of any point in space is the intersection of the projection line formed by the projection center and the spatial point with the projection plane.&lt;/p&gt;
&lt;h3 id="projection-transformation"&gt;&lt;a href="#projection-transformation" class="header-anchor"&gt;&lt;/a&gt;Projection transformation
&lt;/h3&gt;&lt;p&gt;The transformation that converts a 3D object into a 2D graphic representation is called projection transformation.&lt;/p&gt;
&lt;h3 id="aliasing"&gt;&lt;a href="#aliasing" class="header-anchor"&gt;&lt;/a&gt;Aliasing
&lt;/h3&gt;&lt;p&gt;When drawing non-horizontal and non-vertical lines or polygon boundaries on a raster display, jagged edges will appear to a greater or lesser extent. This is because the corresponding graphics of lines or polygon boundaries on a raster display are all composed of a series of discrete pixels of the same brightness. This distortion caused by representing continuous quantities with discrete quantities is called aliasing.&lt;/p&gt;
&lt;h3 id="anti-aliasing"&gt;&lt;a href="#anti-aliasing" class="header-anchor"&gt;&lt;/a&gt;Anti-aliasing
&lt;/h3&gt;&lt;p&gt;Techniques used to reduce and eliminate the distortion effect caused by representing continuous quantities with discrete quantities are called anti-aliasing.&lt;/p&gt;
&lt;h3 id="window"&gt;&lt;a href="#window" class="header-anchor"&gt;&lt;/a&gt;Window
&lt;/h3&gt;&lt;p&gt;The range of world coordinates is infinite. In order to give the objects in the world coordinate system displayed on normalized device coordinates a suitable range and size, a display range must first be specified for the world coordinate system. It is usually a rectangle, and this rectangle is called a window.&lt;/p&gt;
&lt;h3 id="viewport"&gt;&lt;a href="#viewport" class="header-anchor"&gt;&lt;/a&gt;Viewport
&lt;/h3&gt;&lt;p&gt;A rectangular region corresponding to the window must also be specified on the normalized device coordinate system to display the contents of the window. This rectangle is called the viewport.&lt;/p&gt;
&lt;h3 id="coordinate-system"&gt;&lt;a href="#coordinate-system" class="header-anchor"&gt;&lt;/a&gt;Coordinate system
&lt;/h3&gt;&lt;p&gt;The reference framework used to describe, analyze, and measure the size, shape, position, orientation, and various relationships among geometric objects is called a coordinate system.&lt;/p&gt;
&lt;h3 id="user-coordinate-system"&gt;&lt;a href="#user-coordinate-system" class="header-anchor"&gt;&lt;/a&gt;User coordinate system
&lt;/h3&gt;&lt;p&gt;The user coordinate system is the coordinate system used by users when processing their own graphics, and the units are determined by the users themselves.&lt;/p&gt;
&lt;h3 id="normalized-device-coordinate-system-1"&gt;&lt;a href="#normalized-device-coordinate-system-1" class="header-anchor"&gt;&lt;/a&gt;Normalized device coordinate system
&lt;/h3&gt;&lt;p&gt;The device coordinate system obtained by converting the data in each device coordinate system into a unified data range.&lt;/p&gt;
&lt;h3 id="normalization-transformation"&gt;&lt;a href="#normalization-transformation" class="header-anchor"&gt;&lt;/a&gt;Normalization transformation
&lt;/h3&gt;&lt;p&gt;Graphics software automatically implements the conversion from world coordinates to normalized device coordinates according to the one-to-one correspondence between the window and the viewport. This transformation from window to viewport is called normalization transformation.&lt;/p&gt;
&lt;h2 id="algorithm-analysis-problems"&gt;&lt;a href="#algorithm-analysis-problems" class="header-anchor"&gt;&lt;/a&gt;Algorithm Analysis Problems
&lt;/h2&gt;&lt;h3 id="digital-differential-analyzer-method"&gt;&lt;a href="#digital-differential-analyzer-method" class="header-anchor"&gt;&lt;/a&gt;Digital differential analyzer method
&lt;/h3&gt;&lt;p&gt;The DDA algorithm is called the digital differential analyzer line drawing algorithm, and it draws a line according to the differential equation of the line. According to the degree of slope deviation, it decides whether to use x or y as the stepping direction. Then, in the corresponding stepping direction, the step vector increases by one pixel each time, and the other related coordinate variable can also be obtained from the slope.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Determine dm=max(|△x|,|△y|) according to whether the line slope is greater than 1.&lt;/li&gt;
&lt;li&gt;Determine the step size of the other direction relative to the counting direction.&lt;/li&gt;
&lt;li&gt;According to the change of 1 in the counting direction and the obtained step size in the other direction, loop to draw points until the counting direction reaches dm and ends.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="point-by-point-comparison-method"&gt;&lt;a href="#point-by-point-comparison-method" class="header-anchor"&gt;&lt;/a&gt;Point-by-point comparison method
&lt;/h3&gt;&lt;p&gt;During the drawing process, each stroke (step) is compared with the standard graphic, and then the direction of the next step is determined, drawing the specified graphic by step-by-step approximation.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Set the stepping direction in different quadrants, in principle minimizing the approximation error and keeping the pen movement direction consistent with the drawing trend.&lt;/li&gt;
&lt;li&gt;Start drawing from the start point: first lift the pen to the start point.&lt;/li&gt;
&lt;li&gt;Deviation calculation: compute the position deviation of the current point relative to the line.
&lt;ul&gt;
&lt;li&gt;Compute according to the deviation judgment formula.&lt;/li&gt;
&lt;li&gt;Compute according to the recurrence formula.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Endpoint judgment.
&lt;ul&gt;
&lt;li&gt;Coordinate judgment: Xm≥Xa, Ym≥Ya&lt;/li&gt;
&lt;li&gt;Step count control: that is, the number of steps in one direction and the total number of steps.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="bresenham-algorithm"&gt;&lt;a href="#bresenham-algorithm" class="header-anchor"&gt;&lt;/a&gt;Bresenham algorithm
&lt;/h3&gt;&lt;p&gt;The Bresenham algorithm is an improvement on the DDA algorithm and is the most widely used line generation algorithm. It uses addition, subtraction, and multiplication by 2 (that is, implemented by shift operations).&lt;/p&gt;
&lt;p&gt;Construct a set of virtual grid lines through the centers of pixels in each row and column, compute the intersections of the line with each vertical grid line in order from the start point to the end point, and then determine the pixel in that column closest to the intersection. Incremental computation can be used, so that for each column, it is only necessary to check the sign of an error term to determine the pixel sought in that column.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Assign the line start point to the moving point P(x, y);&lt;/li&gt;
&lt;li&gt;Compute the endpoint coordinate differences: dx and dy;&lt;/li&gt;
&lt;li&gt;Compute the total number of loop steps N and the value of di at the start point;&lt;/li&gt;
&lt;li&gt;Loop to compute the coordinates of intermediate interpolated points:&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If the current step count ≥ N, the program ends. Otherwise:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Display the current point P;&lt;/li&gt;
&lt;li&gt;If di is greater than 0, add 1 to the y coordinate;&lt;/li&gt;
&lt;li&gt;Compute the current value of di;&lt;/li&gt;
&lt;li&gt;Add 1 to the x coordinate.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="midpoint-line-algorithm"&gt;&lt;a href="#midpoint-line-algorithm" class="header-anchor"&gt;&lt;/a&gt;Midpoint line algorithm
&lt;/h3&gt;&lt;p&gt;Midpoint line algorithm: assume that the line slope k is between 0 and 1, and the current pixel point is (xp, yp). Then the next pixel point has two possible choices: P1 (xp+1, yp) or P2 (xp+1, yp+1). If the midpoint of P1 and P2, (xp+1, yp+0.5), is called M, and Q is the intersection of the ideal line with the vertical line x=xp+1, then when M is below Q, P2 should be taken as the next pixel point; when M is above Q, P1 should be taken as the next pixel point; if M coincides with Q, either P1 or P2 may be chosen. Other slopes are handled similarly.&lt;/p&gt;
&lt;p&gt;Algorithm steps of the midpoint line algorithm:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Input the two endpoints P1(x1, y1) and P2(x2, y2) of the line segment, and ensure x1&amp;lt;x2 by comparison.&lt;/li&gt;
&lt;li&gt;Initialization: dy, dx, d=dy+0.5dx, x=x1, y=y1, draw point (x, y); if -1&amp;lt;k&amp;lt;0, then x=x2, y=y2.&lt;/li&gt;
&lt;li&gt;Loop to draw points.
&lt;ul&gt;
&lt;li&gt;0≤k≤1&lt;/li&gt;
&lt;/ul&gt;
&lt;ol&gt;
&lt;li&gt;If x&amp;lt;x2, execute the following steps; otherwise the algorithm ends.&lt;/li&gt;
&lt;li&gt;Judge the sign of d; if d&amp;lt;0, update (x, y) to (x+1, y+1), and update d to d+a+b; otherwise update (x, y) to (x+1, y), and update d to d+a.&lt;/li&gt;
&lt;li&gt;Draw point (x, y).&lt;/li&gt;
&lt;/ol&gt;
&lt;ul&gt;
&lt;li&gt;1&amp;lt;k&amp;lt;0&lt;/li&gt;
&lt;/ul&gt;
&lt;ol&gt;
&lt;li&gt;If x&amp;gt;x1, execute the following steps; otherwise the algorithm ends.&lt;/li&gt;
&lt;li&gt;Judge the sign of d; if d&amp;lt;0, update (x, y) to (x-1, y+1), and update d to d-a+b; otherwise update (x, y) to (x-1, y), and update d to d-a.&lt;/li&gt;
&lt;li&gt;Draw point (x, y).&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="simple-seed-filling-algorithm"&gt;&lt;a href="#simple-seed-filling-algorithm" class="header-anchor"&gt;&lt;/a&gt;Simple seed filling algorithm
&lt;/h3&gt;&lt;p&gt;Assume that a point in the region is known and use it as a seed. Starting from this point, search along the connected direction of the region for points adjacent to the seed and inside the region, make them new seeds, and then continue searching recursively. If an adjacent point is not inside the region, the boundary has been reached.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Determine the boundary and the attributes of the boundary;&lt;/li&gt;
&lt;li&gt;Determine the attribute value for region filling;&lt;/li&gt;
&lt;li&gt;Test the attribute value of a point in the region to determine whether it is inside the filling region and has not been filled,&lt;/li&gt;
&lt;li&gt;If it is inside the region and its attribute value differs from the boundary, assign the filling attribute and use this point as a seed;&lt;/li&gt;
&lt;li&gt;Along the 4-connected (or 8-connected) directions, test other points;&lt;/li&gt;
&lt;li&gt;Compare each tested point with the boundary attribute; if different, assign the filling attribute;&lt;/li&gt;
&lt;li&gt;If the same, the boundary has been reached, then turn to another connectivity direction;&lt;/li&gt;
&lt;li&gt;The testing of all points is implemented in a recursive loop.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="scan-line-seed-filling-algorithm"&gt;&lt;a href="#scan-line-seed-filling-algorithm" class="header-anchor"&gt;&lt;/a&gt;Scan line seed filling algorithm
&lt;/h3&gt;&lt;p&gt;Use scan lines to scan from top to bottom a multi-segment polygon composed of point line segments. Each scan line produces a series of intersections with the polygon edges. Sort the intersections by x (or y) coordinate, then take them in pairs as two endpoints and draw a horizontal line with the fill color.&lt;/p&gt;
&lt;p&gt;When a seed point is given, first fill a segment on the scan line containing the seed point that lies within the given region, then determine the segments within the given region on the upper and lower scan lines connected to this segment, and save them in turn. Repeat this process until filling is complete.&lt;/p&gt;
&lt;h3 id="scan-line-algorithm"&gt;&lt;a href="#scan-line-algorithm" class="header-anchor"&gt;&lt;/a&gt;Scan line algorithm
&lt;/h3&gt;&lt;p&gt;Use region continuity, scan line continuity, and boundary continuity.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Sort the region boundary vertices by Y coordinate;&lt;/li&gt;
&lt;li&gt;Determine the intervals of the scan lines;&lt;/li&gt;
&lt;li&gt;Build the active edge table of boundary edges;&lt;/li&gt;
&lt;li&gt;Find intersections: compute the intersections of the current scan line with all edges of the polygon;&lt;/li&gt;
&lt;li&gt;Sort intersections: sort all intersections in increasing order of x value;&lt;/li&gt;
&lt;li&gt;Pair intersections: pair the sorted intersections into intervals;&lt;/li&gt;
&lt;li&gt;Fill colors: set the pixel values in each interval to the target color value.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The specific algorithm steps are as follows:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Initialize the edge table ET: store each edge of the polygon in the ET bucket corresponding to its ymin value according to that edge&amp;rsquo;s ymin value.&lt;/li&gt;
&lt;li&gt;Initialize the active edge table AET as an empty table.&lt;/li&gt;
&lt;li&gt;Set the y value to the minimum y value listed in ET, that is, the y value of the first non-empty bucket.&lt;/li&gt;
&lt;li&gt;Repeat the following steps until both AET and ET are empty:
&lt;ol&gt;
&lt;li&gt;When the y value of the scan line becomes greater than or equal to the value of a certain y bucket in ET, add all nodes of that bucket to AET (and delete them from ET at the same time), and sort the records in AET by x value.&lt;/li&gt;
&lt;li&gt;For scan line y, fill the required pixel values between each pair of intersections.&lt;/li&gt;
&lt;li&gt;Delete entries in AET with y&amp;gt;ymax.&lt;/li&gt;
&lt;li&gt;Update the x value of all remaining nodes in AET, replacing x with x+1/m. (When a node enters AET in the current loop iteration, its recorded x value is xmin.)&lt;/li&gt;
&lt;li&gt;Re-sort the nodes in AET by x value.&lt;/li&gt;
&lt;li&gt;Increment y by 1 and enter the next loop iteration.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="line-encoding-clipping-algorithm"&gt;&lt;a href="#line-encoding-clipping-algorithm" class="header-anchor"&gt;&lt;/a&gt;Line encoding clipping algorithm
&lt;/h3&gt;&lt;p&gt;Extend the window boundaries to divide the plane into 9 regions, encode each region with a 4-bit binary number, and determine positions according to the encoded values or logical operations.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Endpoint encoding
Positions from the left: the 1st bit is 1 if the endpoint is above yT, that is, y&amp;gt;yT; the 2nd bit is 1 if the endpoint is below yB, that is, y&amp;lt;yB; the 3rd bit is 1 if the endpoint is to the right of xR, that is, x&amp;gt;xR; the 4th bit is 1 if the endpoint is to the left of xL, that is, x&amp;lt;xL; otherwise, the corresponding position is 0.&lt;/li&gt;
&lt;li&gt;Determine positions according to the encoded values or logical operations.
&lt;ol&gt;
&lt;li&gt;If the 4-bit codes of both endpoints of a line segment are all 0, then the line segment is inside the window and can be output directly;&lt;/li&gt;
&lt;li&gt;If the logical AND (bitwise product) of the codes of the two endpoints is not 0, then the line segment is entirely outside the window and is discarded;&lt;/li&gt;
&lt;li&gt;Otherwise, the line segment intersects the window, so find the intersection.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;Intersection process
&lt;ol&gt;
&lt;li&gt;Find the intersection of the line with the window boundary, use the intersection to split the line segment, and discard the part beyond the intersection&lt;/li&gt;
&lt;li&gt;Use the intersection as a boundary to further test for intersections and split&lt;/li&gt;
&lt;li&gt;Clipping order: according to the encoded value;&lt;/li&gt;
&lt;li&gt;Termination criterion: all encoded values are zero.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="outward-normal-hidden-surface-removal-algorithm"&gt;&lt;a href="#outward-normal-hidden-surface-removal-algorithm" class="header-anchor"&gt;&lt;/a&gt;Outward normal hidden surface removal algorithm
&lt;/h3&gt;&lt;p&gt;Outward normal hidden surface removal algorithm: used for hidden surface removal of planar solids&lt;/p&gt;
&lt;p&gt;Algorithm steps for hidden surface removal of an arbitrary planar solid:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;First compute the outward normal of the surface, and compute the direction cosine value cosa in its projection direction;&lt;/li&gt;
&lt;li&gt;Determine visibility according to the direction cosine value: cosa&amp;gt;0 front-facing; cosa≤0 back-facing&lt;/li&gt;
&lt;li&gt;For front-facing surfaces, compute the maximum depth value of the surface;&lt;/li&gt;
&lt;li&gt;Compute the coordinates of the box corners of the front-facing surface;&lt;/li&gt;
&lt;li&gt;Take the surface with the maximum depth value as the current surface;&lt;/li&gt;
&lt;li&gt;Loop to compute the occlusion relationship between other surfaces and the current surface;
&lt;ol&gt;
&lt;li&gt;Extract each edge of the surface and determine its relationship with the current surface: fully occluded, completely unoccluded, or partially occluded;&lt;/li&gt;
&lt;li&gt;If fully occluded, treat it as an invisible edge and delete it or change its line style;&lt;/li&gt;
&lt;li&gt;If completely unoccluded, treat it as a visible edge and draw it;&lt;/li&gt;
&lt;li&gt;If partially occluded, use line segment clipping to find the part of the line segment outside the polygon: the visible line segment, and draw it;&lt;/li&gt;
&lt;li&gt;For the part of the line segment inside the polygon: the invisible line segment, delete it or change its line style.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="depth-buffer-hidden-surface-removal-algorithm"&gt;&lt;a href="#depth-buffer-hidden-surface-removal-algorithm" class="header-anchor"&gt;&lt;/a&gt;Depth buffer hidden surface removal algorithm
&lt;/h3&gt;&lt;p&gt;The basic idea of the depth buffer hidden surface removal algorithm is: compare the depths of all patches (planes or surfaces) corresponding to each pixel of the projection plane, and then take the attribute value of the patch closest to the line of sight as the attribute value of that pixel.&lt;/p&gt;
&lt;p&gt;Initially, all units of the depth buffer are set to the minimum z value, and each unit of the frame buffer is set to the background color. Then process each patch in the polygon table one by one. For each scan line, compute the depth value z(x, y) corresponding to each pixel point (x, y) in that row, and compare the depth with the depth value ZB(x, y) stored in that pixel unit in the depth buffer.&lt;/p&gt;
&lt;p&gt;If Z&amp;gt;ZB(x, y), then ZB(x, y)=z, and at the same time write the attribute value I(x, y) of that pixel into the frame buffer, that is, FB(x, y)=i(x, y); otherwise leave it unchanged.&lt;/p&gt;</description></item></channel></rss>