Skip to content

Commit

Permalink
Merge pull request #1348 from pixiv/bump-three-r160
Browse files Browse the repository at this point in the history
deps: Bump three to r160
  • Loading branch information
0b5vr authored Jan 17, 2024
2 parents 7652ef5 + 3deb0b8 commit 60368ba
Show file tree
Hide file tree
Showing 50 changed files with 154 additions and 161 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ Code like this:
<script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@0.154.0/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.154.0/examples/jsm/",
"three": "https://unpkg.com/three@0.160.0/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.160.0/examples/jsm/",
"@pixiv/three-vrm": "three-vrm.module.js"
}
}
Expand Down
6 changes: 3 additions & 3 deletions packages/three-vrm-core/examples/expressions.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
<script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@0.154.0/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.154.0/examples/jsm/",
"three": "https://unpkg.com/three@0.160.0/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.160.0/examples/jsm/",
"@pixiv/three-vrm-core": "../lib/three-vrm-core.module.js"
}
}
Expand Down Expand Up @@ -59,7 +59,7 @@
const scene = new THREE.Scene();

// light
const light = new THREE.DirectionalLight( 0xffffff );
const light = new THREE.DirectionalLight( 0xffffff, Math.PI );
light.position.set( 1.0, 1.0, 1.0 ).normalize();
scene.add( light );

Expand Down
6 changes: 3 additions & 3 deletions packages/three-vrm-core/examples/firstPerson.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
<script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@0.154.0/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.154.0/examples/jsm/",
"three": "https://unpkg.com/three@0.160.0/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.160.0/examples/jsm/",
"@pixiv/three-vrm-core": "../lib/three-vrm-core.module.js"
}
}
Expand Down Expand Up @@ -65,7 +65,7 @@
const scene = new THREE.Scene();

// light
const light = new THREE.DirectionalLight( 0xffffff );
const light = new THREE.DirectionalLight( 0xffffff, Math.PI );
light.position.set( 1.0, 1.0, 1.0 ).normalize();
scene.add( light );

Expand Down
6 changes: 3 additions & 3 deletions packages/three-vrm-core/examples/humanoid.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
<script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@0.154.0/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.154.0/examples/jsm/",
"three": "https://unpkg.com/three@0.160.0/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.160.0/examples/jsm/",
"@pixiv/three-vrm-core": "../lib/three-vrm-core.module.js"
}
}
Expand Down Expand Up @@ -59,7 +59,7 @@
const scene = new THREE.Scene();

// light
const light = new THREE.DirectionalLight( 0xffffff );
const light = new THREE.DirectionalLight( 0xffffff, Math.PI );
light.position.set( 1.0, 1.0, 1.0 ).normalize();
scene.add( light );

Expand Down
4 changes: 2 additions & 2 deletions packages/three-vrm-core/examples/humanoidAnimation/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
{
"imports": {
"fflate": "https://unpkg.com/[email protected]/esm/browser.js",
"three": "https://unpkg.com/three@0.154.0/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.154.0/examples/jsm/",
"three": "https://unpkg.com/three@0.160.0/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.160.0/examples/jsm/",
"@pixiv/three-vrm-core": "../../lib/three-vrm-core.module.js"
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/three-vrm-core/examples/humanoidAnimation/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ controls.update();
const scene = new THREE.Scene();

// light
const light = new THREE.DirectionalLight( 0xffffff );
const light = new THREE.DirectionalLight( 0xffffff, Math.PI );
light.position.set( 1.0, 1.0, 1.0 ).normalize();
scene.add( light );

Expand Down
6 changes: 3 additions & 3 deletions packages/three-vrm-core/examples/lookAt.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
<script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@0.154.0/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.154.0/examples/jsm/",
"three": "https://unpkg.com/three@0.160.0/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.160.0/examples/jsm/",
"@pixiv/three-vrm-core": "../lib/three-vrm-core.module.js"
}
}
Expand Down Expand Up @@ -65,7 +65,7 @@
const scene = new THREE.Scene();

// light
const light = new THREE.DirectionalLight( 0xffffff );
const light = new THREE.DirectionalLight( 0xffffff, Math.PI );
light.position.set( 1.0, 1.0, 1.0 ).normalize();
scene.add( light );

Expand Down
6 changes: 3 additions & 3 deletions packages/three-vrm-core/examples/meta.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
<script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@0.154.0/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.154.0/examples/jsm/",
"three": "https://unpkg.com/three@0.160.0/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.160.0/examples/jsm/",
"@pixiv/three-vrm-core": "../lib/three-vrm-core.module.js"
}
}
Expand Down Expand Up @@ -72,7 +72,7 @@
const scene = new THREE.Scene();

// light
const light = new THREE.DirectionalLight( 0xffffff );
const light = new THREE.DirectionalLight( 0xffffff, Math.PI );
light.position.set( 1.0, 1.0, 1.0 ).normalize();
scene.add( light );

Expand Down
8 changes: 4 additions & 4 deletions packages/three-vrm-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@
"@pixiv/types-vrmc-vrm-1.0": "2.0.7"
},
"devDependencies": {
"@types/three": "^0.154.0",
"three": "^0.154.0"
"@types/three": "^0.160.0",
"three": "^0.160.0"
},
"peerDependencies": {
"@types/three": "^0.154.0",
"three": "^0.154.0"
"@types/three": "^0.160.0",
"three": "^0.160.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
<script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@0.154.0/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.154.0/examples/jsm/",
"three": "https://unpkg.com/three@0.160.0/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.160.0/examples/jsm/",
"@pixiv/three-vrm-materials-hdr-emissive-multiplier": "../lib/three-vrm-materials-hdr-emissive-multiplier.module.js"
}
}
Expand Down Expand Up @@ -59,7 +59,7 @@
const scene = new THREE.Scene();

// light
const light = new THREE.DirectionalLight( 0xffffff );
const light = new THREE.DirectionalLight( 0xffffff, Math.PI );
scene.add( light );

// gltf and vrm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@
"@pixiv/types-vrmc-materials-hdr-emissive-multiplier-1.0": "2.0.7"
},
"devDependencies": {
"@types/three": "^0.154.0",
"three": "^0.154.0"
"@types/three": "^0.160.0",
"three": "^0.160.0"
},
"peerDependencies": {
"@types/three": "^0.154.0",
"three": "^0.154.0"
"@types/three": "^0.160.0",
"three": "^0.160.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
<script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@0.154.0/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.154.0/examples/jsm/",
"three": "https://unpkg.com/three@0.160.0/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.160.0/examples/jsm/",
"@pixiv/three-vrm-materials-mtoon": "../lib/three-vrm-materials-mtoon.module.js"
}
}
Expand Down Expand Up @@ -62,7 +62,7 @@
const scene = new THREE.Scene();

// light
const light = new THREE.DirectionalLight( 0xffffff );
const light = new THREE.DirectionalLight( 0xffffff, Math.PI );
scene.add( light );

// gltf and vrm
Expand Down
6 changes: 3 additions & 3 deletions packages/three-vrm-materials-mtoon/examples/feature-test.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
<script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@0.154.0/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.154.0/examples/jsm/",
"three": "https://unpkg.com/three@0.160.0/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.160.0/examples/jsm/",
"@pixiv/three-vrm-materials-mtoon": "../lib/three-vrm-materials-mtoon.module.js"
}
}
Expand Down Expand Up @@ -58,7 +58,7 @@
const scene = new THREE.Scene();

// light
const light = new THREE.DirectionalLight( 0xffffff );
const light = new THREE.DirectionalLight( 0xffffff, Math.PI );
scene.add( light );

// test objects
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
<script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@0.154.0/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.154.0/examples/jsm/",
"three": "https://unpkg.com/three@0.160.0/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.160.0/examples/jsm/",
"@pixiv/three-vrm-materials-mtoon": "../lib/three-vrm-materials-mtoon.module.js"
}
}
Expand Down Expand Up @@ -59,7 +59,7 @@
const scene = new THREE.Scene();

// light
const light = new THREE.DirectionalLight( 0xffffff );
const light = new THREE.DirectionalLight( 0xffffff, Math.PI );
scene.add( light );

// gltf and vrm
Expand Down
8 changes: 4 additions & 4 deletions packages/three-vrm-materials-mtoon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@
"@pixiv/types-vrmc-materials-mtoon-1.0": "2.0.7"
},
"devDependencies": {
"@types/three": "^0.154.0",
"three": "^0.154.0"
"@types/three": "^0.160.0",
"three": "^0.160.0"
},
"peerDependencies": {
"@types/three": "^0.154.0",
"three": "^0.154.0"
"@types/three": "^0.160.0",
"three": "^0.160.0"
}
}
4 changes: 2 additions & 2 deletions packages/three-vrm-materials-mtoon/src/MToonMaterial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,8 @@ export class MToonMaterial extends THREE.ShaderMaterial {
uvAnimationScrollYOffset: { value: 0.0 },
uvAnimationRotationPhase: { value: 0.0 },
},
parameters.uniforms,
]);
parameters.uniforms ?? {},
]) as any;

// == finally compile the shader program =======================================================
this.setValues(parameters);
Expand Down
19 changes: 12 additions & 7 deletions packages/three-vrm-materials-mtoon/src/shaders/mtoon.frag
Original file line number Diff line number Diff line change
Expand Up @@ -170,17 +170,12 @@ vec3 getDiffuse(
return col;
}

// COMPAT: pre-r156 uses a struct GeometricContext
#if THREE_VRM_THREE_REVISION >= 157
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 ) {
float dotNL = clamp( dot( geometryNormal, directLight.direction ), -1.0, 1.0 );
vec3 irradiance = directLight.color;

#if THREE_VRM_THREE_REVISION < 132
#ifndef PHYSICALLY_CORRECT_LIGHTS
irradiance *= PI;
#endif
#endif

// directSpecular will be used for rim lighting, not an actual specular
reflectedLight.directSpecular += irradiance;

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

// COMPAT: pre-r156 uses a struct GeometricContext
#if THREE_VRM_THREE_REVISION >= 157
vec3 geometryPosition = - vViewPosition;
vec3 geometryNormal = normal;
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );

vec3 geometryClearcoatNormal;

#ifdef USE_CLEARCOAT
Expand Down Expand Up @@ -654,6 +650,7 @@ void main() {

pointLight = pointLights[ i ];

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

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

spotLight = spotLights[ i ];

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

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

directionalLight = directionalLights[ i ];

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

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

vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );

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

// COMPAT: pre-r156 uses a struct GeometricContext
#if THREE_VRM_THREE_REVISION >= 157
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
#elif THREE_VRM_THREE_REVISION >= 133
Expand Down
8 changes: 4 additions & 4 deletions packages/three-vrm-materials-v0compat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@
"@pixiv/types-vrmc-materials-mtoon-1.0": "2.0.7"
},
"devDependencies": {
"@types/three": "^0.154.0",
"three": "^0.154.0"
"@types/three": "^0.160.0",
"three": "^0.160.0"
},
"peerDependencies": {
"@types/three": "^0.154.0",
"three": "^0.154.0"
"@types/three": "^0.160.0",
"three": "^0.160.0"
}
}
Loading

0 comments on commit 60368ba

Please sign in to comment.