Kaynağa Gözat

Docs: Add BufferGeometryUtils.computeTangents documentation (#23771)

Don McCurdy 3 yıl önce
ebeveyn
işleme
5c55557e37

+ 2 - 1
docs/api/en/core/BufferGeometry.html

@@ -216,7 +216,8 @@
 		<h3>[method:undefined computeTangents]()</h3>
 		<h3>[method:undefined computeTangents]()</h3>
 		<p>
 		<p>
 		Calculates and adds a tangent attribute to this geometry.<br />
 		Calculates and adds a tangent attribute to this geometry.<br />
-		The computation is only supported for indexed geometries and if position, normal, and uv attributes are defined.
+		The computation is only supported for indexed geometries and if position, normal, and uv attributes are defined. When using a tangent space normal map, prefer the MikkTSpace algorithm provided by
+		[page:BufferGeometryUtils.computeTangents] instead.
 		</p>
 		</p>
 
 
 		<h3>[method:undefined computeVertexNormals]()</h3>
 		<h3>[method:undefined computeVertexNormals]()</h3>

+ 2 - 0
docs/api/ko/core/BufferGeometry.html

@@ -208,6 +208,8 @@
 		<p>
 		<p>
 		기하학에 탄젠트 속성을 계산하고 추가합니다.<br />
 		기하학에 탄젠트 속성을 계산하고 추가합니다.<br />
 		이 계산은 인덱스가 있는 기하학에만 지원되며 위치, 법선, uv 속성이 정의되어야 합니다.
 		이 계산은 인덱스가 있는 기하학에만 지원되며 위치, 법선, uv 속성이 정의되어야 합니다.
+		When using a tangent space normal map, prefer the MikkTSpace algorithm provided by
+		[page:BufferGeometryUtils.computeTangents] instead.
 		</p>
 		</p>
 
 
 		<h3>[method:undefined computeVertexNormals]()</h3>
 		<h3>[method:undefined computeVertexNormals]()</h3>

+ 2 - 1
docs/api/zh/core/BufferGeometry.html

@@ -202,7 +202,8 @@
 		<h3>[method:undefined computeTangents]()</h3>
 		<h3>[method:undefined computeTangents]()</h3>
 		<p>
 		<p>
 		Calculates and adds a tangent attribute to this geometry.<br />
 		Calculates and adds a tangent attribute to this geometry.<br />
-		The computation is only supported for indexed geometries and if position, normal, and uv attributes are defined.
+		The computation is only supported for indexed geometries and if position, normal, and uv attributes are defined. When using a tangent space normal map, prefer the MikkTSpace algorithm provided by
+		[page:BufferGeometryUtils.computeTangents] instead.
 		</p>
 		</p>
 
 
 		<h3>[method:undefined computeVertexNormals]()</h3>
 		<h3>[method:undefined computeVertexNormals]()</h3>

+ 25 - 0
docs/examples/en/utils/BufferGeometryUtils.html

@@ -96,6 +96,31 @@
 
 
 		</p>
 		</p>
 
 
+		<h3>[method:Object computeTangents]( [param:BufferGeometry geometry] )</h3>
+		<p>
+		geometry -- Instance of [page:BufferGeometry].
+		</p>
+
+		<p>
+		Computes vertex tangents using the [link:http://www.mikktspace.com/ MikkTSpace] algorithm.
+		MikkTSpace generates the same tangents consistently, and is used in most modelling tools and
+		normal map bakers. Use MikkTSpace for materials with normal maps, because inconsistent
+		tangents may lead to subtle visual issues in the normal map, particularly around mirrored
+		UV seams.
+		</p>
+
+		<p>
+		In comparison to [page:BufferGeometryUtils.computeTangents], [page:BufferGeometry.computeTangents]
+		(a custom algorithm) generates tangents that probably will not match the tangents
+		in other software. The custom algorithm is sufficient for general use with a
+		[page:ShaderMaterial], and may be faster than MikkTSpace.
+		</p>
+
+		<p>
+		Returns the original [page:BufferGeometry]. Indexed geometries will be de-indexed.
+		Requires position, normal, and uv attributes.
+		</p>
+
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		<p>
 		<p>

+ 40 - 0
docs/examples/zh/utils/BufferGeometryUtils.html

@@ -76,6 +76,46 @@
 
 
 		</p>
 		</p>
 
 
+		<h3>[method:Object computeMorphedAttributes]( [param:Mesh | Line | Points object] )</h3>
+		<p>
+		object -- Instance of [page:Mesh Mesh] | [page:Line Line] | [page:Points Points].<br /><br />
+
+		Returns the current attributes (Position and Normal) of a morphed/skinned [page:Object3D Object3D] whose geometry is a
+		[page:BufferGeometry BufferGeometry], together with the original ones: An Object with 4 properties:
+		`positionAttribute`, `normalAttribute`, `morphedPositionAttribute` and `morphedNormalAttribute`.
+
+		Helpful for Raytracing or Decals (i.e. a [page:DecalGeometry DecalGeometry] applied to a morphed Object
+		with a [page:BufferGeometry BufferGeometry] will use the original BufferGeometry, not the morphed/skinned one,
+		generating an incorrect result.
+		Using this function to create a shadow Object3D the DecalGeometry can be correctly generated).
+
+		</p>
+
+		<h3>[method:Object computeTangents]( [param:BufferGeometry geometry] )</h3>
+		<p>
+		geometry -- Instance of [page:BufferGeometry].
+		</p>
+
+		<p>
+		Computes vertex tangents using the [link:http://www.mikktspace.com/ MikkTSpace] algorithm.
+		MikkTSpace generates the same tangents consistently, and is used in most modelling tools and
+		normal map bakers. Use MikkTSpace for materials with normal maps, because inconsistent
+		tangents may lead to subtle visual issues in the normal map, particularly around mirrored
+		UV seams.
+		</p>
+
+		<p>
+		In comparison to [page:BufferGeometryUtils.computeTangents], [page:BufferGeometry.computeTangents]
+		(a custom algorithm) generates tangents that probably will not match the tangents
+		in other software. The custom algorithm is sufficient for general use with a
+		[page:ShaderMaterial], and may be faster than MikkTSpace.
+		</p>
+
+		<p>
+		Returns the original [page:BufferGeometry]. Indexed geometries will be de-indexed.
+		Requires position, normal, and uv attributes.
+		</p>
+
 		<h2></h2>
 		<h2></h2>
 
 
 		<p>
 		<p>