diff --git a/cg/graphics.md b/cg/graphics.md
index bbd58c0..1969c3f 100644
--- a/cg/graphics.md
+++ b/cg/graphics.md
@@ -3,6 +3,8 @@
- [Khronos社区](https://community.khronos.org/)
- [threejs社区](https://discourse.threejs.org/)
+- [光照模型](/cg/lighting/illumination.model.md)
+
早期3D的API由驱动层提供,所有细节都是驱动贴近硬件实现的,在经过shader发展中,现代硬件越来越复杂了
新时代的抽象图形接口vulkan来了,需要更具象化的过程,就是需要自己负责更多的事情
- 任务调度
diff --git a/cg/lighting/illumination.model.md b/cg/lighting/illumination.model.md
new file mode 100644
index 0000000..7f8c992
--- /dev/null
+++ b/cg/lighting/illumination.model.md
@@ -0,0 +1,52 @@
+# 光照模型
+
+Illumination model, also known as Shading model or Lighting model, is used to calculate the intensity of light that is reflected at a given point on surface.
+
+依赖三个元素
+- Light Source : Light source is the light emitting source.
+ - Point Sources
+ - Parallel Sources
+ - Distributed Sources
+- Surface : When light falls on a surface part of it is reflected and part of it is absorbed.
+- Observer : The observer’s position and sensor spectrum sensitivities also affect the lighting effect
+
+
+## 基础光照模型
+
+### Ambient Illumination
+
+$$
+I_{amb} = K_{a}I_{a} \newline
+I_{a} \text{ambient light intensity}, K_{a} \text{ surface ambient reflectivity } \in [0,1]
+$$
+
+### Diffuse Reflection
+
+$$
+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}
+$$
+
+- Normals in geometry a normal is a vector or a line that is perpendicular to a given object (e.g. plane normal, vertex normal ).
+ - 用于光照计算,如Diffuse reflection漫反射
+
+### Specular Reflection
+
+$$
+I_{spec} = W(\theta)I_{I}cos^{n}(\phi) = K_{s}I_{I}cos^{n}(\phi) \newline
+N \text{the surface normal}, L \text{the light direction} \newline
+R \text{direction of reflected ray}, V \text{direction of observer} \newline
+\theta \text{angle between L and R}, \phi \text{angle between R and V} \newline
+$$
+
+## 物理渲染模型
+
+### Physically Based Rendering
+
+[Monte Carlo Integration](https://64.github.io/monte-carlo/)
+
+
+## 参考
+
+- [Basic Illumination Models](https://www.geeksforgeeks.org/basic-illumination-models/)
\ No newline at end of file
diff --git a/cg/lighting/light.md b/cg/lighting/lights.md
similarity index 100%
rename from cg/lighting/light.md
rename to cg/lighting/lights.md
diff --git a/cg/lighting/pbr.md b/cg/lighting/pbr.md
deleted file mode 100644
index 774fe84..0000000
--- a/cg/lighting/pbr.md
+++ /dev/null
@@ -1,4 +0,0 @@
-# Physically Based Rendering
-
-[Monte Carlo Integration](https://64.github.io/monte-carlo/)
-
diff --git a/cg/mesh/mesh.triangle.md b/cg/mesh/mesh.triangle.md
index 0f7f77c..d1272e1 100644
--- a/cg/mesh/mesh.triangle.md
+++ b/cg/mesh/mesh.triangle.md
@@ -1,5 +1,6 @@
# 三角面片
+- [重新审视褶皱表面的模拟](http://image.diku.dk/projects/media/morten.mikkelsen.08.pdf)
## Normal
@@ -10,13 +11,15 @@
## 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
- [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)
-- [threejs的Tangent支持](https://threejs.org/docs/#examples/en/utils/BufferGeometryUtils.computeMikkTSpaceTangents)
-
顶点切线的数学推理
@@ -89,6 +92,27 @@ $$
+#### [threejs的Tangent支持](https://threejs.org/docs/#examples/en/utils/BufferGeometryUtils.computeMikkTSpaceTangents)
+```c
+#ifdef USE_TANGENT
+attribute vec4 tangent;
+#endif
+vec3 objectTangent = vec3( tangent.xyz );
+// src\renderers\shaders\ShaderChunk\normal_pars_fragment.glsl.js
+// src\renderers\shaders\ShaderChunk\normal_pars_vertex.glsl.js
+varying vec3 vTangent;
+varying vec3 vBitangent;
+// src\renderers\shaders\ShaderChunk\defaultnormal_vertex.glsl.js
+vec3 transformedTangent = objectTangent; // 变形的影响
+// src\renderers\shaders\ShaderChunk\normal_vertex.glsl.js
+vTangent = normalize( transformedTangent );
+vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
+// src\renderers\shaders\ShaderChunk\normal_fragment_begin.glsl.js
+mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
+// src\renderers\shaders\ShaderChunk\normal_fragment_maps.glsl.js
+normal = normalize( tbn * mapN );
+```
+
### MikkTSpace
- [Tangent Space Normal Maps](http://www.mikktspace.com/)
- [github c](https://github.com/mmikk/MikkTSpace)
@@ -97,4 +121,10 @@ $$
MikkTSpace切线的数学推理
+MikkTSpace的方案成了事实上的标准,blender就用它来生成Normal Mapping的,光照计算中也是一个非常角色。
+MikkTSpace生成tangent space即使改变了点索引,面的顺序,删除primitive等等都不影响且对triangles和quads都支持的。
+
+顶点必须具有属性:位置Position,法线Normal,纹理坐标UV
+
+
diff --git a/cg/threejs/use.md b/cg/threejs/use.md
index c01be5e..e78781f 100644
--- a/cg/threejs/use.md
+++ b/cg/threejs/use.md
@@ -66,7 +66,7 @@ camera的近远曲线的趋势。
牙龈根据关键点生成了面片数据,包含了顶点、uv、索引。
前端对生成的数据进行了处理,处理顶点法线,position,uv,normal,tangent。
-又根据uv和tangent算出了一个uv2和tangent2. 至于为什么有这样的逻辑?忙猜是逆向过程中看到这样的逻辑。
+又根据uv和tangent算出了一个uv2和tangent2. 大致逻辑是拷贝,处理相同点的问题,在shader中取tangent和tangent2的均值作为最终值来使用。
### flickering
2024-7-19
diff --git a/cg/tools/galacean.md b/cg/tools/galacean.md
new file mode 100644
index 0000000..cf848b5
--- /dev/null
+++ b/cg/tools/galacean.md
@@ -0,0 +1,5 @@
+# [Galacen](https://galacean.antgroup.com/engine/)
+
+阿里系下的一个webgl引擎,号称性能很好,研究一下源码看看核心的功能
+分析一下shader的代码逻辑
+
diff --git a/cg/tools/webgl.md b/cg/tools/webgl.md
index 6c9642d..46febcb 100644
--- a/cg/tools/webgl.md
+++ b/cg/tools/webgl.md
@@ -6,6 +6,7 @@
- [笔记](/cg/threejs/index.md)
- [BabylonJS](https://www.babylonjs.com/)
- [笔记](/cg/babylonjs/index.md)
+- [galacean笔记](/cg/tools/galacean.md)
## [WebGL API](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API)
diff --git a/exercises/math.secondary.md b/exercises/math.secondary.md
index 4055216..5f41e3d 100644
--- a/exercises/math.secondary.md
+++ b/exercises/math.secondary.md
@@ -33,6 +33,28 @@ $e^{\pi i} + 1 = 0 \to e^{\pi i} = -1$
+## 代数
+
+### 代数式
+
+#### 对称式
+
+如果交换一个代数式中任意两个字母的位置,所得代数式和原代数式恒等,那么成代数式为对称式。
+
+#### 轮询式
+
+把一个代数式中的字母按照某个秩序排列,然后依次把第一个字母换成第二个字母,第二个字母换成第三个字母,……,最后一个字母换成第一个字母,依次轮换一圈后,所得的代数式与原代数式恒等,则称这个代数式为轮换式
+
+- 对称式一定是轮询式
+- 轮询式不一定是对称式
+- 轮换对称式的和、差、积、商也是轮换对称式
+
+##### 齐次轮换对称式
+
+如果轮换对称式中各项的次数相等,那么就把这样的代数式叫做齐次轮换对称式. 具有一下属性,对因式分解非常有帮助
+
+- 齐次轮换对称式的和、差、积、商也是齐次轮换对称式
+
## 几何
diff --git a/index/community.md b/index/community.md
index 6d14ce5..51e56df 100644
--- a/index/community.md
+++ b/index/community.md
@@ -83,4 +83,9 @@ languages including common scripting languages such as Javascript, Perl, PHP, Py
- [这是一款开源、多语言、自托管的项目管理工具,兼容了 Trello 和 Notion 的特点](https://www.focalboard.com/)
- [github](https://github.com/mattermost/focalboard)
-- [款开源、安全、跨平台的密码管理器。该项目是采用 C++ 开发的免费、离线、无广告的密码管理工具](https://github.com/keepassxreboot/keepassxc)
\ No newline at end of file
+- [款开源、安全、跨平台的密码管理器。该项目是采用 C++ 开发的免费、离线、无广告的密码管理工具](https://github.com/keepassxreboot/keepassxc)
+
+## 社区
+
+- [Khronos Standards community discussions github-account](https://community.khronos.org/)
+- [The three.js community discourse. github-account](https://discourse.threejs.org/)
\ No newline at end of file
diff --git a/index/computerScience.md b/index/computerScience.md
index 26c2b18..2a4b670 100644
--- a/index/computerScience.md
+++ b/index/computerScience.md
@@ -16,6 +16,8 @@
- [Zig is a general-purpose programming language and toolchain for maintaining robust, optimal and reusable software.](https://ziglang.org/)
- [core analyzer -- A power tool to understand memory layout](https://core-analyzer.sourceforge.net/index_files/Page525.html)
+- [Numerical Computation Guide](https://docs.oracle.com/cd/E19957-01/806-3568/ncgTOC.html)
+ - [What Every Computer Scientist Should Know About Floating-Point Arithmetic](https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html)
### Database
@@ -66,6 +68,7 @@
- [Bgfx](/cg/bgfx.md)
- [UI](/cg/ui.md)
- [threejs 笔记](/cg/threejs/index.md)
+- [Galacean](/cg/galacean/index.md)
### 动画