Jelajahi Sumber

Material: Move fog property to materials which support it. (#23939)

Michael Herzog 3 tahun lalu
induk
melakukan
a24e980373
43 mengubah file dengan 112 tambahan dan 35 penghapusan
  1. 3 0
      docs/api/en/materials/LineBasicMaterial.html
  2. 0 3
      docs/api/en/materials/Material.html
  3. 3 0
      docs/api/en/materials/MeshBasicMaterial.html
  4. 3 0
      docs/api/en/materials/MeshLambertMaterial.html
  5. 3 0
      docs/api/en/materials/MeshMatcapMaterial.html
  6. 3 0
      docs/api/en/materials/MeshPhongMaterial.html
  7. 3 0
      docs/api/en/materials/MeshStandardMaterial.html
  8. 3 0
      docs/api/en/materials/MeshToonMaterial.html
  9. 3 0
      docs/api/en/materials/PointsMaterial.html
  10. 3 0
      docs/api/en/materials/ShadowMaterial.html
  11. 3 0
      docs/api/en/materials/SpriteMaterial.html
  12. 3 0
      docs/api/zh/materials/LineBasicMaterial.html
  13. 0 3
      docs/api/zh/materials/Material.html
  14. 3 0
      docs/api/zh/materials/MeshBasicMaterial.html
  15. 0 3
      docs/api/zh/materials/MeshDepthMaterial.html
  16. 0 3
      docs/api/zh/materials/MeshDistanceMaterial.html
  17. 3 0
      docs/api/zh/materials/MeshLambertMaterial.html
  18. 3 0
      docs/api/zh/materials/MeshMatcapMaterial.html
  19. 0 3
      docs/api/zh/materials/MeshNormalMaterial.html
  20. 3 0
      docs/api/zh/materials/MeshPhongMaterial.html
  21. 3 0
      docs/api/zh/materials/MeshStandardMaterial.html
  22. 3 0
      docs/api/zh/materials/MeshToonMaterial.html
  23. 3 1
      docs/api/zh/materials/PointsMaterial.html
  24. 3 0
      docs/api/zh/materials/ShadowMaterial.html
  25. 3 0
      docs/api/zh/materials/SpriteMaterial.html
  26. 6 6
      docs/scenes/material-browser.html
  27. 4 0
      src/materials/LineBasicMaterial.js
  28. 2 4
      src/materials/Material.js
  29. 4 0
      src/materials/MeshBasicMaterial.js
  30. 0 2
      src/materials/MeshDepthMaterial.js
  31. 0 2
      src/materials/MeshDistanceMaterial.js
  32. 4 0
      src/materials/MeshLambertMaterial.js
  33. 4 0
      src/materials/MeshMatcapMaterial.js
  34. 0 2
      src/materials/MeshNormalMaterial.js
  35. 4 0
      src/materials/MeshPhongMaterial.js
  36. 4 0
      src/materials/MeshStandardMaterial.js
  37. 4 0
      src/materials/MeshToonMaterial.js
  38. 4 0
      src/materials/PointsMaterial.js
  39. 1 0
      src/materials/ShaderMaterial.js
  40. 4 0
      src/materials/ShadowMaterial.js
  41. 4 0
      src/materials/SpriteMaterial.js
  42. 2 2
      src/renderers/WebGLRenderer.js
  43. 1 1
      src/renderers/webgl/WebGLPrograms.js

+ 3 - 0
docs/api/en/materials/LineBasicMaterial.html

@@ -61,6 +61,9 @@
 		<h3>[property:Color color]</h3>
 		<p>[page:Color] of the material, by default set to white (0xffffff).</p>
 
+		<h3>[property:Boolean fog]</h3>
+		<p>Whether the material is affected by fog. Default is *true*.</p>
+
 		<h3>[property:Float linewidth]</h3>
 		<p>
 			Controls line thickness. Default is *1*.<br /><br />

+ 0 - 3
docs/api/en/materials/Material.html

@@ -173,9 +173,6 @@
 		Which stencil operation to perform when the comparison function returns true and the depth test passes. Default is [page:Materials KeepStencilOp]. See the stencil operations [page:Materials constants] for all possible values.
 		</p>
 
-		<h3>[property:Boolean fog]</h3>
-		<p>Whether the material is affected by fog. Default is *true*.</p>
-
 		<h3>[property:Integer id]</h3>
 		<p>Unique number for this material instance.</p>
 

+ 3 - 0
docs/api/en/materials/MeshBasicMaterial.html

@@ -83,6 +83,9 @@
 		<h3>[property:Texture envMap]</h3>
 		<p>The environment map. Default is null.</p>
 
+		<h3>[property:Boolean fog]</h3>
+		<p>Whether the material is affected by fog. Default is *true*.</p>
+
 		<h3>[property:Texture lightMap]</h3>
 		<p>The light map. Default is null. The lightMap requires a second set of UVs.</p>
 

+ 3 - 0
docs/api/en/materials/MeshLambertMaterial.html

@@ -110,6 +110,9 @@
 		<h3>[property:Texture envMap]</h3>
 		<p>The environment map. Default is null.</p>
 
+		<h3>[property:Boolean fog]</h3>
+		<p>Whether the material is affected by fog. Default is *true*.</p>
+
 		<h3>[property:Texture lightMap]</h3>
 		<p>The light map. Default is null. The lightMap requires a second set of UVs.</p>
 

+ 3 - 0
docs/api/en/materials/MeshMatcapMaterial.html

@@ -100,6 +100,9 @@
 		Define whether the material is rendered with flat shading. Default is false.
 		</p>
 
+		<h3>[property:Boolean fog]</h3>
+		<p>Whether the material is affected by fog. Default is *true*.</p>
+
 		<h3>[property:Texture map]</h3>
 		<p>The color map. Default is null. The texture map color is modulated by the diffuse [page:.color].</p>
 

+ 3 - 0
docs/api/en/materials/MeshPhongMaterial.html

@@ -147,6 +147,9 @@
 		Define whether the material is rendered with flat shading. Default is false.
 		</p>
 
+		<h3>[property:Boolean fog]</h3>
+		<p>Whether the material is affected by fog. Default is *true*.</p>
+
 		<h3>[property:Texture lightMap]</h3>
 		<p>The light map. Default is null. The lightMap requires a second set of UVs.</p>
 

+ 3 - 0
docs/api/en/materials/MeshStandardMaterial.html

@@ -177,6 +177,9 @@
 		Define whether the material is rendered with flat shading. Default is false.
 		</p>
 
+		<h3>[property:Boolean fog]</h3>
+		<p>Whether the material is affected by fog. Default is *true*.</p>
+
 		<h3>[property:Boolean isMeshStandardMaterial]</h3>
 		<p>
 			Read-only flag to check if a given object is of type [name].

+ 3 - 0
docs/api/en/materials/MeshToonMaterial.html

@@ -120,6 +120,9 @@
 		<h3>[property:Float emissiveIntensity]</h3>
 		<p>Intensity of the emissive light. Modulates the emissive color. Default is 1.</p>
 
+		<h3>[property:Boolean fog]</h3>
+		<p>Whether the material is affected by fog. Default is *true*.</p>
+
 		<h3>[property:Texture gradientMap]</h3>
 		<p>Gradient map for toon shading. It's required to set [page:Texture.minFilter] and [page:Texture.magFilter] to
 			[page:Textures THREE.NearestFilter] when using this type of texture. Default is *null*.</p>

+ 3 - 0
docs/api/en/materials/PointsMaterial.html

@@ -81,6 +81,9 @@
 		<h3>[property:Color color]</h3>
 		<p>[page:Color] of the material, by default set to white (0xffffff).</p>
 
+		<h3>[property:Boolean fog]</h3>
+		<p>Whether the material is affected by fog. Default is *true*.</p>
+
 		<h3>[property:Texture map]</h3>
 		<p>Sets the color of the points using data from a [page:Texture].</p>
 

+ 3 - 0
docs/api/en/materials/ShadowMaterial.html

@@ -51,6 +51,9 @@
 		<h3>[property:Color color]</h3>
 		<p>[page:Color] of the material, by default set to black (0x000000).</p>
 
+		<h3>[property:Boolean fog]</h3>
+		<p>Whether the material is affected by fog. Default is *true*.</p>
+
 		<h3>[property:Boolean transparent]</h3>
 		<p>Defines whether this material is transparent. Default is *true*.</p>
 

+ 3 - 0
docs/api/en/materials/SpriteMaterial.html

@@ -62,6 +62,9 @@
 		<h3>[property:Color color]</h3>
 		<p>[page:Color] of the material, by default set to white (0xffffff). The [page:.map] is multiplied by the color.</p>
 
+		<h3>[property:Boolean fog]</h3>
+		<p>Whether the material is affected by fog. Default is *true*.</p>
+
 		<h3>[property:Boolean isSpriteMaterial]</h3>
 		<p>
 			Read-only flag to check if a given object is of type [name].

+ 3 - 0
docs/api/zh/materials/LineBasicMaterial.html

@@ -58,6 +58,9 @@
 		<h3>[property:Color color]</h3>
 		<p>材质的颜色([page:Color]),默认值为白色 (0xffffff)。</p>
 
+		<h3>[property:Boolean fog]</h3>
+		<p>材质是否受雾影响。默认为*true*。</p>
+
 		<h3>[property:Float linewidth]</h3>
 		<p> 控制线宽。默认值为 *1*。<br /><br />
 			由于[link:https://www.khronos.org/registry/OpenGL/specs/gl/glspec46.core.pdf OpenGL Core Profile]与

+ 0 - 3
docs/api/zh/materials/Material.html

@@ -152,9 +152,6 @@
 当比较函数和深度检测都通过时要执行的模板操作,默认为[page:Materials KeepStencilOp],在模板操作[page:Materials constants] 中查看可用值。
 </p>
 
-<h3>[property:Boolean fog]</h3>
-<p>材质是否受雾影响。默认为*true*。</p>
-
 <h3>[property:Integer id]</h3>
 <p>此材质实例的唯一编号。</p>
 

+ 3 - 0
docs/api/zh/materials/MeshBasicMaterial.html

@@ -73,6 +73,9 @@
 		<h3>[property:Texture envMap]</h3>
 		<p>环境贴图。默认值为null。</p>
 
+		<h3>[property:Boolean fog]</h3>
+		<p>材质是否受雾影响。默认为*true*。</p>
+
 		<h3>[property:Texture lightMap]</h3>
 		<p>光照贴图。默认值为null。lightMap需要第二组UV。</p>
 

+ 0 - 3
docs/api/zh/materials/MeshDepthMaterial.html

@@ -67,9 +67,6 @@
 		<p> 位移贴图在网格顶点上的偏移量。如果没有设置位移贴图,则不会应用此值。默认值为0。
 		</p>
 
-		<h3>[property:Boolean fog]</h3>
-		<p> 材质是否受雾影响。默认值为*false*。</p>
-
 		<h3>[property:Texture map]</h3>
 		<p>颜色贴图。默认为null。</p>
 

+ 0 - 3
docs/api/zh/materials/MeshDistanceMaterial.html

@@ -78,9 +78,6 @@
 			The far value of the point light's internal shadow camera.
 		</p>
 
-		<h3>[property:Boolean fog]</h3>
-		<p> 材质是否受雾影响。默认值为*false*。</p>
-
 		<h3>[property:Texture map]</h3>
 		<p>颜色贴图。默认为null。</p>
 

+ 3 - 0
docs/api/zh/materials/MeshLambertMaterial.html

@@ -92,6 +92,9 @@
 		<h3>[property:Texture envMap]</h3>
 		<p> 环境贴图。默认值为null。</p>
 
+		<h3>[property:Boolean fog]</h3>
+		<p>材质是否受雾影响。默认为*true*。</p>
+
 		<h3>[property:Texture lightMap]</h3>
 		<p>光照贴图。默认值为null。lightMap需要第二组UV。</p>
 

+ 3 - 0
docs/api/zh/materials/MeshMatcapMaterial.html

@@ -84,6 +84,9 @@
 		<p> 定义材质是否使用平面着色进行渲染。默认值为false。
 		</p>
 
+		<h3>[property:Boolean fog]</h3>
+		<p>材质是否受雾影响。默认为*true*。</p>
+
 		<h3>[property:Texture map]</h3>
 		<p>颜色贴图。默认为null。纹理贴图颜色由漫反射颜色[page:.color]调节。</p>
 

+ 0 - 3
docs/api/zh/materials/MeshNormalMaterial.html

@@ -66,9 +66,6 @@
 		<p> 定义材质是否使用平面着色进行渲染。默认值为false。
 		</p>
 
-		<h3>[property:Boolean fog]</h3>
-		<p>材质是否受雾影响。默认值为*false*。</p>
-
 		<h3>[property:Texture normalMap]</h3>
 		<p> 用于创建法线贴图的纹理。RGB值会影响每个像素片段的曲面法线,并更改颜色照亮的方式。法线贴图不会改变曲面的实际形状,只会改变光照。
 			In case the material has a normal map authored using the left handed convention, the y component of normalScale

+ 3 - 0
docs/api/zh/materials/MeshPhongMaterial.html

@@ -116,6 +116,9 @@
 		<p> 定义材质是否使用平面着色进行渲染。默认值为false。
 		</p>
 
+		<h3>[property:Boolean fog]</h3>
+		<p>材质是否受雾影响。默认为*true*。</p>
+
 		<h3>[property:Texture lightMap]</h3>
 		<p>光照贴图。默认值为null。lightMap需要第二组UV。</p>
 

+ 3 - 0
docs/api/zh/materials/MeshStandardMaterial.html

@@ -144,6 +144,9 @@
 		<p> 定义材质是否使用平面着色进行渲染。默认值为false。
 		</p>
 
+		<h3>[property:Boolean fog]</h3>
+		<p>材质是否受雾影响。默认为*true*。</p>
+
 		<h3>[property:Boolean isMeshStandardMaterial]</h3>
 		<p>
 			检查当前对象是否为标准网格材质的标记。

+ 3 - 0
docs/api/zh/materials/MeshToonMaterial.html

@@ -120,6 +120,9 @@
 		<h3>[property:Float emissiveIntensity]</h3>
 		<p>Intensity of the emissive light. Modulates the emissive color. Default is 1.</p>
 
+		<h3>[property:Boolean fog]</h3>
+		<p>材质是否受雾影响。默认为*true*。</p>
+
 		<h3>[property:Texture gradientMap]</h3>
 		<p>Gradient map for toon shading. It's required to set [page:Texture.minFilter] and [page:Texture.magFilter] to
 			[page:Textures THREE.NearestFilter] when using this type of texture. Default is *null*.</p>

+ 3 - 1
docs/api/zh/materials/PointsMaterial.html

@@ -78,8 +78,10 @@
 		<h3>[property:Color color]</h3>
 		<p>材质的颜色([page:Color]),默认值为白色 (0xffffff)。</p>
 
-		<h3>[property:Texture map]</h3>
+		<h3>[property:Boolean fog]</h3>
+		<p>材质是否受雾影响。默认为*true*。</p>
 
+		<h3>[property:Texture map]</h3>
 		<p>使用[page:Texture]中的数据设置点的颜色。</p>
 
 		<h3>[property:Number size]</h3>

+ 3 - 0
docs/api/zh/materials/ShadowMaterial.html

@@ -50,6 +50,9 @@
 		<h3>[property:Color color]</h3>
 		<p>[page:Color] of the material, by default set to black (0x000000).</p>
 
+		<h3>[property:Boolean fog]</h3>
+		<p>材质是否受雾影响。默认为*true*。</p>
+
 		<h3>[property:Boolean transparent]</h3>
 		<p>定义此材质是否透明。默认值为 *true*。</p>
 

+ 3 - 0
docs/api/zh/materials/SpriteMaterial.html

@@ -60,6 +60,9 @@
 		<h3>[property:Color color]</h3>
 		<p>材质的颜色([page:Color]),默认值为白色 (0xffffff)。 [page:.map]会和 color 相乘。</p>
 
+		<h3>[property:Boolean fog]</h3>
+		<p>材质是否受雾影响。默认为*true*。</p>
+
 		<h3>[property:Boolean isSpriteMaterial]</h3>
 		<p>
 			Read-only flag to check if a given object is of type [name].

+ 6 - 6
docs/scenes/material-browser.html

@@ -375,7 +375,7 @@
 				folder.addColor( data, 'color' ).onChange( handleColorChange( material.color ) );
 				folder.add( material, 'wireframe' );
 				folder.add( material, 'vertexColors' ).onChange( needsUpdate( material, geometry ) );
-				folder.add( material, 'fog' );
+				folder.add( material, 'fog' ).onChange( needsUpdate( material, geometry ) );
 
 				folder.add( data, 'envMaps', envMapKeys ).onChange( updateTexture( material, 'envMap', envMaps ) );
 				folder.add( data, 'map', diffuseMapKeys ).onChange( updateTexture( material, 'map', diffuseMaps ) );
@@ -422,7 +422,7 @@
 				folder.add( material, 'linecap', [ 'butt', 'round', 'square' ] );
 				folder.add( material, 'linejoin', [ 'round', 'bevel', 'miter' ] );
 				folder.add( material, 'vertexColors' ).onChange( needsUpdate( material, geometry ) );
-				folder.add( material, 'fog' );
+				folder.add( material, 'fog' ).onChange( needsUpdate( material, geometry ) );
 
 			}
 
@@ -443,7 +443,7 @@
 
 				folder.add( material, 'wireframe' );
 				folder.add( material, 'vertexColors' ).onChange( needsUpdate( material, geometry ) );
-				folder.add( material, 'fog' );
+				folder.add( material, 'fog' ).onChange( needsUpdate( material, geometry ) );
 
 				folder.add( data, 'envMaps', envMapKeys ).onChange( updateTexture( material, 'envMap', envMaps ) );
 				folder.add( data, 'map', diffuseMapKeys ).onChange( updateTexture( material, 'map', diffuseMaps ) );
@@ -493,7 +493,7 @@
 				folder.add( material, 'flatShading' ).onChange( needsUpdate( material, geometry ) );
 				folder.add( material, 'wireframe' );
 				folder.add( material, 'vertexColors' ).onChange( needsUpdate( material, geometry ) );
-				folder.add( material, 'fog' );
+				folder.add( material, 'fog' ).onChange( needsUpdate( material, geometry ) );
 				folder.add( data, 'envMaps', envMapKeys ).onChange( updateTexture( material, 'envMap', envMaps ) );
 				folder.add( data, 'map', diffuseMapKeys ).onChange( updateTexture( material, 'map', diffuseMaps ) );
 				folder.add( data, 'alphaMap', alphaMapKeys ).onChange( updateTexture( material, 'alphaMap', alphaMaps ) );
@@ -542,7 +542,7 @@
 				folder.add( material, 'flatShading' ).onChange( needsUpdate( material, geometry ) );
 				folder.add( material, 'wireframe' );
 				folder.add( material, 'vertexColors' ).onChange( needsUpdate( material, geometry ) );
-				folder.add( material, 'fog' );
+				folder.add( material, 'fog' ).onChange( needsUpdate( material, geometry ) );
 				folder.add( data, 'envMaps', envMapKeysPBR ).onChange( updateTexture( material, 'envMap', envMaps ) );
 				folder.add( data, 'map', diffuseMapKeys ).onChange( updateTexture( material, 'map', diffuseMaps ) );
 				folder.add( data, 'roughnessMap', roughnessMapKeys ).onChange( updateTexture( material, 'roughnessMap', roughnessMaps ) );
@@ -576,7 +576,7 @@
 				folder.add( material, 'flatShading' ).onChange( needsUpdate( material, geometry ) );
 				folder.add( material, 'wireframe' );
 				folder.add( material, 'vertexColors' ).onChange( needsUpdate( material, geometry ) );
-				folder.add( material, 'fog' );
+				folder.add( material, 'fog' ).onChange( needsUpdate( material, geometry ) );
 				folder.add( data, 'envMaps', envMapKeysPBR ).onChange( updateTexture( material, 'envMap', envMaps ) );
 				folder.add( data, 'map', diffuseMapKeys ).onChange( updateTexture( material, 'map', diffuseMaps ) );
 				folder.add( data, 'roughnessMap', roughnessMapKeys ).onChange( updateTexture( material, 'roughnessMap', roughnessMaps ) );

+ 4 - 0
src/materials/LineBasicMaterial.js

@@ -15,6 +15,8 @@ class LineBasicMaterial extends Material {
 		this.linecap = 'round';
 		this.linejoin = 'round';
 
+		this.fog = true;
+
 		this.setValues( parameters );
 
 	}
@@ -30,6 +32,8 @@ class LineBasicMaterial extends Material {
 		this.linecap = source.linecap;
 		this.linejoin = source.linejoin;
 
+		this.fog = source.fog;
+
 		return this;
 
 	}

+ 2 - 4
src/materials/Material.js

@@ -17,8 +17,6 @@ class Material extends EventDispatcher {
 		this.name = '';
 		this.type = 'Material';
 
-		this.fog = true;
-
 		this.blending = NormalBlending;
 		this.side = FrontSide;
 		this.vertexColors = false;
@@ -350,6 +348,8 @@ class Material extends EventDispatcher {
 
 		if ( this.toneMapped === false ) data.toneMapped = false;
 
+		if ( this.fog === false ) data.fog = false;
+
 		if ( JSON.stringify( this.userData ) !== '{}' ) data.userData = this.userData;
 
 		// TODO: Copied from Object3D.toJSON
@@ -394,8 +394,6 @@ class Material extends EventDispatcher {
 
 		this.name = source.name;
 
-		this.fog = source.fog;
-
 		this.blending = source.blending;
 		this.side = source.side;
 		this.vertexColors = source.vertexColors;

+ 4 - 0
src/materials/MeshBasicMaterial.js

@@ -34,6 +34,8 @@ class MeshBasicMaterial extends Material {
 		this.wireframeLinecap = 'round';
 		this.wireframeLinejoin = 'round';
 
+		this.fog = true;
+
 		this.setValues( parameters );
 
 	}
@@ -66,6 +68,8 @@ class MeshBasicMaterial extends Material {
 		this.wireframeLinecap = source.wireframeLinecap;
 		this.wireframeLinejoin = source.wireframeLinejoin;
 
+		this.fog = source.fog;
+
 		return this;
 
 	}

+ 0 - 2
src/materials/MeshDepthMaterial.js

@@ -22,8 +22,6 @@ class MeshDepthMaterial extends Material {
 		this.wireframe = false;
 		this.wireframeLinewidth = 1;
 
-		this.fog = false;
-
 		this.setValues( parameters );
 
 	}

+ 0 - 2
src/materials/MeshDistanceMaterial.js

@@ -21,8 +21,6 @@ class MeshDistanceMaterial extends Material {
 		this.displacementScale = 1;
 		this.displacementBias = 0;
 
-		this.fog = false;
-
 		this.setValues( parameters );
 
 	}

+ 4 - 0
src/materials/MeshLambertMaterial.js

@@ -38,6 +38,8 @@ class MeshLambertMaterial extends Material {
 		this.wireframeLinecap = 'round';
 		this.wireframeLinejoin = 'round';
 
+		this.fog = true;
+
 		this.setValues( parameters );
 
 	}
@@ -74,6 +76,8 @@ class MeshLambertMaterial extends Material {
 		this.wireframeLinecap = source.wireframeLinecap;
 		this.wireframeLinejoin = source.wireframeLinejoin;
 
+		this.fog = source.fog;
+
 		return this;
 
 	}

+ 4 - 0
src/materials/MeshMatcapMaterial.js

@@ -34,6 +34,8 @@ class MeshMatcapMaterial extends Material {
 
 		this.flatShading = false;
 
+		this.fog = true;
+
 		this.setValues( parameters );
 
 	}
@@ -66,6 +68,8 @@ class MeshMatcapMaterial extends Material {
 
 		this.flatShading = source.flatShading;
 
+		this.fog = source.fog;
+
 		return this;
 
 	}

+ 0 - 2
src/materials/MeshNormalMaterial.js

@@ -24,8 +24,6 @@ class MeshNormalMaterial extends Material {
 		this.wireframe = false;
 		this.wireframeLinewidth = 1;
 
-		this.fog = false;
-
 		this.flatShading = false;
 
 		this.setValues( parameters );

+ 4 - 0
src/materials/MeshPhongMaterial.js

@@ -54,6 +54,8 @@ class MeshPhongMaterial extends Material {
 
 		this.flatShading = false;
 
+		this.fog = true;
+
 		this.setValues( parameters );
 
 	}
@@ -105,6 +107,8 @@ class MeshPhongMaterial extends Material {
 
 		this.flatShading = source.flatShading;
 
+		this.fog = source.fog;
+
 		return this;
 
 	}

+ 4 - 0
src/materials/MeshStandardMaterial.js

@@ -56,6 +56,8 @@ class MeshStandardMaterial extends Material {
 
 		this.flatShading = false;
 
+		this.fog = true;
+
 		this.setValues( parameters );
 
 	}
@@ -109,6 +111,8 @@ class MeshStandardMaterial extends Material {
 
 		this.flatShading = source.flatShading;
 
+		this.fog = source.fog;
+
 		return this;
 
 	}

+ 4 - 0
src/materials/MeshToonMaterial.js

@@ -46,6 +46,8 @@ class MeshToonMaterial extends Material {
 		this.wireframeLinecap = 'round';
 		this.wireframeLinejoin = 'round';
 
+		this.fog = true;
+
 		this.setValues( parameters );
 
 	}
@@ -87,6 +89,8 @@ class MeshToonMaterial extends Material {
 		this.wireframeLinecap = source.wireframeLinecap;
 		this.wireframeLinejoin = source.wireframeLinejoin;
 
+		this.fog = source.fog;
+
 		return this;
 
 	}

+ 4 - 0
src/materials/PointsMaterial.js

@@ -18,6 +18,8 @@ class PointsMaterial extends Material {
 		this.size = 1;
 		this.sizeAttenuation = true;
 
+		this.fog = true;
+
 		this.setValues( parameters );
 
 	}
@@ -35,6 +37,8 @@ class PointsMaterial extends Material {
 		this.size = source.size;
 		this.sizeAttenuation = source.sizeAttenuation;
 
+		this.fog = source.fog;
+
 		return this;
 
 	}

+ 1 - 0
src/materials/ShaderMaterial.js

@@ -75,6 +75,7 @@ class ShaderMaterial extends Material {
 		this.wireframe = source.wireframe;
 		this.wireframeLinewidth = source.wireframeLinewidth;
 
+		this.fog = source.fog;
 		this.lights = source.lights;
 		this.clipping = source.clipping;
 

+ 4 - 0
src/materials/ShadowMaterial.js

@@ -12,6 +12,8 @@ class ShadowMaterial extends Material {
 		this.color = new Color( 0x000000 );
 		this.transparent = true;
 
+		this.fog = true;
+
 		this.setValues( parameters );
 
 	}
@@ -22,6 +24,8 @@ class ShadowMaterial extends Material {
 
 		this.color.copy( source.color );
 
+		this.fog = source.fog;
+
 		return this;
 
 	}

+ 4 - 0
src/materials/SpriteMaterial.js

@@ -21,6 +21,8 @@ class SpriteMaterial extends Material {
 
 		this.transparent = true;
 
+		this.fog = true;
+
 		this.setValues( parameters );
 
 	}
@@ -39,6 +41,8 @@ class SpriteMaterial extends Material {
 
 		this.sizeAttenuation = source.sizeAttenuation;
 
+		this.fog = source.fog;
+
 		return this;
 
 	}

+ 2 - 2
src/renderers/WebGLRenderer.js

@@ -1503,7 +1503,7 @@ function WebGLRenderer( parameters = {} ) {
 
 				needsProgramChange = true;
 
-			} else if ( material.fog && materialProperties.fog !== fog ) {
+			} else if ( material.fog === true && materialProperties.fog !== fog ) {
 
 				needsProgramChange = true;
 
@@ -1720,7 +1720,7 @@ function WebGLRenderer( parameters = {} ) {
 
 			// refresh uniforms common to several materials
 
-			if ( fog && material.fog ) {
+			if ( fog && material.fog === true ) {
 
 				materials.refreshFogUniforms( m_uniforms, fog );
 

+ 1 - 1
src/renderers/webgl/WebGLPrograms.js

@@ -175,7 +175,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
 			uvsVertexOnly: ! ( !! material.map || !! material.bumpMap || !! material.normalMap || !! material.specularMap || !! material.alphaMap || !! material.emissiveMap || !! material.roughnessMap || !! material.metalnessMap || !! material.clearcoatNormalMap || material.transmission > 0 || !! material.transmissionMap || !! material.thicknessMap || !! material.specularIntensityMap || !! material.specularColorMap || material.sheen > 0 || !! material.sheenColorMap || !! material.sheenRoughnessMap ) && !! material.displacementMap,
 
 			fog: !! fog,
-			useFog: material.fog,
+			useFog: material.fog === true,
 			fogExp2: ( fog && fog.isFogExp2 ),
 
 			flatShading: !! material.flatShading,