fix shadow mapping
This commit is contained in:
parent
b845e49bda
commit
578e0c50ee
@ -54,12 +54,10 @@
|
||||
|
||||
viewer.setDescription("");
|
||||
|
||||
viewer.loadGUI(() => {
|
||||
viewer.loadGUI().then(() => {
|
||||
viewer.setLanguage('en');
|
||||
$("#menu_appearance").next().show();
|
||||
$("#menu_tools").next().show();
|
||||
$("#menu_scene").next().show();
|
||||
viewer.toggleSidebar();
|
||||
// viewer.toggleSidebar();
|
||||
});
|
||||
|
||||
let light = new THREE.SpotLight();
|
||||
|
||||
@ -50,7 +50,11 @@
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(2 * 1000 * 1000);
|
||||
viewer.setDescription(`
|
||||
If your browser supports WebVR, a VR button will appear on the bottom right. (Tested on HTC Vive + Firefox and Oculus Quest) <br>
|
||||
If your browser supports WebVR, a VR button will appear on the bottom right. <br>
|
||||
(Tested on HTC Vive + Firefox 73 (<font style="color: #88ff88">works</font>),
|
||||
Oculus Quest (<font style="color: #88ff88">works</font>),
|
||||
Chrome 80 (<font style="color: #ff8888">(didn't work) </font>)
|
||||
<br>
|
||||
Controls: Point right controller in desired direction, then push the right joystick forward
|
||||
to fly in that direction.
|
||||
Pushing the left youstick in addition to the right one modifies speed by up to 4x.
|
||||
@ -122,10 +126,14 @@
|
||||
return;
|
||||
}
|
||||
|
||||
const displays = await navigator.getVRDisplays();;
|
||||
const displays = await navigator.getVRDisplays();
|
||||
console.log(displays);
|
||||
|
||||
if(displays.length > 0){
|
||||
|
||||
const controls = new Potree.VRControlls(viewer);
|
||||
viewer.addEventListener("update", (e) => controls.update(e.delta));
|
||||
|
||||
|
||||
const elVR = document.createElement("div");
|
||||
elVR.innerHTML = `
|
||||
|
||||
@ -50,6 +50,14 @@
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(0.3 * 1000 * 1000);
|
||||
viewer.loadSettingsFromURL();
|
||||
viewer.setDescription(`
|
||||
If your browser supports WebVR, a VR button will appear on the bottom right. <br>
|
||||
(Tested on HTC Vive + Firefox 73 (<font style="color: #88ff88">works</font>),
|
||||
Oculus Quest (<font style="color: #88ff88">works</font>),
|
||||
Chrome 80 (<font style="color: #ff8888">(didn't work) </font>)
|
||||
<br>
|
||||
Heidentor point cloud courtesy of <a href="http://archpro.lbg.ac.at/" target="_blank">Ludwig Boltzmann Institute - Archeological Prospection and Virtual Archeology</a> (26M points)
|
||||
`);
|
||||
|
||||
viewer.loadGUI(() => {
|
||||
viewer.setLanguage('en');
|
||||
|
||||
@ -916,13 +916,6 @@ void main() {
|
||||
vColor = vColor * visibility + vColor * uShadowColor * (1.0 - visibility);
|
||||
}
|
||||
|
||||
{ // debug
|
||||
vec4 depthMapValue = texture2D(uShadowMap[i], vec2(u, v) + sampleLocations[0]);
|
||||
|
||||
float t = depthMapValue.x * 20.0;
|
||||
vColor = vec3(t, t, t);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ export class PointCloudSM{
|
||||
this.camera.up.set(0, 0, 1);
|
||||
this.camera.position.copy(light.position);
|
||||
|
||||
let target = new THREE.Vector3().addVectors(light.position, light.getWorldDirection(new THREE.Vector3()));
|
||||
let target = new THREE.Vector3().subVectors(light.position, light.getWorldDirection(new THREE.Vector3()));
|
||||
this.camera.lookAt(target);
|
||||
|
||||
this.camera.updateProjectionMatrix();
|
||||
@ -65,10 +65,10 @@ export class PointCloudSM{
|
||||
|
||||
this.threeRenderer.setRenderTarget(this.target);
|
||||
this.threeRenderer.clear(true, true, true);
|
||||
this.threeRenderer.setRenderTarget(oldTarget);
|
||||
|
||||
this.potreeRenderer.render(scene, this.camera, this.target, {});
|
||||
|
||||
this.threeRenderer.setRenderTarget(oldTarget);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user