Skip to content
This repository was archived by the owner on Aug 21, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 6 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: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
"fix-esm": "^1.0.1",
"minio": "7.1.3",
"patch-package": "^6.5.1",
"three": "0.153.0",
"three": "0.157.0",
"ts-node": "10.9.1",
"typescript": "5.0.2"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/client-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"@types/react": "18.0.28",
"@types/react-router-dom": "5.3.3",
"@types/styled-components": "5.1.26",
"@types/three": "0.153.0",
"@types/three": "0.157.0",
"css-modules-require-hook": "4.2.3",
"esbuild": "0.17.12",
"mocha": "10.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"@types/react-dom": "18.0.11",
"@types/react-router-dom": "5.3.3",
"@types/styled-components": "5.1.26",
"@types/three": "0.153.0",
"@types/three": "0.157.0",
"@types/uuid": "^9.0.1",
"mocha": "10.2.0",
"rimraf": "4.4.0",
Expand Down
14 changes: 7 additions & 7 deletions packages/engine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"@gltf-transform/functions": "3.4.2",
"@hookstate/subscribable": "^4.0.0",
"@mediapipe/pose": "0.5.1675469404",
"@pixiv/three-vrm": "^2.0.1",
"@pixiv/types-vrmc-vrm-1.0": "^2.0.0",
"@pixiv/three-vrm": "^2.0.6",
"@pixiv/types-vrmc-vrm-1.0": "^2.0.6",
"@tweenjs/tween.js": "^18.6.4",
"alea": "1.0.1",
"bitecs": "git://github.com/NateTheGreatt/bitECS.git#056c637e05327aab8e355ebf25e9ff202b67e495",
Expand All @@ -57,16 +57,16 @@
"node-cache": "^5.1.2",
"node-schedule": "^2.1.1",
"noisejs": "2.1.0",
"postprocessing": "6.32.2",
"postprocessing": "6.33.2",
"react": "18.2.0",
"react-dom": "18.2.0",
"realism-effects": "1.1.2",
"sharp": "^0.31.3",
"sift": "^17.0.1",
"simplex-noise": "^4.0.1",
"three": "0.153.0",
"three-mesh-bvh": "^0.6.2",
"three.quarks": "0.10.2",
"three": "0.157.0",
"three-mesh-bvh": "^0.6.8",
"three.quarks": "^0.10.14",
"ts-matches": "5.3.0",
"typescript": "5.0.2",
"web-worker": "1.2.0"
Expand All @@ -78,7 +78,7 @@
"@types/mock-require": "2.0.1",
"@types/offscreencanvas": "2019.7.0",
"@types/sinon": "10.0.13",
"@types/three": "0.153.0",
"@types/three": "0.157.0",
"jsdom": "21.1.1",
"jsdom-global": "3.0.2",
"mocha": "10.2.0",
Expand Down
49 changes: 26 additions & 23 deletions packages/engine/src/assets/csm/Shader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,14 @@ import { CSM } from './CSM'

const CSMShader = {
lights_fragment_begin: (csm: CSM) => /* glsl */ `
GeometricContext geometry;

geometry.position = - vViewPosition;
geometry.normal = normal;
geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
vec3 geometryPosition = - vViewPosition;
vec3 geometryNormal = normal;
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
vec3 geometryClearcoatNormal;

#ifdef CLEARCOAT

geometry.clearcoatNormal = clearcoatNormal;
geometryClearcoatNormal = clearcoatNormal;

#endif

Expand All @@ -55,14 +54,14 @@ IncidentLight directLight;

pointLight = pointLights[ i ];

getPointLightInfo( pointLight, geometry, directLight );
getPointLightInfo( pointLight, geometryPosition, directLight );

#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
pointLightShadow = pointLightShadows[ i ];
directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
#endif

RE_Direct( directLight, geometry, material, reflectedLight );
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );

}
#pragma unroll_loop_end
Expand All @@ -81,14 +80,14 @@ IncidentLight directLight;

spotLight = spotLights[ i ];

getSpotLightInfo( spotLight, geometry, directLight );
getSpotLightInfo( spotLight, geometryPosition, directLight );

#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
spotLightShadow = spotLightShadows[ i ];
directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
#endif

RE_Direct( directLight, geometry, material, reflectedLight );
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );

}
#pragma unroll_loop_end
Expand All @@ -115,7 +114,7 @@ IncidentLight directLight;
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {

directionalLight = directionalLights[ i ];
getDirectionalLightInfo( directionalLight, geometry, directLight );
getDirectionalLightInfo( directionalLight, directLight );

#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
// NOTE: Depth gets larger away from the camera.
Expand Down Expand Up @@ -144,7 +143,7 @@ IncidentLight directLight;
directLight.color = mix( prevColor, directLight.color, shouldFadeLastCascade ? ratio : 1.0 );

ReflectedLight prevLight = reflectedLight;
RE_Direct( directLight, geometry, material, reflectedLight );
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );

bool shouldBlend = UNROLLED_LOOP_INDEX != CSM_CASCADES - 1 || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1 && linearDepth < cascadeCenter;
float blendRatio = shouldBlend ? ratio : 1.0;
Expand All @@ -163,7 +162,7 @@ IncidentLight directLight;
directionalLightShadow = directionalLightShadows[ i ];
directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;

RE_Direct( directLight, geometry, material, reflectedLight );
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );

#endif

Expand All @@ -177,7 +176,7 @@ IncidentLight directLight;
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {

directionalLight = directionalLights[ i ];
getDirectionalLightInfo( directionalLight, geometry, directLight );
getDirectionalLightInfo( directionalLight, directLight );

#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )

Expand All @@ -188,7 +187,7 @@ IncidentLight directLight;
directionalLightShadow = directionalLightShadows[ i ];
if(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y) directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;

if(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && (linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1)) RE_Direct( directLight, geometry, material, reflectedLight );
if(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && (linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1)) RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );

#else

Expand All @@ -197,7 +196,7 @@ IncidentLight directLight;
directionalLightShadow = directionalLightShadows[ i ];
directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;

RE_Direct( directLight, geometry, material, reflectedLight );
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );

#endif

Expand All @@ -216,9 +215,9 @@ IncidentLight directLight;

directionalLight = directionalLights[ i ];

getDirectionalLightInfo( directionalLight, geometry, directLight );
getDirectionalLightInfo( directionalLight, directLight );

RE_Direct( directLight, geometry, material, reflectedLight );
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );

}
#pragma unroll_loop_end
Expand All @@ -240,14 +239,14 @@ IncidentLight directLight;

directionalLight = directionalLights[ i ];

getDirectionalLightInfo( directionalLight, geometry, directLight );
getDirectionalLightInfo( directionalLight, directLight );

#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
directionalLightShadow = directionalLightShadows[ i ];
directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
#endif

RE_Direct( directLight, geometry, material, reflectedLight );
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );

}
#pragma unroll_loop_end
Expand All @@ -262,7 +261,7 @@ IncidentLight directLight;
for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {

rectAreaLight = rectAreaLights[ i ];
RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );
RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );

}
#pragma unroll_loop_end
Expand All @@ -275,14 +274,18 @@ IncidentLight directLight;

vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );

irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );
#if defined( USE_LIGHT_PROBES )

irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );

#endif

#if ( NUM_HEMI_LIGHTS > 0 )

#pragma unroll_loop_start
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {

irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );

}
#pragma unroll_loop_end
Expand Down
6 changes: 3 additions & 3 deletions packages/engine/src/avatar/DissolveEffect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export class DissolveEffect {
`

const fragmentColorShader = `
#include <output_fragment>
#include <opaque_fragment>
float offset = vPosition - time;
if(offset > (-0.01 - rand(time) * 0.3)){
gl_FragColor = vec4(color.r, color.g, color.b, 1.0);
Expand All @@ -154,7 +154,7 @@ export class DissolveEffect {
}

const fragmentTextureShader = `
#include <output_fragment>
#include <opaque_fragment>
float offset = vPosition - time;
vec4 textureColor = texture2D(origin_texture, vUv3);
${textureShader}
Expand Down Expand Up @@ -192,7 +192,7 @@ export class DissolveEffect {
vertexShader = vertexShader.replace('#include <fog_vertex>', hasUV ? vertexUVShader : vertexNonUVShader)
fragmentShader = fragmentShader.replace('#include <clipping_planes_pars_fragment>', fragmentHeaderShader)
fragmentShader = fragmentShader.replace(
'#include <output_fragment>',
'#include <opaque_fragment>',
hasTexture ? fragmentTextureShader : fragmentColorShader
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export const AvatarDissolveComponent = defineComponent({
}

const fragmentTextureShader = `
#include <output_fragment>
#include <opaque_fragment>
float offset = vPosition - time;
vec4 textureColor = texture2D(map, vUv3);
${textureShader}
Expand Down Expand Up @@ -147,7 +147,7 @@ export const AvatarDissolveComponent = defineComponent({
vertexShader = vertexShader.replace('#include <clipping_planes_pars_vertex>', vertexHeaderShader)
vertexShader = vertexShader.replace('#include <fog_vertex>', vertexUVShader)
fragmentShader = fragmentShader.replace('#include <clipping_planes_pars_fragment>', fragmentHeaderShader)
fragmentShader = fragmentShader.replace('#include <output_fragment>', fragmentTextureShader)
fragmentShader = fragmentShader.replace('#include <opaque_fragment>', fragmentTextureShader)

if (isShaderMaterial) {
material.vertexShader = vertexShader
Expand Down
6 changes: 3 additions & 3 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
"@mediapipe/drawing_utils": "^0.3.1675466124",
"@mui/icons-material": "5.11.11",
"@mui/material": "5.11.13",
"@pixiv/three-vrm": "^2.0.1",
"@pixiv/types-vrmc-vrm-1.0": "^2.0.0",
"@pixiv/three-vrm": "^2.0.6",
"@pixiv/types-vrmc-vrm-1.0": "^2.0.6",
"autoprefixer": "^10.4.14",
"daisyui": "^3.1.9",
"re-resizable": "^6.9.9",
Expand Down Expand Up @@ -84,7 +84,7 @@
"@types/react-router-dom": "5.3.3",
"@types/react-slider": "^1.3.1",
"@types/styled-components": "5.1.26",
"@types/three": "0.153.0",
"@types/three": "0.157.0",
"babel-jest": "^29.4.1",
"babel-loader": "^8.3.0",
"crypto-browserify": "^3.12.0",
Expand Down
Loading