提交 b39e2c96 编写于 作者: A arobertson0

Refactoring of cc normal code

上级 ce035ac3
此差异已折叠。
此差异已折叠。
......@@ -74,7 +74,6 @@
const variationsX = [
(mat, scale, map) => { mat.clearCoatNormalScale.copy(mat.normalScale); },
(mat, scale, map) => { mat.clearCoatNormalScale = new THREE.Vector2(scale, scale); },
(mat, scale, map) => {
mat.clearCoatNormalScale = new THREE.Vector2(scale, scale);
if (mat.clearCoatNormalMap !== map) {
......@@ -207,14 +206,13 @@
}
addLabel("Normal Map", new THREE.Vector3(-450, 0, 0), 30);
addLabel("None", new THREE.Vector3(-350, -100, 0));
addLabel("Scaling + Map", new THREE.Vector3(-400, 100, 0));
addLabel("Normal Map", new THREE.Vector3(-350, 0, 0), 30);
addLabel("None", new THREE.Vector3(-250, -100, 0));
addLabel("Map", new THREE.Vector3(-300, 100, 0));
addLabel("Clearcoat Normal Map", new THREE.Vector3(0, 260, 0), 30);
addLabel("None", new THREE.Vector3(- 200, 200, 0));
addLabel("Scaling", new THREE.Vector3(0, 200, 0));
addLabel("Scaling + Map", new THREE.Vector3(200, 200, 0));
addLabel("None", new THREE.Vector3(-100, 200, 0));
addLabel("Map", new THREE.Vector3(100, 200, 0));
// LIGHTS
......
......@@ -11,11 +11,9 @@ export interface MeshPhysicalMaterialParameters
reflectivity?: number;
clearCoat?: number;
clearCoatRoughness?: number;
clearCoatGeometryNormals?: boolean;
clearCoatNormalMap?: Texture;
clearCoatNormalMapType?: NormalMapTypes;
clearCoatNormalScale?: Vector2;
clearCoatNormalMap?: Texture;
}
export class MeshPhysicalMaterial extends MeshStandardMaterial {
......@@ -27,9 +25,7 @@ export class MeshPhysicalMaterial extends MeshStandardMaterial {
clearCoat: number;
clearCoatRoughness: number;
clearCoatGeometryNormals?: boolean;
clearCoatNormalMap: Texture | null;
clearCoatNormalMapType: NormalMapTypes;
clearCoatNormalScale: Vector2;
clearCoatNormalMap: Texture | null;
}
import { TangentSpaceNormalMap } from '../constants.js';
import { Vector2 } from '../math/Vector2.js';
import { MeshStandardMaterial } from './MeshStandardMaterial.js';
......@@ -9,11 +8,9 @@ import { MeshStandardMaterial } from './MeshStandardMaterial.js';
* reflectivity: <float>
* clearCoat: <float>
* clearCoatRoughness: <float>
* clearCoatGeometryNormals: <boolean>
* clearCoatNormalMap: new THREE.Texture( <Image> ),
* clearCoatNormalMapType: THREE.TangentSpaceNormalMap,
*
* clearCoatNormalScale: <Vector2>,
* clearCoatNormalMap: new THREE.Texture( <Image> ),
* }
*/
......@@ -30,10 +27,8 @@ function MeshPhysicalMaterial( parameters ) {
this.clearCoat = 0.0;
this.clearCoatRoughness = 0.0;
this.clearCoatGeometryNormals = false;
this.clearCoatNormalMap = null;
this.clearCoatNormalMapType = TangentSpaceNormalMap;
this.clearCoatNormalScale = new Vector2(1, 1);
this.clearCoatNormalMap = null;
this.setValues( parameters );
......@@ -55,9 +50,7 @@ MeshPhysicalMaterial.prototype.copy = function ( source ) {
this.clearCoat = source.clearCoat;
this.clearCoatRoughness = source.clearCoatRoughness;
this.clearCoatGeometryNormals = source.clearCoatGeometryNormals;
this.clearCoatNormalMap = source.clearCoatNormalMap;
this.clearCoatNormalMapType = source.clearCoatNormalMapType;
this.clearCoatNormalScale.copy(source.clearCoatNormalScale);
return this;
......
......@@ -2282,12 +2282,11 @@ function WebGLRenderer( parameters ) {
}
uniforms.clearCoatNormalScale.value.copy( material.clearCoatNormalScale );
if ( material.side === BackSide ) uniforms.clearCoatNormalScale.value.negate();
if ( material.side === BackSide ){
uniforms.clearCoatNormalScale.value.negate();
}
}
uniforms.clearCoatGeometryNormals.value = material.clearCoatGeometryNormals;
}
function refreshUniformsMatcap( uniforms, material ) {
......
......@@ -125,15 +125,15 @@ float D_GGX( const in float alpha, const in float dotNH ) {
}
// GGX Distribution, Schlick Fresnel, GGX-Smith Visibility
vec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {
vec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {
float alpha = pow2( roughness ); // UE4's roughness
vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );
vec3 halfDir = normalize( incidentLight.direction + viewDir );
float dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );
float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
float dotNH = saturate( dot( geometry.normal, halfDir ) );
float dotNL = saturate( dot( normal, incidentLight.direction ) );
float dotNV = saturate( dot( normal, viewDir ) );
float dotNH = saturate( dot( normal, halfDir ) );
float dotLH = saturate( dot( incidentLight.direction, halfDir ) );
vec3 F = F_Schlick( specularColor, dotLH );
......@@ -146,29 +146,6 @@ vec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in Geometric
} // validated
#ifndef STANDARD
vec3 BRDF_ClearCoat_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {
float alpha = pow2( roughness ); // UE4's roughness
vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );
float dotNL = saturate( dot( geometry.clearCoatNormal, incidentLight.direction ) );
float dotNV = saturate( dot( geometry.clearCoatNormal, geometry.viewDir ) );
float dotNH = saturate( dot( geometry.clearCoatNormal, halfDir ) );
float dotLH = saturate( dot( incidentLight.direction, halfDir ) );
vec3 F = F_Schlick( specularColor, dotLH );
float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );
float D = D_GGX( alpha, dotNH );
return F * ( G * D );
}
#endif
// Rect Area Light
// Real-Time Polygonal-Light Shading with Linearly Transformed Cosines
......@@ -287,9 +264,9 @@ vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in m
// End Rect Area Light
// ref: https://www.unrealengine.com/blog/physically-based-shading-on-mobile - environmentBRDF for GGX on mobile
vec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {
vec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {
float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
float dotNV = saturate( dot( normal, viewDir ) );
vec2 brdf = integrateSpecularBRDF( dotNV, roughness );
......@@ -297,17 +274,6 @@ vec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in
} // validated
#ifndef STANDARD
vec3 BRDF_ClearCoat_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {
float dotNV = saturate( dot( geometry.clearCoatNormal, geometry.viewDir ) );
vec2 brdf = integrateSpecularBRDF( dotNV, roughness );
return specularColor * brdf.x + brdf.y;
}
#endif
// Fdez-Agüera's "Multiple-Scattering Microfacet Model for Real-Time Image Based Lighting"
// Approximates multiscattering in order to preserve energy.
// http://www.jcgt.org/published/0008/01/03/
......
export default /* glsl */`
#ifndef STANDARD
vec3 clearCoatNormal = geometryNormal;
#ifdef USE_CLEARCOAT_NORMALMAP
vec3 clearCoatNormal = geometryNormal;
#endif
#endif
`;
export default /* glsl */ `
#ifndef STANDARD
#if defined( USE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP )
#ifdef USE_CLEARCOAT_NORMALMAP
#ifdef USE_TANGENT
......@@ -17,64 +17,3 @@ export default /* glsl */ `
#endif
#endif
`;
/*
#if defined( USE_NORMALMAP )
#ifdef USE_TANGENT
mat3 vTBN = mat3( tangent, bitangent, normal );
vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
mapN.xy = clearCoatnormalScale * mapN.xy;
clearCoatNormal = normalize( vTBN * mapN );
#else
clearCoatNormal = perturbClearCoatNormal2Arb( -vViewPosition, clearCoatNormal );
#endif
#endif
*/
/*
#if defined( USE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )
//#ifdef OBJECTSPACE_NORMALMAP
normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; // overrides both flatShading and attribute normals
#ifdef FLIP_SIDED
normal = - normal;
#endif
#ifdef DOUBLE_SIDED
normal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );
#endif
normal = normalize( normalMatrix * normal );
//#else // tangent-space normal map
#ifdef USE_TANGENT
mat3 vTBN = mat3( tangent, bitangent, normal );
vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
mapN.xy = normalScale * mapN.xy;
normal = normalize( vTBN * mapN );
#else
normal = perturbNormal2Arb( -vViewPosition, normal );
#endif
//#endif
#elif defined( USE_BUMPMAP )
normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );
#endif
*/
export default /* glsl */ `
#ifndef STANDARD
#if defined( USE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP )
uniform vec2 clearCoatNormalScale;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
uniform sampler2D clearCoatNormalMap;
#else
#define clearCoatNormalMap normalMap
uniform sampler2D clearCoatNormalMap;
uniform vec2 clearCoatNormalScale;
#endif
#endif
`;
/*
#ifdef USE_NORMALMAP
uniform sampler2D normalMap;
uniform vec2 normalScale;
#ifdef OBJECTSPACE_NORMALMAP
uniform mat3 normalMatrix;
#else
// Per-Pixel Tangent Space Normal Mapping
// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html
vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {
// Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988
vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );
vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );
vec2 st0 = dFdx( vUv.st );
vec2 st1 = dFdy( vUv.st );
float scale = sign( st1.t * st0.s - st0.t * st1.s ); // we do not care about the magnitude
vec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );
vec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );
vec3 N = normalize( surf_norm );
mat3 tsn = mat3( S, T, N );
vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
mapN.xy *= normalScale;
mapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );
return normalize( tsn * mapN );
}
#endif
#endif
*/
......@@ -40,8 +40,12 @@ struct GeometricContext {
vec3 normal;
vec3 viewDir;
#ifndef STANDARD
vec3 clearCoatNormal;
#ifndef STANDARD
#ifdef USE_CLEARCOAT_NORMALMAP
vec3 clearCoatNormal;
#endif
#endif
};
......
......@@ -20,8 +20,14 @@ geometry.position = - vViewPosition;
geometry.normal = normal;
geometry.viewDir = normalize( vViewPosition );
#if defined( PHYSICAL ) && !defined( STANDARD )
geometry.clearCoatNormal = clearCoatNormal;
#ifdef PHYSICAL
#ifndef STANDARD
#ifdef USE_CLEARCOAT_NORMALMAP
geometry.clearCoatNormal = clearCoatNormal;
#endif
#endif
#endif
IncidentLight directLight;
......@@ -125,6 +131,6 @@ IncidentLight directLight;
vec3 radiance = vec3( 0.0 );
vec3 clearCoatRadiance = vec3( 0.0 );
#endif
`;
......@@ -28,8 +28,11 @@ export default /* glsl */ `
radiance += getLightProbeIndirectRadiance( /*specularLightProbe,*/ geometry.viewDir, geometry.normal, Material_BlinnShininessExponent( material ), maxMipLevel );
#ifndef STANDARD
clearCoatRadiance += getLightProbeIndirectRadiance( /*specularLightProbe,*/ geometry.viewDir, geometry.clearCoatNormal,Material_ClearCoat_BlinnShininessExponent( material ), maxMipLevel );
#ifdef USE_CLEARCOAT_NORMALMAP
clearCoatRadiance += getLightProbeIndirectRadiance( /*specularLightProbe,*/ geometry.viewDir, geometry.clearCoatNormal, Material_ClearCoat_BlinnShininessExponent( material ), maxMipLevel );
#else
clearCoatRadiance += getLightProbeIndirectRadiance( /*specularLightProbe,*/ geometry.viewDir, geometry.normal, Material_ClearCoat_BlinnShininessExponent( material ), maxMipLevel );
#endif
#endif
#endif
`;
......@@ -65,38 +65,49 @@ float clearCoatDHRApprox( const in float roughness, const in float dotNL ) {
#endif
void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
// TODO: refactor more
float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
vec3 irradiance = dotNL * directLight.color;
#ifndef STANDARD
float ccDotNV = saturate( dot( geometry.clearCoatNormal, geometry.viewDir ) );
float ccDotNL = ccDotNV;
vec3 ccIrradiance= ccDotNL * directLight.color;
#endif
#ifndef PHYSICALLY_CORRECT_LIGHTS
irradiance *= PI; // punctual light
#ifndef STANDARD
ccIrradiance *= PI; // punctual light
#endif
#ifndef STANDARD
#ifdef USE_CLEARCOAT_NORMALMAP
float ccDotNL = saturate( dot( geometry.clearCoatNormal, directLight.direction ) );
vec3 ccIrradiance = ccDotNL * directLight.color;
#ifndef PHYSICALLY_CORRECT_LIGHTS
ccIrradiance *= PI; // punctual light
#endif
#endif
#endif
#ifndef STANDARD
float clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, ccDotNL );
#ifdef USE_CLEARCOAT_NORMALMAP
float clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, ccDotNL );
#else
float clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );
#endif
#else
float clearCoatDHR = 0.0;
#endif
reflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );
reflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness );
reflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
#ifndef STANDARD
reflectedLight.directSpecular += ccIrradiance * material.clearCoat * BRDF_ClearCoat_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );
#ifdef USE_CLEARCOAT_NORMALMAP
reflectedLight.directSpecular += ccIrradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearCoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );
#else
reflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );
#endif
#endif
}
......@@ -116,7 +127,11 @@ void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricCo
void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
#ifndef STANDARD
float ccDotNV = saturate( dot( geometry.clearCoatNormal, geometry.viewDir ) );
#ifdef USE_CLEARCOAT_NORMALMAP
float ccDotNV = saturate( dot( geometry.clearCoatNormal, geometry.viewDir ) );
#else
float ccDotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
#endif
float ccDotNL = ccDotNV;
float clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, ccDotNL );
#else
......@@ -143,14 +158,16 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
#else
reflectedLight.indirectSpecular += clearCoatInv * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );
reflectedLight.indirectSpecular += clearCoatInv * radiance * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness );
#endif
#ifndef STANDARD
reflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_ClearCoat_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );
#ifdef USE_CLEARCOAT_NORMALMAP
reflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearCoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );
#else
reflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.normal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );
#endif
#endif
}
......
......@@ -11,7 +11,7 @@ export default /* glsl */ `
#endif
#endif
#if ( defined ( USE_NORMALMAP ) && !defined ( OBJECTSPACE_NORMALMAP )) || ( defined ( USE_CLEARCOAT_NORMALMAP ) && !defined ( OBJECTSPACE_CLEARCOAT_NORMALMAP ) )
#if ( defined ( USE_NORMALMAP ) && !defined ( OBJECTSPACE_NORMALMAP )) || defined ( USE_CLEARCOAT_NORMALMAP )
// Per-Pixel Tangent Space Normal Mapping
// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html
......
......@@ -275,9 +275,8 @@ ShaderLib.physical = {
{
clearCoat: { value: 0 },
clearCoatRoughness: { value: 0 },
clearCoatGeometryNormals: { value: false },
clearCoatNormalScale: { value: new Vector2( 1, 1 ) },
clearCoatNormalMap: { value: null },
clearCoatNormalScale: { value: new Vector2( 1, 1 ) }
}
] ),
......
......@@ -10,7 +10,6 @@ uniform float opacity;
#ifndef STANDARD
uniform float clearCoat;
uniform float clearCoatRoughness;
uniform bool clearCoatGeometryNormals;
#endif
varying vec3 vViewPosition;
......
......@@ -3,7 +3,7 @@ export default /* glsl */`
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) ) || ( defined( USE_CLEARCOAT_NORMALMAP ) && ! defined( OBJECTSPACE_CLEARCOAT_NORMALMAP ) )
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) ) || defined( USE_CLEARCOAT_NORMALMAP )
varying vec3 vViewPosition;
......
export default /* glsl */ `
#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) ) || ( defined( USE_CLEARCOAT_NORMALMAP ) && ! defined( OBJECTSPACE_CLEARCOAT_NORMALMAP ) )
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) ) || defined( USE_CLEARCOAT_NORMALMAP )
varying vec3 vViewPosition;
......@@ -58,7 +58,7 @@ void main() {
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) ) || ( defined( USE_CLEARCOAT_NORMALMAP ) && ! defined( OBJECTSPACE_CLEARCOAT_NORMALMAP ) )
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) ) || defined( USE_CLEARCOAT_NORMALMAP )
vViewPosition = - mvPosition.xyz;
......
......@@ -118,7 +118,7 @@ function generateExtensions( extensions, parameters, rendererExtensions ) {
extensions = extensions || {};
var chunks = [
( extensions.derivatives || parameters.envMapCubeUV || parameters.bumpMap || ( parameters.normalMap && ! parameters.objectSpaceNormalMap ) || ( parameters.clearCoatNormalMap && ! parameters.objectSpaceClearCoatNormalMap ) || parameters.flatShading ) ? '#extension GL_OES_standard_derivatives : enable' : '',
( extensions.derivatives || parameters.envMapCubeUV || parameters.bumpMap || ( parameters.normalMap && ! parameters.objectSpaceNormalMap ) || parameters.clearCoatNormalMap || parameters.flatShading ) ? '#extension GL_OES_standard_derivatives : enable' : '',
( extensions.fragDepth || parameters.logarithmicDepthBuffer ) && rendererExtensions.get( 'EXT_frag_depth' ) ? '#extension GL_EXT_frag_depth : enable' : '',
( extensions.drawBuffers ) && rendererExtensions.get( 'WEBGL_draw_buffers' ) ? '#extension GL_EXT_draw_buffers : require' : '',
( extensions.shaderTextureLOD || parameters.envMap ) && rendererExtensions.get( 'EXT_shader_texture_lod' ) ? '#extension GL_EXT_shader_texture_lod : enable' : ''
......@@ -385,7 +385,6 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters,
parameters.normalMap ? '#define USE_NORMALMAP' : '',
( parameters.normalMap && parameters.objectSpaceNormalMap ) ? '#define OBJECTSPACE_NORMALMAP' : '',
parameters.clearCoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',
( parameters.clearCoatNormalMap && parameters.objectSpaceClearCoatNormalMap ) ? '#define OBJECTSPACE_CLEARCOAT_NORMALMAP' : '',
parameters.displacementMap && parameters.supportsVertexTextures ? '#define USE_DISPLACEMENTMAP' : '',
parameters.specularMap ? '#define USE_SPECULARMAP' : '',
parameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '',
......@@ -503,7 +502,6 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters,
parameters.normalMap ? '#define USE_NORMALMAP' : '',
( parameters.normalMap && parameters.objectSpaceNormalMap ) ? '#define OBJECTSPACE_NORMALMAP' : '',
parameters.clearCoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',
( parameters.clearCoatNormalMap && parameters.objectSpaceClearCoatNormalMap ) ? '#define OBJECTSPACE_CLEARCOAT_NORMALMAP' : '',
parameters.specularMap ? '#define USE_SPECULARMAP' : '',
parameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '',
parameters.metalnessMap ? '#define USE_METALNESSMAP' : '',
......
......@@ -29,7 +29,7 @@ function WebGLPrograms( renderer, extensions, capabilities ) {
var parameterNames = [
"precision", "supportsVertexTextures", "map", "mapEncoding", "matcap", "matcapEncoding", "envMap", "envMapMode", "envMapEncoding",
"lightMap", "aoMap", "emissiveMap", "emissiveMapEncoding", "bumpMap", "normalMap", "objectSpaceNormalMap", "clearCoatNormalMap", "objectSpaceClearCoatNormalMap",, "displacementMap", "specularMap",
"lightMap", "aoMap", "emissiveMap", "emissiveMapEncoding", "bumpMap", "normalMap", "objectSpaceNormalMap", "clearCoatNormalMap", "displacementMap", "specularMap",
"roughnessMap", "metalnessMap", "gradientMap",
"alphaMap", "combine", "vertexColors", "vertexTangents", "fog", "useFog", "fogExp",
"flatShading", "sizeAttenuation", "logarithmicDepthBuffer", "skinning",
......@@ -154,7 +154,6 @@ function WebGLPrograms( renderer, extensions, capabilities ) {
normalMap: !! material.normalMap,
objectSpaceNormalMap: material.normalMapType === ObjectSpaceNormalMap,
clearCoatNormalMap: !! material.clearCoatNormalMap,
objectSpaceClearCoatNormalMap: material.clearCoatNormalMapType === ObjectSpaceNormalMap,
displacementMap: !! material.displacementMap,
roughnessMap: !! material.roughnessMap,
metalnessMap: !! material.metalnessMap,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册