Skip to content

Commit 60368ba

Browse files
authored
Merge pull request #1348 from pixiv/bump-three-r160
deps: Bump three to r160
2 parents 7652ef5 + 3deb0b8 commit 60368ba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+154
-161
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ Code like this:
4646
<script type="importmap">
4747
{
4848
"imports": {
49-
"three": "https://unpkg.com/three@0.154.0/build/three.module.js",
50-
"three/addons/": "https://unpkg.com/three@0.154.0/examples/jsm/",
49+
"three": "https://unpkg.com/three@0.160.0/build/three.module.js",
50+
"three/addons/": "https://unpkg.com/three@0.160.0/examples/jsm/",
5151
"@pixiv/three-vrm": "three-vrm.module.js"
5252
}
5353
}

packages/three-vrm-core/examples/expressions.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
<script type="importmap">
2727
{
2828
"imports": {
29-
"three": "https://unpkg.com/three@0.154.0/build/three.module.js",
30-
"three/addons/": "https://unpkg.com/three@0.154.0/examples/jsm/",
29+
"three": "https://unpkg.com/three@0.160.0/build/three.module.js",
30+
"three/addons/": "https://unpkg.com/three@0.160.0/examples/jsm/",
3131
"@pixiv/three-vrm-core": "../lib/three-vrm-core.module.js"
3232
}
3333
}
@@ -59,7 +59,7 @@
5959
const scene = new THREE.Scene();
6060

6161
// light
62-
const light = new THREE.DirectionalLight( 0xffffff );
62+
const light = new THREE.DirectionalLight( 0xffffff, Math.PI );
6363
light.position.set( 1.0, 1.0, 1.0 ).normalize();
6464
scene.add( light );
6565

packages/three-vrm-core/examples/firstPerson.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
<script type="importmap">
3333
{
3434
"imports": {
35-
"three": "https://unpkg.com/three@0.154.0/build/three.module.js",
36-
"three/addons/": "https://unpkg.com/three@0.154.0/examples/jsm/",
35+
"three": "https://unpkg.com/three@0.160.0/build/three.module.js",
36+
"three/addons/": "https://unpkg.com/three@0.160.0/examples/jsm/",
3737
"@pixiv/three-vrm-core": "../lib/three-vrm-core.module.js"
3838
}
3939
}
@@ -65,7 +65,7 @@
6565
const scene = new THREE.Scene();
6666

6767
// light
68-
const light = new THREE.DirectionalLight( 0xffffff );
68+
const light = new THREE.DirectionalLight( 0xffffff, Math.PI );
6969
light.position.set( 1.0, 1.0, 1.0 ).normalize();
7070
scene.add( light );
7171

packages/three-vrm-core/examples/humanoid.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
<script type="importmap">
2727
{
2828
"imports": {
29-
"three": "https://unpkg.com/three@0.154.0/build/three.module.js",
30-
"three/addons/": "https://unpkg.com/three@0.154.0/examples/jsm/",
29+
"three": "https://unpkg.com/three@0.160.0/build/three.module.js",
30+
"three/addons/": "https://unpkg.com/three@0.160.0/examples/jsm/",
3131
"@pixiv/three-vrm-core": "../lib/three-vrm-core.module.js"
3232
}
3333
}
@@ -59,7 +59,7 @@
5959
const scene = new THREE.Scene();
6060

6161
// light
62-
const light = new THREE.DirectionalLight( 0xffffff );
62+
const light = new THREE.DirectionalLight( 0xffffff, Math.PI );
6363
light.position.set( 1.0, 1.0, 1.0 ).normalize();
6464
scene.add( light );
6565

packages/three-vrm-core/examples/humanoidAnimation/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
{
3939
"imports": {
4040
"fflate": "https://unpkg.com/[email protected]/esm/browser.js",
41-
"three": "https://unpkg.com/three@0.154.0/build/three.module.js",
42-
"three/addons/": "https://unpkg.com/three@0.154.0/examples/jsm/",
41+
"three": "https://unpkg.com/three@0.160.0/build/three.module.js",
42+
"three/addons/": "https://unpkg.com/three@0.160.0/examples/jsm/",
4343
"@pixiv/three-vrm-core": "../../lib/three-vrm-core.module.js"
4444
}
4545
}

packages/three-vrm-core/examples/humanoidAnimation/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ controls.update();
2525
const scene = new THREE.Scene();
2626

2727
// light
28-
const light = new THREE.DirectionalLight( 0xffffff );
28+
const light = new THREE.DirectionalLight( 0xffffff, Math.PI );
2929
light.position.set( 1.0, 1.0, 1.0 ).normalize();
3030
scene.add( light );
3131

packages/three-vrm-core/examples/lookAt.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
<script type="importmap">
3333
{
3434
"imports": {
35-
"three": "https://unpkg.com/three@0.154.0/build/three.module.js",
36-
"three/addons/": "https://unpkg.com/three@0.154.0/examples/jsm/",
35+
"three": "https://unpkg.com/three@0.160.0/build/three.module.js",
36+
"three/addons/": "https://unpkg.com/three@0.160.0/examples/jsm/",
3737
"@pixiv/three-vrm-core": "../lib/three-vrm-core.module.js"
3838
}
3939
}
@@ -65,7 +65,7 @@
6565
const scene = new THREE.Scene();
6666

6767
// light
68-
const light = new THREE.DirectionalLight( 0xffffff );
68+
const light = new THREE.DirectionalLight( 0xffffff, Math.PI );
6969
light.position.set( 1.0, 1.0, 1.0 ).normalize();
7070
scene.add( light );
7171

packages/three-vrm-core/examples/meta.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
<script type="importmap">
4040
{
4141
"imports": {
42-
"three": "https://unpkg.com/three@0.154.0/build/three.module.js",
43-
"three/addons/": "https://unpkg.com/three@0.154.0/examples/jsm/",
42+
"three": "https://unpkg.com/three@0.160.0/build/three.module.js",
43+
"three/addons/": "https://unpkg.com/three@0.160.0/examples/jsm/",
4444
"@pixiv/three-vrm-core": "../lib/three-vrm-core.module.js"
4545
}
4646
}
@@ -72,7 +72,7 @@
7272
const scene = new THREE.Scene();
7373

7474
// light
75-
const light = new THREE.DirectionalLight( 0xffffff );
75+
const light = new THREE.DirectionalLight( 0xffffff, Math.PI );
7676
light.position.set( 1.0, 1.0, 1.0 ).normalize();
7777
scene.add( light );
7878

packages/three-vrm-core/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@
5454
"@pixiv/types-vrmc-vrm-1.0": "2.0.7"
5555
},
5656
"devDependencies": {
57-
"@types/three": "^0.154.0",
58-
"three": "^0.154.0"
57+
"@types/three": "^0.160.0",
58+
"three": "^0.160.0"
5959
},
6060
"peerDependencies": {
61-
"@types/three": "^0.154.0",
62-
"three": "^0.154.0"
61+
"@types/three": "^0.160.0",
62+
"three": "^0.160.0"
6363
}
6464
}

packages/three-vrm-materials-hdr-emissive-multiplier/examples/loader-plugin.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
<script type="importmap">
2727
{
2828
"imports": {
29-
"three": "https://unpkg.com/three@0.154.0/build/three.module.js",
30-
"three/addons/": "https://unpkg.com/three@0.154.0/examples/jsm/",
29+
"three": "https://unpkg.com/three@0.160.0/build/three.module.js",
30+
"three/addons/": "https://unpkg.com/three@0.160.0/examples/jsm/",
3131
"@pixiv/three-vrm-materials-hdr-emissive-multiplier": "../lib/three-vrm-materials-hdr-emissive-multiplier.module.js"
3232
}
3333
}
@@ -59,7 +59,7 @@
5959
const scene = new THREE.Scene();
6060

6161
// light
62-
const light = new THREE.DirectionalLight( 0xffffff );
62+
const light = new THREE.DirectionalLight( 0xffffff, Math.PI );
6363
scene.add( light );
6464

6565
// gltf and vrm

packages/three-vrm-materials-hdr-emissive-multiplier/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@
5252
"@pixiv/types-vrmc-materials-hdr-emissive-multiplier-1.0": "2.0.7"
5353
},
5454
"devDependencies": {
55-
"@types/three": "^0.154.0",
56-
"three": "^0.154.0"
55+
"@types/three": "^0.160.0",
56+
"three": "^0.160.0"
5757
},
5858
"peerDependencies": {
59-
"@types/three": "^0.154.0",
60-
"three": "^0.154.0"
59+
"@types/three": "^0.160.0",
60+
"three": "^0.160.0"
6161
}
6262
}

packages/three-vrm-materials-mtoon/examples/emissive-strength.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
<script type="importmap">
2525
{
2626
"imports": {
27-
"three": "https://unpkg.com/three@0.154.0/build/three.module.js",
28-
"three/addons/": "https://unpkg.com/three@0.154.0/examples/jsm/",
27+
"three": "https://unpkg.com/three@0.160.0/build/three.module.js",
28+
"three/addons/": "https://unpkg.com/three@0.160.0/examples/jsm/",
2929
"@pixiv/three-vrm-materials-mtoon": "../lib/three-vrm-materials-mtoon.module.js"
3030
}
3131
}
@@ -62,7 +62,7 @@
6262
const scene = new THREE.Scene();
6363

6464
// light
65-
const light = new THREE.DirectionalLight( 0xffffff );
65+
const light = new THREE.DirectionalLight( 0xffffff, Math.PI );
6666
scene.add( light );
6767

6868
// gltf and vrm

packages/three-vrm-materials-mtoon/examples/feature-test.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
<script type="importmap">
2727
{
2828
"imports": {
29-
"three": "https://unpkg.com/three@0.154.0/build/three.module.js",
30-
"three/addons/": "https://unpkg.com/three@0.154.0/examples/jsm/",
29+
"three": "https://unpkg.com/three@0.160.0/build/three.module.js",
30+
"three/addons/": "https://unpkg.com/three@0.160.0/examples/jsm/",
3131
"@pixiv/three-vrm-materials-mtoon": "../lib/three-vrm-materials-mtoon.module.js"
3232
}
3333
}
@@ -58,7 +58,7 @@
5858
const scene = new THREE.Scene();
5959

6060
// light
61-
const light = new THREE.DirectionalLight( 0xffffff );
61+
const light = new THREE.DirectionalLight( 0xffffff, Math.PI );
6262
scene.add( light );
6363

6464
// test objects

packages/three-vrm-materials-mtoon/examples/loader-plugin.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
<script type="importmap">
2727
{
2828
"imports": {
29-
"three": "https://unpkg.com/three@0.154.0/build/three.module.js",
30-
"three/addons/": "https://unpkg.com/three@0.154.0/examples/jsm/",
29+
"three": "https://unpkg.com/three@0.160.0/build/three.module.js",
30+
"three/addons/": "https://unpkg.com/three@0.160.0/examples/jsm/",
3131
"@pixiv/three-vrm-materials-mtoon": "../lib/three-vrm-materials-mtoon.module.js"
3232
}
3333
}
@@ -59,7 +59,7 @@
5959
const scene = new THREE.Scene();
6060

6161
// light
62-
const light = new THREE.DirectionalLight( 0xffffff );
62+
const light = new THREE.DirectionalLight( 0xffffff, Math.PI );
6363
scene.add( light );
6464

6565
// gltf and vrm

packages/three-vrm-materials-mtoon/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@
5353
"@pixiv/types-vrmc-materials-mtoon-1.0": "2.0.7"
5454
},
5555
"devDependencies": {
56-
"@types/three": "^0.154.0",
57-
"three": "^0.154.0"
56+
"@types/three": "^0.160.0",
57+
"three": "^0.160.0"
5858
},
5959
"peerDependencies": {
60-
"@types/three": "^0.154.0",
61-
"three": "^0.154.0"
60+
"@types/three": "^0.160.0",
61+
"three": "^0.160.0"
6262
}
6363
}

packages/three-vrm-materials-mtoon/src/MToonMaterial.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,8 @@ export class MToonMaterial extends THREE.ShaderMaterial {
445445
uvAnimationScrollYOffset: { value: 0.0 },
446446
uvAnimationRotationPhase: { value: 0.0 },
447447
},
448-
parameters.uniforms,
449-
]);
448+
parameters.uniforms ?? {},
449+
]) as any;
450450

451451
// == finally compile the shader program =======================================================
452452
this.setValues(parameters);

packages/three-vrm-materials-mtoon/src/shaders/mtoon.frag

+12-7
Original file line numberDiff line numberDiff line change
@@ -170,17 +170,12 @@ vec3 getDiffuse(
170170
return col;
171171
}
172172

173+
// COMPAT: pre-r156 uses a struct GeometricContext
173174
#if THREE_VRM_THREE_REVISION >= 157
174175
void RE_Direct_MToon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in MToonMaterial material, const in float shadow, inout ReflectedLight reflectedLight ) {
175176
float dotNL = clamp( dot( geometryNormal, directLight.direction ), -1.0, 1.0 );
176177
vec3 irradiance = directLight.color;
177178

178-
#if THREE_VRM_THREE_REVISION < 132
179-
#ifndef PHYSICALLY_CORRECT_LIGHTS
180-
irradiance *= PI;
181-
#endif
182-
#endif
183-
184179
// directSpecular will be used for rim lighting, not an actual specular
185180
reflectedLight.directSpecular += irradiance;
186181

@@ -611,11 +606,12 @@ void main() {
611606
// Since we want to take shadows into account of shading instead of irradiance,
612607
// we had to modify the codes that multiplies the results of shadowmap into color of direct lights.
613608

609+
// COMPAT: pre-r156 uses a struct GeometricContext
614610
#if THREE_VRM_THREE_REVISION >= 157
615611
vec3 geometryPosition = - vViewPosition;
616612
vec3 geometryNormal = normal;
617613
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
618-
614+
619615
vec3 geometryClearcoatNormal;
620616

621617
#ifdef USE_CLEARCOAT
@@ -654,6 +650,7 @@ void main() {
654650

655651
pointLight = pointLights[ i ];
656652

653+
// COMPAT: pre-r156 uses a struct GeometricContext
657654
#if THREE_VRM_THREE_REVISION >= 157
658655
getPointLightInfo( pointLight, geometryPosition, directLight );
659656
#elif THREE_VRM_THREE_REVISION >= 132
@@ -668,6 +665,7 @@ void main() {
668665
shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
669666
#endif
670667

668+
// COMPAT: pre-r156 uses a struct GeometricContext
671669
#if THREE_VRM_THREE_REVISION >= 157
672670
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, shadow, reflectedLight );
673671
#else
@@ -691,6 +689,7 @@ void main() {
691689

692690
spotLight = spotLights[ i ];
693691

692+
// COMPAT: pre-r156 uses a struct GeometricContext
694693
#if THREE_VRM_THREE_REVISION >= 157
695694
getSpotLightInfo( spotLight, geometryPosition, directLight );
696695
#elif THREE_VRM_THREE_REVISION >= 132
@@ -705,6 +704,7 @@ void main() {
705704
shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
706705
#endif
707706

707+
// COMPAT: pre-r156 uses a struct GeometricContext
708708
#if THREE_VRM_THREE_REVISION >= 157
709709
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, shadow, reflectedLight );
710710
#else
@@ -728,6 +728,7 @@ void main() {
728728

729729
directionalLight = directionalLights[ i ];
730730

731+
// COMPAT: pre-r156 uses a struct GeometricContext
731732
#if THREE_VRM_THREE_REVISION >= 157
732733
getDirectionalLightInfo( directionalLight, directLight );
733734
#elif THREE_VRM_THREE_REVISION >= 132
@@ -742,6 +743,7 @@ void main() {
742743
shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
743744
#endif
744745

746+
// COMPAT: pre-r156 uses a struct GeometricContext
745747
#if THREE_VRM_THREE_REVISION >= 157
746748
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, shadow, reflectedLight );
747749
#else
@@ -774,6 +776,8 @@ void main() {
774776

775777
vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
776778

779+
// COMPAT: pre-r156 uses a struct GeometricContext
780+
// COMPAT: pre-r156 doesn't have a define USE_LIGHT_PROBES
777781
#if THREE_VRM_THREE_REVISION >= 157
778782
#if defined( USE_LIGHT_PROBES )
779783
irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
@@ -789,6 +793,7 @@ void main() {
789793
#pragma unroll_loop_start
790794
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
791795

796+
// COMPAT: pre-r156 uses a struct GeometricContext
792797
#if THREE_VRM_THREE_REVISION >= 157
793798
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
794799
#elif THREE_VRM_THREE_REVISION >= 133

packages/three-vrm-materials-v0compat/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@
4949
"@pixiv/types-vrmc-materials-mtoon-1.0": "2.0.7"
5050
},
5151
"devDependencies": {
52-
"@types/three": "^0.154.0",
53-
"three": "^0.154.0"
52+
"@types/three": "^0.160.0",
53+
"three": "^0.160.0"
5454
},
5555
"peerDependencies": {
56-
"@types/three": "^0.154.0",
57-
"three": "^0.154.0"
56+
"@types/three": "^0.160.0",
57+
"three": "^0.160.0"
5858
}
5959
}

0 commit comments

Comments
 (0)