瀏覽代碼

Merge pull request #14897 from mrdoob/docs-gltfloader-textures

GLTFLoader: Document best practices for textures.
Mr.doob 6 年之前
父節點
當前提交
6df0d1c4e9
共有 1 個文件被更改,包括 25 次插入0 次删除
  1. 25 0
      docs/examples/loaders/GLTFLoader.html

+ 25 - 0
docs/examples/loaders/GLTFLoader.html

@@ -84,6 +84,31 @@
 		[link:https://github.com/stefanpenner/es6-promise include a polyfill]
 		providing a Promise replacement.</p>
 
+		<h2>Textures</h2>
+		
+		<p>Textures containing color information (.map, .emissiveMap, and .specularMap) always use sRGB colorspace in
+		glTF, while vertex colors and material properties (.color, .emissive, .specular) use linear colorspace. In a
+		typical rendering workflow, textures are converted to linear colorspace by the renderer, lighting calculations
+		are made, then final output is converted back to sRGB and displayed on screen. Unless you need post-processing
+		in linear colorspace, always configure [page:WebGLRenderer] as follows when using glTF:</p>
+			
+		<code>
+		renderer.gammaOutput = true;
+		renderer.gammaFactor = 2.2;
+		</code>
+		
+		<p>GLTFLoader will automatically configure textures referenced from a .gltf or .glb file correctly, with the
+		assumption that the renderer is set up as shown above. When loading textures externally (e.g., using
+		[page:TextureLoader]) and applying them to a glTF model, colorspace and orientation must be given:</p>
+		
+		<code>
+		// If texture is used for color information, set colorspace.
+		texture.encoding = THREE.sRGBEncoding;
+
+		// UVs use the convention that (0, 0) corresponds to the upper left corner of a texture.
+		texture.flipY = false;
+		</code>		
+		
 		<h2>Custom extensions</h2>
 
 		<p>