Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions examples/jsm/loaders/GLTFLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import {
NearestFilter,
NearestMipmapLinearFilter,
NearestMipmapNearestFilter,
NoBlending,
NumberKeyframeTrack,
Object3D,
OrthographicCamera,
Expand Down Expand Up @@ -3118,6 +3119,7 @@ class GLTFParser {

} else {

materialParams.blending = NoBlending;
materialParams.transparent = false;

if ( alphaMode === ALPHA_MODES.MASK ) {
Expand Down
2 changes: 2 additions & 0 deletions src/renderers/shaders/ShaderChunk.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ import normalmap_pars_fragment from './ShaderChunk/normalmap_pars_fragment.glsl.
import clearcoat_normal_fragment_begin from './ShaderChunk/clearcoat_normal_fragment_begin.glsl.js';
import clearcoat_normal_fragment_maps from './ShaderChunk/clearcoat_normal_fragment_maps.glsl.js';
import clearcoat_pars_fragment from './ShaderChunk/clearcoat_pars_fragment.glsl.js';
import output_fragment from './ShaderChunk/output_fragment.glsl.js';
import packing from './ShaderChunk/packing.glsl.js';
import premultiplied_alpha_fragment from './ShaderChunk/premultiplied_alpha_fragment.glsl.js';
import project_vertex from './ShaderChunk/project_vertex.glsl.js';
Expand Down Expand Up @@ -207,6 +208,7 @@ export const ShaderChunk = {
clearcoat_normal_fragment_begin: clearcoat_normal_fragment_begin,
clearcoat_normal_fragment_maps: clearcoat_normal_fragment_maps,
clearcoat_pars_fragment: clearcoat_pars_fragment,
output_fragment: output_fragment,
packing: packing,
premultiplied_alpha_fragment: premultiplied_alpha_fragment,
project_vertex: project_vertex,
Expand Down
11 changes: 11 additions & 0 deletions src/renderers/shaders/ShaderChunk/output_fragment.glsl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default /* glsl */`
#ifdef OPAQUE

gl_FragColor = vec4( outgoingLight, 1.0 );

#else

gl_FragColor = vec4( outgoingLight, diffuseColor.a );

#endif
`;
3 changes: 1 addition & 2 deletions src/renderers/shaders/ShaderLib/linedashed_frag.glsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ void main() {

outgoingLight = diffuseColor.rgb; // simple shader

gl_FragColor = vec4( outgoingLight, diffuseColor.a );

#include <output_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
Expand Down
3 changes: 1 addition & 2 deletions src/renderers/shaders/ShaderLib/meshbasic_frag.glsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ void main() {

#include <envmap_fragment>

gl_FragColor = vec4( outgoingLight, diffuseColor.a );

#include <output_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
Expand Down
3 changes: 1 addition & 2 deletions src/renderers/shaders/ShaderLib/meshlambert_frag.glsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ void main() {

#include <envmap_fragment>

gl_FragColor = vec4( outgoingLight, diffuseColor.a );

#include <output_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
Expand Down
3 changes: 1 addition & 2 deletions src/renderers/shaders/ShaderLib/meshmatcap_frag.glsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ void main() {

vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;

gl_FragColor = vec4( outgoingLight, diffuseColor.a );

#include <output_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
Expand Down
4 changes: 1 addition & 3 deletions src/renderers/shaders/ShaderLib/meshphong_frag.glsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ void main() {
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;

#include <envmap_fragment>

gl_FragColor = vec4( outgoingLight, diffuseColor.a );

#include <output_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
Expand Down
3 changes: 1 addition & 2 deletions src/renderers/shaders/ShaderLib/meshphysical_frag.glsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ void main() {

#endif

gl_FragColor = vec4( outgoingLight, diffuseColor.a );

#include <output_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
Expand Down
3 changes: 1 addition & 2 deletions src/renderers/shaders/ShaderLib/meshtoon_frag.glsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ void main() {

vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;

gl_FragColor = vec4( outgoingLight, diffuseColor.a );

#include <output_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
Expand Down
3 changes: 1 addition & 2 deletions src/renderers/shaders/ShaderLib/points_frag.glsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ void main() {

outgoingLight = diffuseColor.rgb;

gl_FragColor = vec4( outgoingLight, diffuseColor.a );

#include <output_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
Expand Down
3 changes: 1 addition & 2 deletions src/renderers/shaders/ShaderLib/sprite_frag.glsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ void main() {

outgoingLight = diffuseColor.rgb;

gl_FragColor = vec4( outgoingLight, diffuseColor.a );

#include <output_fragment>
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
Expand Down
3 changes: 2 additions & 1 deletion src/renderers/webgl/WebGLProgram.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { WebGLUniforms } from './WebGLUniforms.js';
import { WebGLShader } from './WebGLShader.js';
import { ShaderChunk } from '../shaders/ShaderChunk.js';
import { NoToneMapping, AddOperation, MixOperation, MultiplyOperation, CubeRefractionMapping, CubeUVRefractionMapping, CubeUVReflectionMapping, CubeReflectionMapping, PCFSoftShadowMap, PCFShadowMap, VSMShadowMap, ACESFilmicToneMapping, CineonToneMapping, CustomToneMapping, ReinhardToneMapping, LinearToneMapping, GammaEncoding, RGBDEncoding, RGBM16Encoding, RGBM7Encoding, RGBEEncoding, sRGBEncoding, LinearEncoding, LogLuvEncoding, GLSL3 } from '../../constants.js';
import { NoBlending, NoToneMapping, AddOperation, MixOperation, MultiplyOperation, CubeRefractionMapping, CubeUVRefractionMapping, CubeUVReflectionMapping, CubeReflectionMapping, PCFSoftShadowMap, PCFShadowMap, VSMShadowMap, ACESFilmicToneMapping, CineonToneMapping, CustomToneMapping, ReinhardToneMapping, LinearToneMapping, GammaEncoding, RGBDEncoding, RGBM16Encoding, RGBM7Encoding, RGBEEncoding, sRGBEncoding, LinearEncoding, LogLuvEncoding, GLSL3 } from '../../constants.js';

let programIdCount = 0;

Expand Down Expand Up @@ -670,6 +670,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
( parameters.toneMapping !== NoToneMapping ) ? getToneMappingFunction( 'toneMapping', parameters.toneMapping ) : '',

parameters.dithering ? '#define DITHERING' : '',
parameters.blending === NoBlending ? '#define OPAQUE' : '',

ShaderChunk[ 'encodings_pars_fragment' ], // this code is required here because it is used by the various encoding/decoding function defined below
parameters.map ? getTexelDecodingFunction( 'mapTexelToLinear', parameters.mapEncoding ) : '',
Expand Down
4 changes: 3 additions & 1 deletion src/renderers/webgl/WebGLPrograms.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
'numDirLights', 'numPointLights', 'numSpotLights', 'numHemiLights', 'numRectAreaLights',
'numDirLightShadows', 'numPointLightShadows', 'numSpotLightShadows',
'shadowMapEnabled', 'shadowMapType', 'toneMapping', 'physicallyCorrectLights',
'doubleSided', 'flipSided', 'numClippingPlanes', 'numClipIntersection', 'depthPacking', 'dithering',
'doubleSided', 'flipSided', 'numClippingPlanes', 'numClipIntersection', 'depthPacking', 'dithering', 'blending',
'sheenTint', 'transmission', 'transmissionMap', 'thicknessMap'
];

Expand Down Expand Up @@ -208,6 +208,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
specularIntensityMap: !! material.specularIntensityMap,
specularTintMap: !! material.specularTintMap,
specularTintMapEncoding: getTextureEncodingFromMap( material.specularTintMap ),

alphaMap: !! material.alphaMap,
alphaTest: useAlphaTest,

Expand Down Expand Up @@ -256,6 +257,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
numClippingPlanes: clipping.numPlanes,
numClipIntersection: clipping.numIntersection,

blending: material.blending,
dithering: material.dithering,

shadowMapEnabled: renderer.shadowMap.enabled && shadows.length > 0,
Expand Down