Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
lmj01 committed Sep 11, 2024
1 parent b442ae7 commit bca6947
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 17 deletions.
22 changes: 22 additions & 0 deletions cg/geometry.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,28 @@
- [Polygon Mesh Processing书籍](/cg/mesh/PolygonMeshProcessing.md)
- [Isogeometric Anylasis](/cg/mesh/IsogeometricAnylasis.md)


## Normal

- [Tangent正切线](/cg/mesh/tangnent.md)

几何法线Geometric Normal通常指的是在几何建模阶段为每个顶点计算的法线向量,它代表了在该顶点处表面的平滑近似。

- 顶点法线,计算每个顶点相连的的所有三角形的面法线的平均值来得到顶点法线。
-


- Normals in geometry a normal is a vector or a line that is perpendicular to a given object (e.g. plane normal, vertex normal ).
- Normals in graphics are usually used for light calculations, such as calculating Diffuse reflection across a surface by taking the dot product between the light direction and surface normals. Normals are usually calculated based on the geometrical properties of the mesh (Faces/Vertices), by taking the cross product of any two non-parallel edges that lies on the same plane.
- In OpenGL normals are specified per vertex (hence called vertex attributes) even though they might be calculated only for each face in this case you need to specifiy the same normal for each vertex in a face. Normals can be interpolated by OpenGL across each vertex of a face(triangle) so you can calculate the reflected light per pixel not per vertex, hence giving a more accurate result.



### threejs

在文件src\core\BufferGeometry.js中有计算computeVertexNormals就是对每个顶点计算其所在面的法线
三个点中任意两两构成共面的法向量相乘得到其面的法线,作为顶点的法线,**注意VertexNormal只算了当前面片的法线**,并没有像光照时的理论上那样把每个相邻的取均值。

## Projective Geometric Algebra

- [Projective Geometric Algebra](http://projectivegeometricalgebra.org/)
Expand Down
1 change: 1 addition & 0 deletions cg/graphics.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- [threejs社区](https://discourse.threejs.org/)

- [光照模型](/cg/lighting/illumination.model.md)
- [BumpMapping](/cg/lighting/bump.mapping.md)

早期3D的API由驱动层提供,所有细节都是驱动贴近硬件实现的,在经过shader发展中,现代硬件越来越复杂了
新时代的抽象图形接口vulkan来了,需要更具象化的过程,就是需要自己负责更多的事情
Expand Down
15 changes: 12 additions & 3 deletions cg/lighting/illumination.model.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,19 @@ $$

### Diffuse Reflection

- Rough surfaces tend to cause more diffuse reflection than smooth surfaces.

There are three types of diffuse reflection: Lambertian, Oren-Nayar, and Phong.
- Lambertian reflection, is the simplest type of diffuse reflection. It assumes that the surface is perfectly diffuse, meaning that the angle at which light hits the surface has no effect on how much light is reflected. This results in a smooth, even reflection without any highlights or shadows.

- Oren-Nayar reflection is a more realistic type of diffuse reflection that takes into account the fact that light doesn’t always hit a surface evenly. It accounts for both the angle at which light hits the surface and the roughness of the surface. This results in a more natural-looking reflection with highlights and shadows.

- Phong reflection is the most realistic type of diffuse reflection. It takes into account not only the angle at which light hits the surface and the roughness of the surface but also the shininess of the surface. This results in a very natural-looking reflection with highlights, shadows, and specular reflections (the bright highlights you see on polished surfaces).

$$
I_{diff} = K_{d}I_{p}cos\theta = K_{d}I_{p}(N \dot L) \newline
I_{p} \text{the point light intensity}, K_{d} \text{ surface diffuse reflectivity } \in [0,1], \newline
N \text{the surface normal}, L \text{the light direction}
R_{d} = K_{d} \times I \times max(0, N * L) = K_{d}I(N \cdot L) \newline
I \text{光照强度light intensity}, K_{d} \text{表面散射系数surface diffuse reflectivity } \in [0,1], \newline
N \text{表面法线the surface normal}, L \text{光照方向the light direction}
$$

- Normals in geometry a normal is a vector or a line that is perpendicular to a given object (e.g. plane normal, vertex normal ).
Expand Down
16 changes: 16 additions & 0 deletions cg/lighting/mapping.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Mapping

mapping映射是一个广泛的概念,通常指的是将一种数据或坐标系统转换为另一种数据或坐标系统的过程

## Bump Mapping

法线映射是一种技术,通过将详细的法线信息(通常存储在纹理中)应用到表面,来模拟复杂的表面细节和光照效果

它faking捏造 the lighting of bumps吐 and dents凹 (e.g. bump mapping, parallax mapping)

- J.F. Blinn. Simulation of wrinkled surfaces. In Proceedings of the 5th annual conference on Computer graphics and interactive techniques, pages 286–292, 1978

## Displacement mapping

## Environment Mapping
环境映射是一种反射效果,通过将周围环境的图像映射到对象的表面来创建反射效果
19 changes: 5 additions & 14 deletions cg/mesh/tangnent.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
# 三角面片

## Normal

### threejs

在文件src\core\BufferGeometry.js中有计算computeVertexNormals就是对每个顶点计算其所在面的法线
三个点中任意两两构成共面的法向量相乘得到其面的法线,作为顶点的法线,**注意VertexNormal只算了当前面片的法线**,并没有像光照时的理论上那样把每个相邻的取均值。

## Tangent
# Tangent

切线空间是一个局部坐标系,原点就是vertex顶点位置,通常Z轴与顶点的法线对齐,X轴由顶点的切线Tangent、y轴由顶点的副切线Bitangent定义。

- [Lesson 6bis: tangent space normal mapping](https://github.com/ssloy/tinyrenderer/wiki/Lesson-6bis:-tangent-space-normal-mapping)

### per-vertex tangent spaces
## per-vertex tangent spaces
- [Computing Tangent Space Basis Vectors for an Arbitrary Mesh](https://terathon.com/blog/tangent-space.html)
- [课件](https://www.cs.upc.edu/~virtual/G/index.php?dir=)
- [pdf](https://www.cs.upc.edu/~virtual/G/1.%20Teoria/06.%20Textures/Tangent%20Space%20Calculation.pdf)
Expand Down Expand Up @@ -90,7 +81,7 @@ $$

</details>

#### [threejs的Tangent支持](https://threejs.org/docs/#examples/en/utils/BufferGeometryUtils.computeMikkTSpaceTangents)
### [threejs的Tangent支持](https://threejs.org/docs/#examples/en/utils/BufferGeometryUtils.computeMikkTSpaceTangents)
```c
#ifdef USE_TANGENT
attribute vec4 tangent;
Expand All @@ -111,7 +102,7 @@ mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
normal = normalize( tbn * mapN );
```

### MikkTSpace
## MikkTSpace
- [Tangent Space Normal Maps](http://www.mikktspace.com/)
- [github c](https://github.com/mmikk/MikkTSpace)
- [MikkTSpace vertex tangent calculation for JavaScript/TypeScript/Node.js, using Web Assembly. ](https://github.com/donmccurdy/mikktspace-wasm)
Expand All @@ -134,7 +125,7 @@ MikkTSpace生成tangent space即使改变了点索引,面的顺序,删除pri

</details>

### [论文--重新审视褶皱表面的模拟Simulation of Wrinkled Surfaces Revisited](http://image.diku.dk/projects/media/morten.mikkelsen.08.pdf)
## [论文--重新审视褶皱表面的模拟Simulation of Wrinkled Surfaces Revisited](http://image.diku.dk/projects/media/morten.mikkelsen.08.pdf)

- wrinkled surface皱折面
- normal mapping is almost as common as texture mapping and directly supported in a wide range of graphics tools. However, normal mapping is hard to get right without following a strict set of rules. 正确的显示一定是约束在一些规则内才可以 A wrong implementation can lead to discontinuities in the shading.
1 change: 1 addition & 0 deletions index/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- [Blender](/cg/blender/index.md)

### 图形学
- [几何](/cg/geometry.md)
- [裁剪](/cg/tools/culling.md)
- [四元数](/cg/tools/quaternion.md)
- [meshlab](/cg/tools/meshlab.md)
Expand Down

0 comments on commit bca6947

Please sign in to comment.