Study notes 28 (bump map, normal map, displacement map)

Three textures for highlighting the surface details of objects: bump/Normal and displacement

The first two are essentially the same. One is to store height difference information, and the other is to store normal information. Even if the height difference is calculated, it is the normal after the height change. In general, they both create fake bump details.

It's different for the third one, he really offsets the vertices on the surface of the object. Note that there is no way to offset the vertices and pixels. When fragments appear, they are the result of projection. The cheapness must be carried out in 3D space, and they can only be projected after offsetting. There is no such thing as fragment before projection. The only thing we can manipulate is the vertices, and let the vertices make an offset in 3D space.

The displacement map mentioned below should be displacement.

Explanation of the principle of normal and displacement maps and baking production! - Zhihu (zhihu.com)

Therefore, if you want to achieve real bumps, you need to use the displacement map, and the realization of this map is to offset the position of the vertices. If the vertices are relatively sparse, then this vertex offset cannot bring better bumps. Effect.

However, we directly provide a high-precision model that consumes a lot, so dynamic subdivision appears, providing low-mode, subdividing low-mode to get more vertices, and then offsetting the vertices accordingly to get the real Lumpy effect.

There is also mention of footprints in the snow, which can be optimized using a tessellation shader.

The high-precision model is not directly used here, but the surface subdivision is used because this guy can use his brain. He will adjust where subdivision is needed, where it is not needed, and where it needs subdivision according to information such as distance and some rules. , where a rough subdivision is required.

Hull mainly defines the parameters of subdivision: such as how to subdivide on the edge and how to subdivide inside the triangle.

Domin shader, since our subdivision point is in the center of gravity space, we need to restore it to the original space here.

There will be an input parameter, patch, the geometry of multiple vertices, and a set of attributes will be passed in at the same time. This attribute is shared by these vertices, that is, for this patch.

This is an explanation. As for how to divide a line, it can be divided equally, or it can be divided into the following two methods. I don’t understand it. But the following two seem to exist for a smoother transition.

This is how he added the triangle when he added it internally.

For example, in the first one, if he specifies 3 here, then the side will be divided into 3 parts (this has nothing to do with how many parts are divided into one side above, this part is divided into three parts to find the auxiliary points for internal points)

Then the vertical line passing through this point is extended, and the intersection point of two vertical lines can be found.

The geometry shader is the input primitive, and then based on the input primitive vertices, constructs a new vertex or uses the vertices of the original primitive, and finally combines a new primitive output.

Guess you like

Origin blog.csdn.net/yinianbaifaI/article/details/127702769
Map
map
Map
map