mirror of
https://github.com/skillbert/rsmv.git
synced 2025-12-23 21:47:48 -05:00
fix 360cam lighting, bumped threejs
This commit is contained in:
14
package-lock.json
generated
14
package-lock.json
generated
@@ -25,7 +25,7 @@
|
||||
"sharp": "^0.29.2",
|
||||
"sql.js": "file:./src/libs/sqljsfork",
|
||||
"sqlite3": "^5.0.8",
|
||||
"three": "^0.133.1"
|
||||
"three": "^0.141.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/crc": "^3.4.0",
|
||||
@@ -6882,9 +6882,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/three": {
|
||||
"version": "0.133.1",
|
||||
"resolved": "https://registry.npmjs.org/three/-/three-0.133.1.tgz",
|
||||
"integrity": "sha512-WydohO8ll949B0FTD6MGz59Yv2Lwj8hvObg/0Heh2r42S6+tQC1WByfCNRdmG4D7+odfGod+n8JPV1I2xrboWw=="
|
||||
"version": "0.141.0",
|
||||
"resolved": "https://registry.npmjs.org/three/-/three-0.141.0.tgz",
|
||||
"integrity": "sha512-JaSDAPWuk4RTzG5BYRQm8YZbERUxTfTDVouWgHMisS2to4E5fotMS9F2zPFNOIJyEFTTQDDKPpsgZVThKU3pXA=="
|
||||
},
|
||||
"node_modules/thunky": {
|
||||
"version": "1.1.0",
|
||||
@@ -13258,9 +13258,9 @@
|
||||
}
|
||||
},
|
||||
"three": {
|
||||
"version": "0.133.1",
|
||||
"resolved": "https://registry.npmjs.org/three/-/three-0.133.1.tgz",
|
||||
"integrity": "sha512-WydohO8ll949B0FTD6MGz59Yv2Lwj8hvObg/0Heh2r42S6+tQC1WByfCNRdmG4D7+odfGod+n8JPV1I2xrboWw=="
|
||||
"version": "0.141.0",
|
||||
"resolved": "https://registry.npmjs.org/three/-/three-0.141.0.tgz",
|
||||
"integrity": "sha512-JaSDAPWuk4RTzG5BYRQm8YZbERUxTfTDVouWgHMisS2to4E5fotMS9F2zPFNOIJyEFTTQDDKPpsgZVThKU3pXA=="
|
||||
},
|
||||
"thunky": {
|
||||
"version": "1.1.0",
|
||||
|
||||
@@ -67,6 +67,6 @@
|
||||
"sharp": "^0.29.2",
|
||||
"sql.js": "file:./src/libs/sqljsfork",
|
||||
"sqlite3": "^5.0.8",
|
||||
"three": "^0.133.1"
|
||||
"three": "^0.141.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2087,6 +2087,8 @@ function floorToThree(scene: ThreejsSceneCache, floor: FloorMeshData) {
|
||||
mat.map.minFilter = THREE.NearestMipMapLinearFilter;
|
||||
mat.map.generateMipmaps = true;
|
||||
mat.map.encoding = THREE.sRGBEncoding;
|
||||
//bug in threejs? needs manual update after first update
|
||||
mat.map.needsUpdate = true;
|
||||
}
|
||||
} else {
|
||||
mat.wireframe = true;
|
||||
|
||||
@@ -62,7 +62,7 @@ export function augmentThreeJsFloorMaterial(mat: THREE.Material) {
|
||||
+ ` + texture2D( map, v_ra_floortex_23.rg ) * v_ra_floortex_weights.b * mix(vec4(1.0),diffuseColor,v_ra_floortex_usescolor.b)\n`
|
||||
+ ` + texture2D( map, v_ra_floortex_23.ba ) * v_ra_floortex_weights.a * mix(vec4(1.0),diffuseColor,v_ra_floortex_usescolor.a);\n`
|
||||
//TODO is this needed?
|
||||
+ `texelColor = mapTexelToLinear( mix( diffuseColor,texelColor,dot(vec4(1.0),v_ra_floortex_weights)) );\n`
|
||||
+ `texelColor = mix( diffuseColor,texelColor,dot(vec4(1.0),v_ra_floortex_weights));\n`
|
||||
+ `#endif\n`
|
||||
+ `diffuseColor = texelColor;\n`
|
||||
);
|
||||
|
||||
@@ -204,7 +204,7 @@ export class ThreeJsRenderer extends TypedEmitter<ThreeJsRendererEvents>{
|
||||
this.scene.fog = (fogcolobj && !hideFog ? new THREE.Fog("#" + fogcolobj.getHexString(), 80, 250) : null);
|
||||
if (sky?.skybox) {
|
||||
let scene = this.skybox?.scene ?? new THREE.Scene();
|
||||
let camera = this.skybox?.camera ?? this.camera.clone(false);
|
||||
let camera = this.skybox?.camera ?? new PerspectiveCamera().copy(this.camera, false);
|
||||
let obj = new THREE.Object3D();
|
||||
obj.scale.set(1 / 512, 1 / 512, -1 / 512);
|
||||
obj.add(sky.skybox);
|
||||
|
||||
@@ -47,7 +47,16 @@ export class VR360Render {
|
||||
magFilter: LinearFilter,
|
||||
format: RGBAFormat,
|
||||
encoding: parent.outputEncoding
|
||||
})
|
||||
});
|
||||
//threejs always renders non-default render targets in linear, however they programmed in a
|
||||
//special case for webxr render targets to still render in srgb
|
||||
//i'm guessing you would normally want your cubemaps to be linear for correct light calcs in reflection
|
||||
//but in this case the cube is the output
|
||||
//i could do this without hack by doing srgb in the fragment shader but that would result in big loss
|
||||
//of quality since we're in 8bit colors already
|
||||
(this.cubeRenderTarget as any).isXRRenderTarget = true;
|
||||
|
||||
|
||||
this.cubeCamera = new CubeCamera(near, far, this.cubeRenderTarget);
|
||||
this.skyCubeCamera = new CubeCamera(near, far, this.cubeRenderTarget);
|
||||
this.quad = new Mesh(new PlaneBufferGeometry(2, 2), new EquirectangularMaterial());
|
||||
|
||||
Reference in New Issue
Block a user