|
@@ -13784,7 +13784,7 @@ var specularmap_pars_fragment = "#ifdef USE_SPECULARMAP\n\tuniform sampler2D spe
|
|
|
|
|
|
var tonemapping_fragment = "#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif";
|
|
var tonemapping_fragment = "#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif";
|
|
|
|
|
|
-var tonemapping_pars_fragment = "#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }";
|
|
|
|
|
|
+var tonemapping_pars_fragment = "#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }";
|
|
|
|
|
|
var transmission_fragment = "#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif";
|
|
var transmission_fragment = "#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif";
|
|
|
|
|
|
@@ -19379,6 +19379,9 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
|
|
|
prefixVertex = [
|
|
prefixVertex = [
|
|
|
|
|
|
|
|
+ '#define SHADER_TYPE ' + parameters.shaderType,
|
|
|
|
+ '#define SHADER_NAME ' + parameters.shaderName,
|
|
|
|
+
|
|
customDefines
|
|
customDefines
|
|
|
|
|
|
].filter( filterEmptyLine ).join( '\n' );
|
|
].filter( filterEmptyLine ).join( '\n' );
|
|
@@ -19392,6 +19395,10 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
prefixFragment = [
|
|
prefixFragment = [
|
|
|
|
|
|
customExtensions,
|
|
customExtensions,
|
|
|
|
+
|
|
|
|
+ '#define SHADER_TYPE ' + parameters.shaderType,
|
|
|
|
+ '#define SHADER_NAME ' + parameters.shaderName,
|
|
|
|
+
|
|
customDefines
|
|
customDefines
|
|
|
|
|
|
].filter( filterEmptyLine ).join( '\n' );
|
|
].filter( filterEmptyLine ).join( '\n' );
|
|
@@ -19408,6 +19415,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
|
|
|
generatePrecision( parameters ),
|
|
generatePrecision( parameters ),
|
|
|
|
|
|
|
|
+ '#define SHADER_TYPE ' + parameters.shaderType,
|
|
'#define SHADER_NAME ' + parameters.shaderName,
|
|
'#define SHADER_NAME ' + parameters.shaderName,
|
|
|
|
|
|
customDefines,
|
|
customDefines,
|
|
@@ -19621,6 +19629,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
|
|
|
generatePrecision( parameters ),
|
|
generatePrecision( parameters ),
|
|
|
|
|
|
|
|
+ '#define SHADER_TYPE ' + parameters.shaderType,
|
|
'#define SHADER_NAME ' + parameters.shaderName,
|
|
'#define SHADER_NAME ' + parameters.shaderName,
|
|
|
|
|
|
customDefines,
|
|
customDefines,
|
|
@@ -19919,6 +19928,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
|
|
|
//
|
|
//
|
|
|
|
|
|
|
|
+ this.type = parameters.shaderType;
|
|
this.name = parameters.shaderName;
|
|
this.name = parameters.shaderName;
|
|
this.id = programIdCount ++;
|
|
this.id = programIdCount ++;
|
|
this.cacheKey = cacheKey;
|
|
this.cacheKey = cacheKey;
|
|
@@ -20212,7 +20222,8 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
isWebGL2: IS_WEBGL2,
|
|
isWebGL2: IS_WEBGL2,
|
|
|
|
|
|
shaderID: shaderID,
|
|
shaderID: shaderID,
|
|
- shaderName: material.type,
|
|
|
|
|
|
+ shaderType: material.type,
|
|
|
|
+ shaderName: material.name,
|
|
|
|
|
|
vertexShader: vertexShader,
|
|
vertexShader: vertexShader,
|
|
fragmentShader: fragmentShader,
|
|
fragmentShader: fragmentShader,
|
|
@@ -29119,7 +29130,7 @@ class WebGLRenderer {
|
|
|
|
|
|
const isWebGL2 = capabilities.isWebGL2;
|
|
const isWebGL2 = capabilities.isWebGL2;
|
|
|
|
|
|
- _transmissionRenderTarget = new WebGLRenderTarget( 1024, 1024, {
|
|
|
|
|
|
+ _transmissionRenderTarget = new WebGLRenderTarget( 1024 * _pixelRatio, 1024 * _pixelRatio, {
|
|
generateMipmaps: true,
|
|
generateMipmaps: true,
|
|
type: extensions.has( 'EXT_color_buffer_half_float' ) ? HalfFloatType : UnsignedByteType,
|
|
type: extensions.has( 'EXT_color_buffer_half_float' ) ? HalfFloatType : UnsignedByteType,
|
|
minFilter: LinearMipmapLinearFilter,
|
|
minFilter: LinearMipmapLinearFilter,
|