Skip to content

Commit

Permalink
updated three to r108 (google#744)
Browse files Browse the repository at this point in the history
* updated three to r108

* reverting model change

* Update fidelity test goldens
  • Loading branch information
elalish authored Sep 10, 2019
1 parent ed84f55 commit 21ed1e5
Show file tree
Hide file tree
Showing 35 changed files with 46 additions and 214 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
},
"dependencies": {
"lit-element": "^2.2.0",
"three": "^0.105.2"
"three": "^0.108.0"
},
"publishConfig": {
"access": "public"
Expand Down
4 changes: 0 additions & 4 deletions src/three-components/ModelUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
import {Bone, Camera, Material, Object3D, Scene, Shader, Skeleton, SkinnedMesh} from 'three';

import {cubeUVChunk} from './shader-chunk/cube_uv_reflection_fragment.glsl.js';
import {envmapChunk} from './shader-chunk/envmap_physical_pars_fragment.glsl.js';
import {lightsChunk} from './shader-chunk/lights_fragment_maps.glsl.js';
import {normalmapChunk} from './shader-chunk/normalmap_pars_fragment.glsl.js';

// NOTE(cdata): What follows is a TypeScript-ified version of:
Expand Down Expand Up @@ -49,8 +47,6 @@ const updateShader = (shader: Shader) => {
shader.fragmentShader =
shader.fragmentShader
.replace('#include <cube_uv_reflection_fragment>', cubeUVChunk)
.replace('#include <envmap_physical_pars_fragment>', envmapChunk)
.replace('#include <lights_fragment_maps>', lightsChunk)
.replace('#include <normalmap_pars_fragment>', normalmapChunk);
};

Expand Down

This file was deleted.

36 changes: 0 additions & 36 deletions src/three-components/shader-chunk/lights_fragment_maps.glsl.js

This file was deleted.

65 changes: 42 additions & 23 deletions src/three-components/shader-chunk/normalmap_pars_fragment.glsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,61 @@ export const normalmapChunk = /* glsl */ `
uniform sampler2D normalMap;
uniform vec2 normalScale;
#ifdef OBJECTSPACE_NORMALMAP
#endif
#ifdef OBJECTSPACE_NORMALMAP
uniform mat3 normalMatrix;
#endif
#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )
// 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, vec2 normalScale, in sampler2D normalMap ) {
// 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 );
uniform mat3 normalMatrix;
float scale = sign( st1.t * st0.s - st0.t * st1.s ); // we do not care about the magnitude
#else
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 );
// Per-Pixel Tangent Space Normal Mapping
// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html
// (elalish) Biased the normal mip to anti-alias the normal's screen-space derivatives
vec3 mapN = texture2D( normalMap, vUv, 2.0 ).xyz * 2.0 - 1.0;
vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {
mapN.xy *= normalScale;
// Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988
#ifdef DOUBLE_SIDED
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 );
// Workaround for Adreno GPUs gl_FrontFacing bug. See #15850 and #10331
// http://hacksoflife.blogspot.com/2009/11/per-pixel-tangent-space-normal-mapping.html?showComment=1522254677437#c5087545147696715943
vec3 NfromST = cross( S, T );
if( dot( NfromST, N ) > 0.0 ) {
float scale = sign( st1.t * st0.s - st0.t * st1.s ); // we do not care about the magnitude
S *= -1.0;
T *= -1.0;
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 );
}
// (elalish) Biased the normal mip to anti-alias the normal's screen-space derivatives
vec3 mapN = texture2D( normalMap, vUv, 2.0 ).xyz * 2.0 - 1.0;
#else
mapN.xy *= normalScale;
mapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );
return normalize( tsn * mapN );
#endif
}
mat3 tsn = mat3( S, T, N );
return normalize( tsn * mapN );
#endif
}
#endif
`;
`;
Binary file modified test/fidelity/goldens/AlphaBlendLitmusTest/filament-golden.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fidelity/goldens/Astronaut/filament-golden.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fidelity/goldens/FurnaceTest/filament-golden.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fidelity/goldens/khronos-2CylinderEngine/filament-golden.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fidelity/goldens/khronos-AntiqueCamera/filament-golden.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fidelity/goldens/khronos-Avocado/filament-golden.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fidelity/goldens/khronos-BoomBox/filament-golden.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fidelity/goldens/khronos-BoxVertexColors/filament-golden.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fidelity/goldens/khronos-Buggy/filament-golden.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fidelity/goldens/khronos-CesiumMilkTruck/filament-golden.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fidelity/goldens/khronos-Corset/filament-golden.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fidelity/goldens/khronos-Cube/filament-golden.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fidelity/goldens/khronos-DamagedHelmet/filament-golden.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fidelity/goldens/khronos-Duck/filament-golden.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fidelity/goldens/khronos-GearboxAssy/filament-golden.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fidelity/goldens/khronos-Lantern/filament-golden.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fidelity/goldens/khronos-MetalRoughSpheres/filament-golden.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fidelity/goldens/khronos-MultiUVTest/filament-golden.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fidelity/goldens/khronos-NormalTangentTest/filament-golden.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fidelity/goldens/khronos-OrientationTest/filament-golden.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fidelity/goldens/khronos-SciFiHelmet/filament-golden.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fidelity/goldens/khronos-Suzanne/filament-golden.png
Binary file modified test/fidelity/goldens/khronos-UnlitTest/filament-golden.png
Binary file modified test/fidelity/goldens/khronos-VertexColorTest/filament-golden.png

0 comments on commit 21ed1e5

Please sign in to comment.