initial commit
This commit is contained in:
9
lib/renderers/shaders/ShaderLib/background_frag.glsl
Normal file
9
lib/renderers/shaders/ShaderLib/background_frag.glsl
Normal file
@ -0,0 +1,9 @@
|
||||
uniform sampler2D t2D;
|
||||
|
||||
varying vec2 vUv;
|
||||
|
||||
void main() {
|
||||
|
||||
gl_FragColor = texture2D( t2D, vUv );
|
||||
|
||||
}
|
10
lib/renderers/shaders/ShaderLib/background_vert.glsl
Normal file
10
lib/renderers/shaders/ShaderLib/background_vert.glsl
Normal file
@ -0,0 +1,10 @@
|
||||
varying vec2 vUv;
|
||||
|
||||
void main() {
|
||||
|
||||
vUv = uv;
|
||||
|
||||
gl_Position = vec4( position, 1.0 );
|
||||
gl_Position.z = 1.0;
|
||||
|
||||
}
|
12
lib/renderers/shaders/ShaderLib/cube_frag.glsl
Normal file
12
lib/renderers/shaders/ShaderLib/cube_frag.glsl
Normal file
@ -0,0 +1,12 @@
|
||||
uniform samplerCube tCube;
|
||||
uniform float tFlip;
|
||||
uniform float opacity;
|
||||
|
||||
varying vec3 vWorldDirection;
|
||||
|
||||
void main() {
|
||||
|
||||
gl_FragColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
|
||||
gl_FragColor.a *= opacity;
|
||||
|
||||
}
|
14
lib/renderers/shaders/ShaderLib/cube_vert.glsl
Normal file
14
lib/renderers/shaders/ShaderLib/cube_vert.glsl
Normal file
@ -0,0 +1,14 @@
|
||||
varying vec3 vWorldDirection;
|
||||
|
||||
#include <common>
|
||||
|
||||
void main() {
|
||||
|
||||
vWorldDirection = transformDirection( position, modelMatrix );
|
||||
|
||||
#include <begin_vertex>
|
||||
#include <project_vertex>
|
||||
|
||||
gl_Position.z = gl_Position.w; // set z to camera.far
|
||||
|
||||
}
|
43
lib/renderers/shaders/ShaderLib/depth_frag.glsl
Normal file
43
lib/renderers/shaders/ShaderLib/depth_frag.glsl
Normal file
@ -0,0 +1,43 @@
|
||||
#if DEPTH_PACKING == 3200
|
||||
|
||||
uniform float opacity;
|
||||
|
||||
#endif
|
||||
|
||||
#include <common>
|
||||
#include <packing>
|
||||
#include <uv_pars_fragment>
|
||||
#include <map_pars_fragment>
|
||||
#include <alphamap_pars_fragment>
|
||||
#include <logdepthbuf_pars_fragment>
|
||||
#include <clipping_planes_pars_fragment>
|
||||
|
||||
void main() {
|
||||
|
||||
#include <clipping_planes_fragment>
|
||||
|
||||
vec4 diffuseColor = vec4( 1.0 );
|
||||
|
||||
#if DEPTH_PACKING == 3200
|
||||
|
||||
diffuseColor.a = opacity;
|
||||
|
||||
#endif
|
||||
|
||||
#include <map_fragment>
|
||||
#include <alphamap_fragment>
|
||||
#include <alphatest_fragment>
|
||||
|
||||
#include <logdepthbuf_fragment>
|
||||
|
||||
#if DEPTH_PACKING == 3200
|
||||
|
||||
gl_FragColor = vec4( vec3( 1.0 - gl_FragCoord.z ), opacity );
|
||||
|
||||
#elif DEPTH_PACKING == 3201
|
||||
|
||||
gl_FragColor = packDepthToRGBA( gl_FragCoord.z );
|
||||
|
||||
#endif
|
||||
|
||||
}
|
31
lib/renderers/shaders/ShaderLib/depth_vert.glsl
Normal file
31
lib/renderers/shaders/ShaderLib/depth_vert.glsl
Normal file
@ -0,0 +1,31 @@
|
||||
#include <common>
|
||||
#include <uv_pars_vertex>
|
||||
#include <displacementmap_pars_vertex>
|
||||
#include <morphtarget_pars_vertex>
|
||||
#include <skinning_pars_vertex>
|
||||
#include <logdepthbuf_pars_vertex>
|
||||
#include <clipping_planes_pars_vertex>
|
||||
|
||||
void main() {
|
||||
|
||||
#include <uv_vertex>
|
||||
|
||||
#include <skinbase_vertex>
|
||||
|
||||
#ifdef USE_DISPLACEMENTMAP
|
||||
|
||||
#include <beginnormal_vertex>
|
||||
#include <morphnormal_vertex>
|
||||
#include <skinnormal_vertex>
|
||||
|
||||
#endif
|
||||
|
||||
#include <begin_vertex>
|
||||
#include <morphtarget_vertex>
|
||||
#include <skinning_vertex>
|
||||
#include <displacementmap_vertex>
|
||||
#include <project_vertex>
|
||||
#include <logdepthbuf_vertex>
|
||||
#include <clipping_planes_vertex>
|
||||
|
||||
}
|
31
lib/renderers/shaders/ShaderLib/distanceRGBA_frag.glsl
Normal file
31
lib/renderers/shaders/ShaderLib/distanceRGBA_frag.glsl
Normal file
@ -0,0 +1,31 @@
|
||||
#define DISTANCE
|
||||
|
||||
uniform vec3 referencePosition;
|
||||
uniform float nearDistance;
|
||||
uniform float farDistance;
|
||||
varying vec3 vWorldPosition;
|
||||
|
||||
#include <common>
|
||||
#include <packing>
|
||||
#include <uv_pars_fragment>
|
||||
#include <map_pars_fragment>
|
||||
#include <alphamap_pars_fragment>
|
||||
#include <clipping_planes_pars_fragment>
|
||||
|
||||
void main () {
|
||||
|
||||
#include <clipping_planes_fragment>
|
||||
|
||||
vec4 diffuseColor = vec4( 1.0 );
|
||||
|
||||
#include <map_fragment>
|
||||
#include <alphamap_fragment>
|
||||
#include <alphatest_fragment>
|
||||
|
||||
float dist = length( vWorldPosition - referencePosition );
|
||||
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
|
||||
dist = saturate( dist ); // clamp to [ 0, 1 ]
|
||||
|
||||
gl_FragColor = packDepthToRGBA( dist );
|
||||
|
||||
}
|
36
lib/renderers/shaders/ShaderLib/distanceRGBA_vert.glsl
Normal file
36
lib/renderers/shaders/ShaderLib/distanceRGBA_vert.glsl
Normal file
@ -0,0 +1,36 @@
|
||||
#define DISTANCE
|
||||
|
||||
varying vec3 vWorldPosition;
|
||||
|
||||
#include <common>
|
||||
#include <uv_pars_vertex>
|
||||
#include <displacementmap_pars_vertex>
|
||||
#include <morphtarget_pars_vertex>
|
||||
#include <skinning_pars_vertex>
|
||||
#include <clipping_planes_pars_vertex>
|
||||
|
||||
void main() {
|
||||
|
||||
#include <uv_vertex>
|
||||
|
||||
#include <skinbase_vertex>
|
||||
|
||||
#ifdef USE_DISPLACEMENTMAP
|
||||
|
||||
#include <beginnormal_vertex>
|
||||
#include <morphnormal_vertex>
|
||||
#include <skinnormal_vertex>
|
||||
|
||||
#endif
|
||||
|
||||
#include <begin_vertex>
|
||||
#include <morphtarget_vertex>
|
||||
#include <skinning_vertex>
|
||||
#include <displacementmap_vertex>
|
||||
#include <project_vertex>
|
||||
#include <worldpos_vertex>
|
||||
#include <clipping_planes_vertex>
|
||||
|
||||
vWorldPosition = worldPosition.xyz;
|
||||
|
||||
}
|
19
lib/renderers/shaders/ShaderLib/equirect_frag.glsl
Normal file
19
lib/renderers/shaders/ShaderLib/equirect_frag.glsl
Normal file
@ -0,0 +1,19 @@
|
||||
uniform sampler2D tEquirect;
|
||||
|
||||
varying vec3 vWorldDirection;
|
||||
|
||||
#include <common>
|
||||
|
||||
void main() {
|
||||
|
||||
vec3 direction = normalize( vWorldDirection );
|
||||
|
||||
vec2 sampleUV;
|
||||
|
||||
sampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
|
||||
|
||||
sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;
|
||||
|
||||
gl_FragColor = texture2D( tEquirect, sampleUV );
|
||||
|
||||
}
|
12
lib/renderers/shaders/ShaderLib/equirect_vert.glsl
Normal file
12
lib/renderers/shaders/ShaderLib/equirect_vert.glsl
Normal file
@ -0,0 +1,12 @@
|
||||
varying vec3 vWorldDirection;
|
||||
|
||||
#include <common>
|
||||
|
||||
void main() {
|
||||
|
||||
vWorldDirection = transformDirection( position, modelMatrix );
|
||||
|
||||
#include <begin_vertex>
|
||||
#include <project_vertex>
|
||||
|
||||
}
|
40
lib/renderers/shaders/ShaderLib/linedashed_frag.glsl
Normal file
40
lib/renderers/shaders/ShaderLib/linedashed_frag.glsl
Normal file
@ -0,0 +1,40 @@
|
||||
uniform vec3 diffuse;
|
||||
uniform float opacity;
|
||||
|
||||
uniform float dashSize;
|
||||
uniform float totalSize;
|
||||
|
||||
varying float vLineDistance;
|
||||
|
||||
#include <common>
|
||||
#include <color_pars_fragment>
|
||||
#include <fog_pars_fragment>
|
||||
#include <logdepthbuf_pars_fragment>
|
||||
#include <clipping_planes_pars_fragment>
|
||||
|
||||
void main() {
|
||||
|
||||
#include <clipping_planes_fragment>
|
||||
|
||||
if ( mod( vLineDistance, totalSize ) > dashSize ) {
|
||||
|
||||
discard;
|
||||
|
||||
}
|
||||
|
||||
vec3 outgoingLight = vec3( 0.0 );
|
||||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||||
|
||||
#include <logdepthbuf_fragment>
|
||||
#include <color_fragment>
|
||||
|
||||
outgoingLight = diffuseColor.rgb; // simple shader
|
||||
|
||||
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
|
||||
|
||||
#include <premultiplied_alpha_fragment>
|
||||
#include <tonemapping_fragment>
|
||||
#include <encodings_fragment>
|
||||
#include <fog_fragment>
|
||||
|
||||
}
|
25
lib/renderers/shaders/ShaderLib/linedashed_vert.glsl
Normal file
25
lib/renderers/shaders/ShaderLib/linedashed_vert.glsl
Normal file
@ -0,0 +1,25 @@
|
||||
uniform float scale;
|
||||
attribute float lineDistance;
|
||||
|
||||
varying float vLineDistance;
|
||||
|
||||
#include <common>
|
||||
#include <color_pars_vertex>
|
||||
#include <fog_pars_vertex>
|
||||
#include <logdepthbuf_pars_vertex>
|
||||
#include <clipping_planes_pars_vertex>
|
||||
|
||||
void main() {
|
||||
|
||||
#include <color_vertex>
|
||||
|
||||
vLineDistance = scale * lineDistance;
|
||||
|
||||
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
|
||||
gl_Position = projectionMatrix * mvPosition;
|
||||
|
||||
#include <logdepthbuf_vertex>
|
||||
#include <clipping_planes_vertex>
|
||||
#include <fog_vertex>
|
||||
|
||||
}
|
66
lib/renderers/shaders/ShaderLib/meshbasic_frag.glsl
Normal file
66
lib/renderers/shaders/ShaderLib/meshbasic_frag.glsl
Normal file
@ -0,0 +1,66 @@
|
||||
uniform vec3 diffuse;
|
||||
uniform float opacity;
|
||||
|
||||
#ifndef FLAT_SHADED
|
||||
|
||||
varying vec3 vNormal;
|
||||
|
||||
#endif
|
||||
|
||||
#include <common>
|
||||
#include <color_pars_fragment>
|
||||
#include <uv_pars_fragment>
|
||||
#include <uv2_pars_fragment>
|
||||
#include <map_pars_fragment>
|
||||
#include <alphamap_pars_fragment>
|
||||
#include <aomap_pars_fragment>
|
||||
#include <lightmap_pars_fragment>
|
||||
#include <envmap_pars_fragment>
|
||||
#include <fog_pars_fragment>
|
||||
#include <specularmap_pars_fragment>
|
||||
#include <logdepthbuf_pars_fragment>
|
||||
#include <clipping_planes_pars_fragment>
|
||||
|
||||
void main() {
|
||||
|
||||
#include <clipping_planes_fragment>
|
||||
|
||||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||||
|
||||
#include <logdepthbuf_fragment>
|
||||
#include <map_fragment>
|
||||
#include <color_fragment>
|
||||
#include <alphamap_fragment>
|
||||
#include <alphatest_fragment>
|
||||
#include <specularmap_fragment>
|
||||
|
||||
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
||||
|
||||
// accumulation (baked indirect lighting only)
|
||||
#ifdef USE_LIGHTMAP
|
||||
|
||||
reflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;
|
||||
|
||||
#else
|
||||
|
||||
reflectedLight.indirectDiffuse += vec3( 1.0 );
|
||||
|
||||
#endif
|
||||
|
||||
// modulation
|
||||
#include <aomap_fragment>
|
||||
|
||||
reflectedLight.indirectDiffuse *= diffuseColor.rgb;
|
||||
|
||||
vec3 outgoingLight = reflectedLight.indirectDiffuse;
|
||||
|
||||
#include <envmap_fragment>
|
||||
|
||||
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
|
||||
|
||||
#include <premultiplied_alpha_fragment>
|
||||
#include <tonemapping_fragment>
|
||||
#include <encodings_fragment>
|
||||
#include <fog_fragment>
|
||||
|
||||
}
|
39
lib/renderers/shaders/ShaderLib/meshbasic_vert.glsl
Normal file
39
lib/renderers/shaders/ShaderLib/meshbasic_vert.glsl
Normal file
@ -0,0 +1,39 @@
|
||||
#include <common>
|
||||
#include <uv_pars_vertex>
|
||||
#include <uv2_pars_vertex>
|
||||
#include <envmap_pars_vertex>
|
||||
#include <color_pars_vertex>
|
||||
#include <fog_pars_vertex>
|
||||
#include <morphtarget_pars_vertex>
|
||||
#include <skinning_pars_vertex>
|
||||
#include <logdepthbuf_pars_vertex>
|
||||
#include <clipping_planes_pars_vertex>
|
||||
|
||||
void main() {
|
||||
|
||||
#include <uv_vertex>
|
||||
#include <uv2_vertex>
|
||||
#include <color_vertex>
|
||||
#include <skinbase_vertex>
|
||||
|
||||
#ifdef USE_ENVMAP
|
||||
|
||||
#include <beginnormal_vertex>
|
||||
#include <morphnormal_vertex>
|
||||
#include <skinnormal_vertex>
|
||||
#include <defaultnormal_vertex>
|
||||
|
||||
#endif
|
||||
|
||||
#include <begin_vertex>
|
||||
#include <morphtarget_vertex>
|
||||
#include <skinning_vertex>
|
||||
#include <project_vertex>
|
||||
#include <logdepthbuf_vertex>
|
||||
|
||||
#include <worldpos_vertex>
|
||||
#include <clipping_planes_vertex>
|
||||
#include <envmap_vertex>
|
||||
#include <fog_vertex>
|
||||
|
||||
}
|
84
lib/renderers/shaders/ShaderLib/meshlambert_frag.glsl
Normal file
84
lib/renderers/shaders/ShaderLib/meshlambert_frag.glsl
Normal file
@ -0,0 +1,84 @@
|
||||
uniform vec3 diffuse;
|
||||
uniform vec3 emissive;
|
||||
uniform float opacity;
|
||||
|
||||
varying vec3 vLightFront;
|
||||
|
||||
#ifdef DOUBLE_SIDED
|
||||
|
||||
varying vec3 vLightBack;
|
||||
|
||||
#endif
|
||||
|
||||
#include <common>
|
||||
#include <packing>
|
||||
#include <dithering_pars_fragment>
|
||||
#include <color_pars_fragment>
|
||||
#include <uv_pars_fragment>
|
||||
#include <uv2_pars_fragment>
|
||||
#include <map_pars_fragment>
|
||||
#include <alphamap_pars_fragment>
|
||||
#include <aomap_pars_fragment>
|
||||
#include <lightmap_pars_fragment>
|
||||
#include <emissivemap_pars_fragment>
|
||||
#include <envmap_pars_fragment>
|
||||
#include <bsdfs>
|
||||
#include <lights_pars_begin>
|
||||
#include <fog_pars_fragment>
|
||||
#include <shadowmap_pars_fragment>
|
||||
#include <shadowmask_pars_fragment>
|
||||
#include <specularmap_pars_fragment>
|
||||
#include <logdepthbuf_pars_fragment>
|
||||
#include <clipping_planes_pars_fragment>
|
||||
|
||||
void main() {
|
||||
|
||||
#include <clipping_planes_fragment>
|
||||
|
||||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||||
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
||||
vec3 totalEmissiveRadiance = emissive;
|
||||
|
||||
#include <logdepthbuf_fragment>
|
||||
#include <map_fragment>
|
||||
#include <color_fragment>
|
||||
#include <alphamap_fragment>
|
||||
#include <alphatest_fragment>
|
||||
#include <specularmap_fragment>
|
||||
#include <emissivemap_fragment>
|
||||
|
||||
// accumulation
|
||||
reflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );
|
||||
|
||||
#include <lightmap_fragment>
|
||||
|
||||
reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );
|
||||
|
||||
#ifdef DOUBLE_SIDED
|
||||
|
||||
reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;
|
||||
|
||||
#else
|
||||
|
||||
reflectedLight.directDiffuse = vLightFront;
|
||||
|
||||
#endif
|
||||
|
||||
reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();
|
||||
|
||||
// modulation
|
||||
#include <aomap_fragment>
|
||||
|
||||
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
|
||||
|
||||
#include <envmap_fragment>
|
||||
|
||||
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
|
||||
|
||||
#include <tonemapping_fragment>
|
||||
#include <encodings_fragment>
|
||||
#include <fog_fragment>
|
||||
#include <premultiplied_alpha_fragment>
|
||||
#include <dithering_fragment>
|
||||
|
||||
}
|
50
lib/renderers/shaders/ShaderLib/meshlambert_vert.glsl
Normal file
50
lib/renderers/shaders/ShaderLib/meshlambert_vert.glsl
Normal file
@ -0,0 +1,50 @@
|
||||
#define LAMBERT
|
||||
|
||||
varying vec3 vLightFront;
|
||||
|
||||
#ifdef DOUBLE_SIDED
|
||||
|
||||
varying vec3 vLightBack;
|
||||
|
||||
#endif
|
||||
|
||||
#include <common>
|
||||
#include <uv_pars_vertex>
|
||||
#include <uv2_pars_vertex>
|
||||
#include <envmap_pars_vertex>
|
||||
#include <bsdfs>
|
||||
#include <lights_pars_begin>
|
||||
#include <color_pars_vertex>
|
||||
#include <fog_pars_vertex>
|
||||
#include <morphtarget_pars_vertex>
|
||||
#include <skinning_pars_vertex>
|
||||
#include <shadowmap_pars_vertex>
|
||||
#include <logdepthbuf_pars_vertex>
|
||||
#include <clipping_planes_pars_vertex>
|
||||
|
||||
void main() {
|
||||
|
||||
#include <uv_vertex>
|
||||
#include <uv2_vertex>
|
||||
#include <color_vertex>
|
||||
|
||||
#include <beginnormal_vertex>
|
||||
#include <morphnormal_vertex>
|
||||
#include <skinbase_vertex>
|
||||
#include <skinnormal_vertex>
|
||||
#include <defaultnormal_vertex>
|
||||
|
||||
#include <begin_vertex>
|
||||
#include <morphtarget_vertex>
|
||||
#include <skinning_vertex>
|
||||
#include <project_vertex>
|
||||
#include <logdepthbuf_vertex>
|
||||
#include <clipping_planes_vertex>
|
||||
|
||||
#include <worldpos_vertex>
|
||||
#include <envmap_vertex>
|
||||
#include <lights_lambert_vertex>
|
||||
#include <shadowmap_vertex>
|
||||
#include <fog_vertex>
|
||||
|
||||
}
|
57
lib/renderers/shaders/ShaderLib/meshmatcap_frag.glsl
Normal file
57
lib/renderers/shaders/ShaderLib/meshmatcap_frag.glsl
Normal file
@ -0,0 +1,57 @@
|
||||
#define MATCAP
|
||||
|
||||
uniform vec3 diffuse;
|
||||
uniform float opacity;
|
||||
uniform sampler2D matcap;
|
||||
|
||||
varying vec3 vViewPosition;
|
||||
|
||||
#ifndef FLAT_SHADED
|
||||
|
||||
varying vec3 vNormal;
|
||||
|
||||
#endif
|
||||
|
||||
#include <common>
|
||||
#include <uv_pars_fragment>
|
||||
#include <map_pars_fragment>
|
||||
#include <alphamap_pars_fragment>
|
||||
|
||||
#include <fog_pars_fragment>
|
||||
#include <bumpmap_pars_fragment>
|
||||
#include <normalmap_pars_fragment>
|
||||
#include <logdepthbuf_pars_fragment>
|
||||
#include <clipping_planes_pars_fragment>
|
||||
|
||||
void main() {
|
||||
|
||||
#include <clipping_planes_fragment>
|
||||
|
||||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||||
|
||||
#include <logdepthbuf_fragment>
|
||||
#include <map_fragment>
|
||||
#include <alphamap_fragment>
|
||||
#include <alphatest_fragment>
|
||||
#include <normal_fragment_begin>
|
||||
#include <normal_fragment_maps>
|
||||
|
||||
vec3 viewDir = normalize( vViewPosition );
|
||||
vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
|
||||
vec3 y = cross( viewDir, x );
|
||||
vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; // 0.495 to remove artifacts caused by undersized matcap disks
|
||||
|
||||
vec4 matcapColor = texture2D( matcap, uv );
|
||||
|
||||
matcapColor = matcapTexelToLinear( matcapColor );
|
||||
|
||||
vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
|
||||
|
||||
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
|
||||
|
||||
#include <premultiplied_alpha_fragment>
|
||||
#include <tonemapping_fragment>
|
||||
#include <encodings_fragment>
|
||||
#include <fog_fragment>
|
||||
|
||||
}
|
49
lib/renderers/shaders/ShaderLib/meshmatcap_vert.glsl
Normal file
49
lib/renderers/shaders/ShaderLib/meshmatcap_vert.glsl
Normal file
@ -0,0 +1,49 @@
|
||||
#define MATCAP
|
||||
|
||||
varying vec3 vViewPosition;
|
||||
|
||||
#ifndef FLAT_SHADED
|
||||
|
||||
varying vec3 vNormal;
|
||||
|
||||
#endif
|
||||
|
||||
#include <common>
|
||||
#include <uv_pars_vertex>
|
||||
#include <displacementmap_pars_vertex>
|
||||
#include <fog_pars_vertex>
|
||||
#include <morphtarget_pars_vertex>
|
||||
#include <skinning_pars_vertex>
|
||||
|
||||
#include <logdepthbuf_pars_vertex>
|
||||
#include <clipping_planes_pars_vertex>
|
||||
|
||||
void main() {
|
||||
|
||||
#include <uv_vertex>
|
||||
|
||||
#include <beginnormal_vertex>
|
||||
#include <morphnormal_vertex>
|
||||
#include <skinbase_vertex>
|
||||
#include <skinnormal_vertex>
|
||||
#include <defaultnormal_vertex>
|
||||
|
||||
#ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED
|
||||
|
||||
vNormal = normalize( transformedNormal );
|
||||
|
||||
#endif
|
||||
|
||||
#include <begin_vertex>
|
||||
#include <morphtarget_vertex>
|
||||
#include <skinning_vertex>
|
||||
#include <displacementmap_vertex>
|
||||
#include <project_vertex>
|
||||
|
||||
#include <logdepthbuf_vertex>
|
||||
#include <clipping_planes_vertex>
|
||||
#include <fog_vertex>
|
||||
|
||||
vViewPosition = - mvPosition.xyz;
|
||||
|
||||
}
|
72
lib/renderers/shaders/ShaderLib/meshphong_frag.glsl
Normal file
72
lib/renderers/shaders/ShaderLib/meshphong_frag.glsl
Normal file
@ -0,0 +1,72 @@
|
||||
#define PHONG
|
||||
|
||||
uniform vec3 diffuse;
|
||||
uniform vec3 emissive;
|
||||
uniform vec3 specular;
|
||||
uniform float shininess;
|
||||
uniform float opacity;
|
||||
|
||||
#include <common>
|
||||
#include <packing>
|
||||
#include <dithering_pars_fragment>
|
||||
#include <color_pars_fragment>
|
||||
#include <uv_pars_fragment>
|
||||
#include <uv2_pars_fragment>
|
||||
#include <map_pars_fragment>
|
||||
#include <alphamap_pars_fragment>
|
||||
#include <aomap_pars_fragment>
|
||||
#include <lightmap_pars_fragment>
|
||||
#include <emissivemap_pars_fragment>
|
||||
#include <envmap_pars_fragment>
|
||||
#include <gradientmap_pars_fragment>
|
||||
#include <fog_pars_fragment>
|
||||
#include <bsdfs>
|
||||
#include <lights_pars_begin>
|
||||
#include <lights_phong_pars_fragment>
|
||||
#include <shadowmap_pars_fragment>
|
||||
#include <bumpmap_pars_fragment>
|
||||
#include <normalmap_pars_fragment>
|
||||
#include <specularmap_pars_fragment>
|
||||
#include <logdepthbuf_pars_fragment>
|
||||
#include <clipping_planes_pars_fragment>
|
||||
|
||||
void main() {
|
||||
|
||||
#include <clipping_planes_fragment>
|
||||
|
||||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||||
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
||||
vec3 totalEmissiveRadiance = emissive;
|
||||
|
||||
#include <logdepthbuf_fragment>
|
||||
#include <map_fragment>
|
||||
#include <color_fragment>
|
||||
#include <alphamap_fragment>
|
||||
#include <alphatest_fragment>
|
||||
#include <specularmap_fragment>
|
||||
#include <normal_fragment_begin>
|
||||
#include <normal_fragment_maps>
|
||||
#include <emissivemap_fragment>
|
||||
|
||||
// accumulation
|
||||
#include <lights_phong_fragment>
|
||||
#include <lights_fragment_begin>
|
||||
#include <lights_fragment_maps>
|
||||
#include <lights_fragment_end>
|
||||
|
||||
// modulation
|
||||
#include <aomap_fragment>
|
||||
|
||||
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
|
||||
|
||||
#include <envmap_fragment>
|
||||
|
||||
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
|
||||
|
||||
#include <tonemapping_fragment>
|
||||
#include <encodings_fragment>
|
||||
#include <fog_fragment>
|
||||
#include <premultiplied_alpha_fragment>
|
||||
#include <dithering_fragment>
|
||||
|
||||
}
|
57
lib/renderers/shaders/ShaderLib/meshphong_vert.glsl
Normal file
57
lib/renderers/shaders/ShaderLib/meshphong_vert.glsl
Normal file
@ -0,0 +1,57 @@
|
||||
#define PHONG
|
||||
|
||||
varying vec3 vViewPosition;
|
||||
|
||||
#ifndef FLAT_SHADED
|
||||
|
||||
varying vec3 vNormal;
|
||||
|
||||
#endif
|
||||
|
||||
#include <common>
|
||||
#include <uv_pars_vertex>
|
||||
#include <uv2_pars_vertex>
|
||||
#include <displacementmap_pars_vertex>
|
||||
#include <envmap_pars_vertex>
|
||||
#include <color_pars_vertex>
|
||||
#include <fog_pars_vertex>
|
||||
#include <morphtarget_pars_vertex>
|
||||
#include <skinning_pars_vertex>
|
||||
#include <shadowmap_pars_vertex>
|
||||
#include <logdepthbuf_pars_vertex>
|
||||
#include <clipping_planes_pars_vertex>
|
||||
|
||||
void main() {
|
||||
|
||||
#include <uv_vertex>
|
||||
#include <uv2_vertex>
|
||||
#include <color_vertex>
|
||||
|
||||
#include <beginnormal_vertex>
|
||||
#include <morphnormal_vertex>
|
||||
#include <skinbase_vertex>
|
||||
#include <skinnormal_vertex>
|
||||
#include <defaultnormal_vertex>
|
||||
|
||||
#ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED
|
||||
|
||||
vNormal = normalize( transformedNormal );
|
||||
|
||||
#endif
|
||||
|
||||
#include <begin_vertex>
|
||||
#include <morphtarget_vertex>
|
||||
#include <skinning_vertex>
|
||||
#include <displacementmap_vertex>
|
||||
#include <project_vertex>
|
||||
#include <logdepthbuf_vertex>
|
||||
#include <clipping_planes_vertex>
|
||||
|
||||
vViewPosition = - mvPosition.xyz;
|
||||
|
||||
#include <worldpos_vertex>
|
||||
#include <envmap_vertex>
|
||||
#include <shadowmap_vertex>
|
||||
#include <fog_vertex>
|
||||
|
||||
}
|
86
lib/renderers/shaders/ShaderLib/meshphysical_frag.glsl
Normal file
86
lib/renderers/shaders/ShaderLib/meshphysical_frag.glsl
Normal file
@ -0,0 +1,86 @@
|
||||
#define PHYSICAL
|
||||
|
||||
uniform vec3 diffuse;
|
||||
uniform vec3 emissive;
|
||||
uniform float roughness;
|
||||
uniform float metalness;
|
||||
uniform float opacity;
|
||||
|
||||
#ifndef STANDARD
|
||||
uniform float clearCoat;
|
||||
uniform float clearCoatRoughness;
|
||||
#endif
|
||||
|
||||
varying vec3 vViewPosition;
|
||||
|
||||
#ifndef FLAT_SHADED
|
||||
|
||||
varying vec3 vNormal;
|
||||
|
||||
#endif
|
||||
|
||||
#include <common>
|
||||
#include <packing>
|
||||
#include <dithering_pars_fragment>
|
||||
#include <color_pars_fragment>
|
||||
#include <uv_pars_fragment>
|
||||
#include <uv2_pars_fragment>
|
||||
#include <map_pars_fragment>
|
||||
#include <alphamap_pars_fragment>
|
||||
#include <aomap_pars_fragment>
|
||||
#include <lightmap_pars_fragment>
|
||||
#include <emissivemap_pars_fragment>
|
||||
#include <bsdfs>
|
||||
#include <cube_uv_reflection_fragment>
|
||||
#include <envmap_pars_fragment>
|
||||
#include <envmap_physical_pars_fragment>
|
||||
#include <fog_pars_fragment>
|
||||
#include <lights_pars_begin>
|
||||
#include <lights_physical_pars_fragment>
|
||||
#include <shadowmap_pars_fragment>
|
||||
#include <bumpmap_pars_fragment>
|
||||
#include <normalmap_pars_fragment>
|
||||
#include <roughnessmap_pars_fragment>
|
||||
#include <metalnessmap_pars_fragment>
|
||||
#include <logdepthbuf_pars_fragment>
|
||||
#include <clipping_planes_pars_fragment>
|
||||
|
||||
void main() {
|
||||
|
||||
#include <clipping_planes_fragment>
|
||||
|
||||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||||
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
||||
vec3 totalEmissiveRadiance = emissive;
|
||||
|
||||
#include <logdepthbuf_fragment>
|
||||
#include <map_fragment>
|
||||
#include <color_fragment>
|
||||
#include <alphamap_fragment>
|
||||
#include <alphatest_fragment>
|
||||
#include <roughnessmap_fragment>
|
||||
#include <metalnessmap_fragment>
|
||||
#include <normal_fragment_begin>
|
||||
#include <normal_fragment_maps>
|
||||
#include <emissivemap_fragment>
|
||||
|
||||
// accumulation
|
||||
#include <lights_physical_fragment>
|
||||
#include <lights_fragment_begin>
|
||||
#include <lights_fragment_maps>
|
||||
#include <lights_fragment_end>
|
||||
|
||||
// modulation
|
||||
#include <aomap_fragment>
|
||||
|
||||
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
|
||||
|
||||
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
|
||||
|
||||
#include <tonemapping_fragment>
|
||||
#include <encodings_fragment>
|
||||
#include <fog_fragment>
|
||||
#include <premultiplied_alpha_fragment>
|
||||
#include <dithering_fragment>
|
||||
|
||||
}
|
55
lib/renderers/shaders/ShaderLib/meshphysical_vert.glsl
Normal file
55
lib/renderers/shaders/ShaderLib/meshphysical_vert.glsl
Normal file
@ -0,0 +1,55 @@
|
||||
#define PHYSICAL
|
||||
|
||||
varying vec3 vViewPosition;
|
||||
|
||||
#ifndef FLAT_SHADED
|
||||
|
||||
varying vec3 vNormal;
|
||||
|
||||
#endif
|
||||
|
||||
#include <common>
|
||||
#include <uv_pars_vertex>
|
||||
#include <uv2_pars_vertex>
|
||||
#include <displacementmap_pars_vertex>
|
||||
#include <color_pars_vertex>
|
||||
#include <fog_pars_vertex>
|
||||
#include <morphtarget_pars_vertex>
|
||||
#include <skinning_pars_vertex>
|
||||
#include <shadowmap_pars_vertex>
|
||||
#include <logdepthbuf_pars_vertex>
|
||||
#include <clipping_planes_pars_vertex>
|
||||
|
||||
void main() {
|
||||
|
||||
#include <uv_vertex>
|
||||
#include <uv2_vertex>
|
||||
#include <color_vertex>
|
||||
|
||||
#include <beginnormal_vertex>
|
||||
#include <morphnormal_vertex>
|
||||
#include <skinbase_vertex>
|
||||
#include <skinnormal_vertex>
|
||||
#include <defaultnormal_vertex>
|
||||
|
||||
#ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED
|
||||
|
||||
vNormal = normalize( transformedNormal );
|
||||
|
||||
#endif
|
||||
|
||||
#include <begin_vertex>
|
||||
#include <morphtarget_vertex>
|
||||
#include <skinning_vertex>
|
||||
#include <displacementmap_vertex>
|
||||
#include <project_vertex>
|
||||
#include <logdepthbuf_vertex>
|
||||
#include <clipping_planes_vertex>
|
||||
|
||||
vViewPosition = - mvPosition.xyz;
|
||||
|
||||
#include <worldpos_vertex>
|
||||
#include <shadowmap_vertex>
|
||||
#include <fog_vertex>
|
||||
|
||||
}
|
31
lib/renderers/shaders/ShaderLib/normal_frag.glsl
Normal file
31
lib/renderers/shaders/ShaderLib/normal_frag.glsl
Normal file
@ -0,0 +1,31 @@
|
||||
#define NORMAL
|
||||
|
||||
uniform float opacity;
|
||||
|
||||
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )
|
||||
|
||||
varying vec3 vViewPosition;
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef FLAT_SHADED
|
||||
|
||||
varying vec3 vNormal;
|
||||
|
||||
#endif
|
||||
|
||||
#include <packing>
|
||||
#include <uv_pars_fragment>
|
||||
#include <bumpmap_pars_fragment>
|
||||
#include <normalmap_pars_fragment>
|
||||
#include <logdepthbuf_pars_fragment>
|
||||
|
||||
void main() {
|
||||
|
||||
#include <logdepthbuf_fragment>
|
||||
#include <normal_fragment_begin>
|
||||
#include <normal_fragment_maps>
|
||||
|
||||
gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
|
||||
|
||||
}
|
50
lib/renderers/shaders/ShaderLib/normal_vert.glsl
Normal file
50
lib/renderers/shaders/ShaderLib/normal_vert.glsl
Normal file
@ -0,0 +1,50 @@
|
||||
#define NORMAL
|
||||
|
||||
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )
|
||||
|
||||
varying vec3 vViewPosition;
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef FLAT_SHADED
|
||||
|
||||
varying vec3 vNormal;
|
||||
|
||||
#endif
|
||||
|
||||
#include <uv_pars_vertex>
|
||||
#include <displacementmap_pars_vertex>
|
||||
#include <morphtarget_pars_vertex>
|
||||
#include <skinning_pars_vertex>
|
||||
#include <logdepthbuf_pars_vertex>
|
||||
|
||||
void main() {
|
||||
|
||||
#include <uv_vertex>
|
||||
|
||||
#include <beginnormal_vertex>
|
||||
#include <morphnormal_vertex>
|
||||
#include <skinbase_vertex>
|
||||
#include <skinnormal_vertex>
|
||||
#include <defaultnormal_vertex>
|
||||
|
||||
#ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED
|
||||
|
||||
vNormal = normalize( transformedNormal );
|
||||
|
||||
#endif
|
||||
|
||||
#include <begin_vertex>
|
||||
#include <morphtarget_vertex>
|
||||
#include <skinning_vertex>
|
||||
#include <displacementmap_vertex>
|
||||
#include <project_vertex>
|
||||
#include <logdepthbuf_vertex>
|
||||
|
||||
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )
|
||||
|
||||
vViewPosition = - mvPosition.xyz;
|
||||
|
||||
#endif
|
||||
|
||||
}
|
32
lib/renderers/shaders/ShaderLib/points_frag.glsl
Normal file
32
lib/renderers/shaders/ShaderLib/points_frag.glsl
Normal file
@ -0,0 +1,32 @@
|
||||
uniform vec3 diffuse;
|
||||
uniform float opacity;
|
||||
|
||||
#include <common>
|
||||
#include <color_pars_fragment>
|
||||
#include <map_particle_pars_fragment>
|
||||
#include <fog_pars_fragment>
|
||||
#include <logdepthbuf_pars_fragment>
|
||||
#include <clipping_planes_pars_fragment>
|
||||
|
||||
void main() {
|
||||
|
||||
#include <clipping_planes_fragment>
|
||||
|
||||
vec3 outgoingLight = vec3( 0.0 );
|
||||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||||
|
||||
#include <logdepthbuf_fragment>
|
||||
#include <map_particle_fragment>
|
||||
#include <color_fragment>
|
||||
#include <alphatest_fragment>
|
||||
|
||||
outgoingLight = diffuseColor.rgb;
|
||||
|
||||
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
|
||||
|
||||
#include <premultiplied_alpha_fragment>
|
||||
#include <tonemapping_fragment>
|
||||
#include <encodings_fragment>
|
||||
#include <fog_fragment>
|
||||
|
||||
}
|
33
lib/renderers/shaders/ShaderLib/points_vert.glsl
Normal file
33
lib/renderers/shaders/ShaderLib/points_vert.glsl
Normal file
@ -0,0 +1,33 @@
|
||||
uniform float size;
|
||||
uniform float scale;
|
||||
|
||||
#include <common>
|
||||
#include <color_pars_vertex>
|
||||
#include <fog_pars_vertex>
|
||||
#include <morphtarget_pars_vertex>
|
||||
#include <logdepthbuf_pars_vertex>
|
||||
#include <clipping_planes_pars_vertex>
|
||||
|
||||
void main() {
|
||||
|
||||
#include <color_vertex>
|
||||
#include <begin_vertex>
|
||||
#include <morphtarget_vertex>
|
||||
#include <project_vertex>
|
||||
|
||||
gl_PointSize = size;
|
||||
|
||||
#ifdef USE_SIZEATTENUATION
|
||||
|
||||
bool isPerspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 );
|
||||
|
||||
if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
|
||||
|
||||
#endif
|
||||
|
||||
#include <logdepthbuf_vertex>
|
||||
#include <clipping_planes_vertex>
|
||||
#include <worldpos_vertex>
|
||||
#include <fog_vertex>
|
||||
|
||||
}
|
18
lib/renderers/shaders/ShaderLib/shadow_frag.glsl
Normal file
18
lib/renderers/shaders/ShaderLib/shadow_frag.glsl
Normal file
@ -0,0 +1,18 @@
|
||||
uniform vec3 color;
|
||||
uniform float opacity;
|
||||
|
||||
#include <common>
|
||||
#include <packing>
|
||||
#include <fog_pars_fragment>
|
||||
#include <bsdfs>
|
||||
#include <lights_pars_begin>
|
||||
#include <shadowmap_pars_fragment>
|
||||
#include <shadowmask_pars_fragment>
|
||||
|
||||
void main() {
|
||||
|
||||
gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
|
||||
|
||||
#include <fog_fragment>
|
||||
|
||||
}
|
12
lib/renderers/shaders/ShaderLib/shadow_vert.glsl
Normal file
12
lib/renderers/shaders/ShaderLib/shadow_vert.glsl
Normal file
@ -0,0 +1,12 @@
|
||||
#include <fog_pars_vertex>
|
||||
#include <shadowmap_pars_vertex>
|
||||
|
||||
void main() {
|
||||
|
||||
#include <begin_vertex>
|
||||
#include <project_vertex>
|
||||
#include <worldpos_vertex>
|
||||
#include <shadowmap_vertex>
|
||||
#include <fog_vertex>
|
||||
|
||||
}
|
30
lib/renderers/shaders/ShaderLib/sprite_frag.glsl
Normal file
30
lib/renderers/shaders/ShaderLib/sprite_frag.glsl
Normal file
@ -0,0 +1,30 @@
|
||||
uniform vec3 diffuse;
|
||||
uniform float opacity;
|
||||
|
||||
#include <common>
|
||||
#include <uv_pars_fragment>
|
||||
#include <map_pars_fragment>
|
||||
#include <fog_pars_fragment>
|
||||
#include <logdepthbuf_pars_fragment>
|
||||
#include <clipping_planes_pars_fragment>
|
||||
|
||||
void main() {
|
||||
|
||||
#include <clipping_planes_fragment>
|
||||
|
||||
vec3 outgoingLight = vec3( 0.0 );
|
||||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||||
|
||||
#include <logdepthbuf_fragment>
|
||||
#include <map_fragment>
|
||||
#include <alphatest_fragment>
|
||||
|
||||
outgoingLight = diffuseColor.rgb;
|
||||
|
||||
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
|
||||
|
||||
#include <tonemapping_fragment>
|
||||
#include <encodings_fragment>
|
||||
#include <fog_fragment>
|
||||
|
||||
}
|
42
lib/renderers/shaders/ShaderLib/sprite_vert.glsl
Normal file
42
lib/renderers/shaders/ShaderLib/sprite_vert.glsl
Normal file
@ -0,0 +1,42 @@
|
||||
uniform float rotation;
|
||||
uniform vec2 center;
|
||||
|
||||
#include <common>
|
||||
#include <uv_pars_vertex>
|
||||
#include <fog_pars_vertex>
|
||||
#include <logdepthbuf_pars_vertex>
|
||||
#include <clipping_planes_pars_vertex>
|
||||
|
||||
void main() {
|
||||
|
||||
#include <uv_vertex>
|
||||
|
||||
vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
|
||||
|
||||
vec2 scale;
|
||||
scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
|
||||
scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
|
||||
|
||||
#ifndef USE_SIZEATTENUATION
|
||||
|
||||
bool isPerspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 );
|
||||
|
||||
if ( isPerspective ) scale *= - mvPosition.z;
|
||||
|
||||
#endif
|
||||
|
||||
vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
|
||||
|
||||
vec2 rotatedPosition;
|
||||
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
|
||||
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
|
||||
|
||||
mvPosition.xy += rotatedPosition;
|
||||
|
||||
gl_Position = projectionMatrix * mvPosition;
|
||||
|
||||
#include <logdepthbuf_vertex>
|
||||
#include <clipping_planes_vertex>
|
||||
#include <fog_vertex>
|
||||
|
||||
}
|
Reference in New Issue
Block a user