[3D Vision] Graphics-grid mesh-texture mapping texture mapping-UVatlas related tutorials

The process of texture mapping

insert image description here

good information

Graphics foundation: texture mapping process : This article sorts out the general process of texture mapping, focusing on the texture sampling process. There are two main difficulties in texture mapping: one is the process of projection mapping, it is difficult to have a good way to match the three-dimensional space coordinates with the two-dimensional uv coordinates, and often requires manual adjustment by the modeler; the other is the process of texture sampling, especially When the texture is reduced, it is easy to produce aliasing, which requires a good texture sampling anti-aliasing algorithm.

Basics of Graphics - Texture - Texture Mapping Inventory : Focuses on the application of texture mapping, Material Map, Alpha Map, Bump Map, Normal Map, Relief Map, Displacement Map, Parallax Map, Textured Light, Shadow Map, Environment Map, the author will These applications are divided into six aspects: control shading information, control fragment transparency, change normal, change surface structure, shadow map, environment map.

Texture mapping : Explains the concept of texture mapping and explains the application of texture mapping (texture maps, normal maps, shadow maps). Explained tangent space , and its benefits: using tangent space can more intuitively see the change of normal through the normal map.

The above article introduces the complete process of texture mapping and the application of texture mapping, but the difficulty in texture mapping: the mapping method from 3D coordinates to UV coordinates is not introduced , it is said that it is manually adjusted by the art teacher. But if the mesh score is reduced and then over-scored, the number of vertices will change, not to mention the order, so I think there should be a program that can achieve manual adjustment. UVatlas developed by Microsoft seems to be able to achieve this function, called, texture coordinate reparameterization, or texture coordinate transformation

UVatlas study

Official Microsoft Tutorial -
Manually generating unique UV maps with UVatlas is often time-consuming and tedious: especially when the input geometry is complex and efficient/low-distortion texture space utilization. The image below shows an example mesh and its corresponding texture atlas.

insert image description here

This example shows the mesh (on the left), and the corresponding UV space normal map (on the right). Note that a texture atlas contains multiple groups, or clusters of data; each cluster is called a graph, and in the above In the example, normal data including a partial grid is displayed.

The D3DX UVAtlas API automatically generates optimal non-overlapping texture atlases. The API provides input parameters that allow you to:

Minimize texture stretching, distortion and undersampling.
Maximize texture space packing density for efficient memory usage.
Provides uniform sampling throughout the grid, minimizing discontinuities in the sampling frequency.

How UVAtlas works

In summary, it is actually divided into two steps:

  1. Partition the mesh into a parametric graph
  2. Package the graph into Atlas

Specific steps:

Partitioning and Parameterizing Mesh

First, the mesh is partitioned into graphs, then each graph is parameterized into its own [0, 1] UV space.
Cylinders can be parameterized by one graph; spheres, on the other hand, require two graphs, as shown in the figure below.
insert image description here
Meshes that can be parameterized using a single graph are classified as "self-states of disks", meaning that you can scatter infinitely flexible, infinitely stretched disks across the graph and cover the geometry perfectly. This stretching is called self-morphism and is a bidirectional function: it means you can go from one parameterization to another without losing information.

Very few practical grids can be parameterized in two dimensions without dividing the grid into clusters or graphs. The image below shows another example mesh and its corresponding texture atlas.
insert image description here

There are two parameters used to determine the number of charts created:

  • Maximum number of charts allowed in an atlas
  • Maximum stretch allowed per chart

The amount of stretch will determine the number of charts generated and the overall quality of the sampling. Stretch ranges from 0.0 (no stretch) to 1.0 (any amount of stretch). The highest quality is not stretched, and stretching means deformation.
insert image description here

some problems

  • What are the partition rules, and how to judge the partition boundary on the 3D model? 【According to the mutation of the normal direction?
  • How to parameterize to [0, 1] UV space, how to set the coordinates of the upper left corner of the chart?
  • When storing, each vertex of the mesh needs to store a [u,v] coordinate?

Package chart

some questions to be added

  • What is the packing order of charts? [According to the chart area from large to small, arrange from left to right and top to bottom on the atlas?
  • Each chart was originally in the range of [0, 1]. Now that they are packaged together, the coordinates need to be scaled. Are the scaling ratios of all charts consistent? How to determine the scaling ratio? [The zoom ratio should be consistent. If it is consistent, that is, after arranging the charts on the atlas, calculate the length of the following atlas, such as 4, to get the zoom ratio: 0.25]
  • When storing, the [u,v] coordinates of each vertex of the mesh are uniformly scaled, plus [the coordinate change coefficient of the chart on the atlas]

Guess you like

Origin blog.csdn.net/weixin_43693967/article/details/129684552