Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
dcccced
feat: make tile meshes support and receive shadows
Neptilo Sep 15, 2025
556c3e7
feat: implement shadows from Sun light
Neptilo Jan 28, 2026
d7515d2
feat: improve shadows and add date/time controls for sun position
Neptilo Jan 30, 2026
eef14cd
fix: change access modifiers for some members of SkyManager to private
Neptilo Jan 30, 2026
1c72211
perf: update shadow centering logic to avoid picking
Neptilo Feb 4, 2026
d4f6ef6
feat: define castShadow/receiveShadow as properties of the layers
Neptilo Feb 4, 2026
c4b2e7f
refactor: define TileLayerLike only once, fixing transpilation
Neptilo Feb 12, 2026
8a94b42
feat: extract sunlight out of sky manager to allow using shadows with…
Neptilo Feb 18, 2026
1e1da1b
refactor: extract sunlight as a custom DirectionalLight class
Neptilo Feb 18, 2026
f7559d6
feat: add castShadow property to TileLayerLike interface to fix tests
Neptilo Feb 18, 2026
719cc80
chore: enable/disable effect pass instead of adding/removing them & r…
Neptilo Feb 18, 2026
6ee277e
fix: check if this is defined in Feature2Mesh to fix tests
Neptilo Feb 18, 2026
2aa1c21
refactor: replace SunLight with SunLightLayer
Neptilo Mar 6, 2026
3317f57
chore: hangle PR comments
Neptilo Mar 6, 2026
3fbc3ac
refactor: move atmosphere out of SkyManager
HoloTheDrunk Mar 9, 2026
d667180
refactor: convert GlobeView to TS, fix fog bugs
Neptilo Mar 10, 2026
4f710c7
refactor: move realistic lighting init to enable
HoloTheDrunk Mar 10, 2026
8319761
wip: add RealisticLightingManager
HoloTheDrunk Mar 16, 2026
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
48 changes: 25 additions & 23 deletions examples/3dtiles_loader.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
"itowns": "../dist/itowns.js",
"debug": "../dist/debug.js",
"dat": "https://unpkg.com/dat.gui@0.7.9/build/dat.gui.module.js",
"GuiTools": "./jsm/GUI/GuiTools.js",
"LoadingScreen": "./jsm/GUI/LoadingScreen.js",
"itowns_widgets": "../dist/itowns_widgets.js",
"three": "https://unpkg.com/three@0.182.0/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.182.0/examples/jsm/"
}
Expand Down Expand Up @@ -60,18 +58,11 @@
<script type="module">
import * as THREE from 'three';
import dat from 'dat';
import GuiTools from 'GuiTools';
import setupLoadingScreen from 'LoadingScreen';
import * as itowns from 'itowns';
import * as debug from 'debug';
import * as itowns_widgets from 'itowns_widgets';

import {
AmbientLight,
PMREMGenerator,
} from 'three';
import { MeshoptDecoder } from 'three/addons/libs/meshopt_decoder.module.js';
import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js';
import {
zoomToLayer,
fillHTMLWithPickingInfo,
Expand Down Expand Up @@ -102,6 +93,7 @@

// Create a GlobeView
const view = new GlobeView(viewerDiv, placement, {
realisticLighting: true,
controls: {
minDistance: 100,
}
Expand All @@ -115,17 +107,6 @@
itowns.enableKtx2Loader('./lib/basis/', view.renderer);
itowns.enableMeshoptDecoder(MeshoptDecoder);

// Add ambient light to globally illuminates all objects
const light = new AmbientLight(0x404040, 40);
view.scene.add(light);

// Set the environment map for all physical materials in the scene.
// Otherwise, mesh with only diffuse colors will appear black.
const environment = new RoomEnvironment();
const pmremGenerator = new PMREMGenerator(view.renderer);
view.scene.environment = pmremGenerator.fromScene(environment).texture;
pmremGenerator.dispose();

// Setup loading screen
setupLoadingScreen(viewerDiv, view);

Expand Down Expand Up @@ -212,6 +193,27 @@
.then(() => debug.createOGC3DTilesDebugUI(gui, view, window.layer));
}

// ---------- DATE/TIME CONTROLS ----------

// Add date/time controls to adjust sun position
const dateFolder = gui.addFolder('Date/Time');
const date = view.date;
dateFolder.add(
{ month: THREE.MathUtils.clamp(1 + date.getMonth(), 1, 12) }, 'month', 1, 12, 1
).onChange((v) => {
date.setMonth(v);
view.notifyChange(view.sunLightLayer);
}).name('month (1-12)');
dateFolder.add(
{ hour: THREE.MathUtils.clamp(date.getHours(), 6, 21) }, 'hour', 6, 21, 0.1
).onChange((v) => {
const clampedValue = v;
const hours = Math.floor(clampedValue);
const minutes = (clampedValue - hours) * 60;
date.setHours(hours, minutes);
view.notifyChange(view.sunLightLayer);
}).name('hour (6-21)');

function loadLyon() {
setUrl("https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/refs/heads/master/3DTiles/lyon1-4978/tileset.json");
}
Expand All @@ -225,10 +227,10 @@
}




const readUrlButton = document.getElementById('readURLButton');

const loadLyonButton = document.getElementById('loadLyonButton');
const loadSeteButton = document.getElementById('loadSeteButton');
const loadLilleButton = document.getElementById('loadLilleButton');
Expand All @@ -245,7 +247,7 @@
window.view = view;
window.itowns = itowns;
window.THREE = THREE;

function loadPassedModel() {
const passedUrl = uri.searchParams.get('3dtiles');
if (passedUrl) {
Expand Down
Loading