Compare commits

...

6 Commits

Author SHA1 Message Date
Neyl
e3532f9a3d Merge branch 'skybox' of https://github.com/4ian/GDevelop into skybox 2025-07-04 17:16:45 +02:00
Neyl
213e323d3b changed test image format for png 2025-07-04 17:16:15 +02:00
Neyl
ba5566f070 Update DirectionalLight.ts 2025-07-04 17:04:17 +02:00
Neyl
ed3cd34832 experiment two implementations of skyboxes 2025-07-04 16:52:42 +02:00
Neyl
4cc8256037 Merge branch 'master' into skybox
merge to get shadow bias
2025-07-04 15:33:19 +02:00
Neyl
aef74ba19e initial test comit 2025-07-04 15:33:02 +02:00
8 changed files with 52 additions and 3 deletions

View File

@@ -109,6 +109,40 @@ namespace gdjs {
if (!scene) {
return false;
}
const skyboxGeo = new THREE.BoxGeometry(10000, 10000, 10000);
const ft = new THREE.TextureLoader().load(
'C:/Users/Utilisateur/Desktop/Gdevelop/GDevelop/Extensions/3D/clouds1_north.png'
);
const bk = new THREE.TextureLoader().load(
'C:/Users/Utilisateur/Desktop/Gdevelop/GDevelop/Extensions/3D/clouds1_south.png'
);
const up = new THREE.TextureLoader().load(
'C:/Users/Utilisateur/Desktop/Gdevelop/GDevelop/Extensions/3D/clouds1_up.png'
);
const dn = new THREE.TextureLoader().load(
'C:/Users/Utilisateur/Desktop/Gdevelop/GDevelop/Extensions/3D/clouds1_down.png'
);
const rt = new THREE.TextureLoader().load(
'C:/Users/Utilisateur/Desktop/Gdevelop/GDevelop/Extensions/3D/clouds1_east.png'
);
const lf = new THREE.TextureLoader().load(
'C:/Users/Utilisateur/Desktop/Gdevelop/GDevelop/Extensions/3D/clouds1_west.png'
);
const materialArray = [
new THREE.MeshBasicMaterial({ map: rt, side: THREE.BackSide }), // Right
new THREE.MeshBasicMaterial({ map: up, side: THREE.BackSide }), // Left
new THREE.MeshBasicMaterial({ map: lf, side: THREE.BackSide }), // Top
new THREE.MeshBasicMaterial({ map: dn, side: THREE.BackSide }), // Bottom
new THREE.MeshBasicMaterial({ map: bk, side: THREE.BackSide }), // Front
new THREE.MeshBasicMaterial({ map: ft, side: THREE.BackSide }), // Back
];
const skybox = new THREE.Mesh(skyboxGeo, materialArray);
skybox.position.set(0, 0, 0);
skybox.frustumCulled = false;
scene.add(skybox);
scene.add(this._light);
scene.add(this._light.target);
if (this._shadowCameraHelper) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

View File

@@ -11,6 +11,8 @@ namespace gdjs {
private _profilerText: PIXI.Text | null = null;
private _showCursorAtNextRender: boolean = false;
private _threeRenderer: THREE.WebGLRenderer | null = null;
private loader: THREE.CubeTextureLoader;
private texture: THREE.CubeTexture;
private _layerRenderingMetrics: {
rendered2DLayersCount: number;
rendered3DLayersCount: number;
@@ -33,6 +35,17 @@ namespace gdjs {
this._threeRenderer = this._runtimeGameRenderer
? this._runtimeGameRenderer.getThreeRenderer()
: null;
this.loader = new THREE.CubeTextureLoader();
this.texture = this.loader.load([
'C:/Users/Utilisateur/Desktop/Gdevelop/GDevelop/Extensions/3D/clouds1_east.png', // px
'C:/Users/Utilisateur/Desktop/Gdevelop/GDevelop/Extensions/3D/clouds1_west.png', // nx
'C:/Users/Utilisateur/Desktop/Gdevelop/GDevelop/Extensions/3D/clouds1_up.png', // py
'C:/Users/Utilisateur/Desktop/Gdevelop/GDevelop/Extensions/3D/clouds1_down.png', // ny
'C:/Users/Utilisateur/Desktop/Gdevelop/GDevelop/Extensions/3D/clouds1_north.png', // pz
'C:/Users/Utilisateur/Desktop/Gdevelop/GDevelop/Extensions/3D/clouds1_south.png', // nz
]);
}
onGameResolutionResized() {
@@ -209,9 +222,11 @@ namespace gdjs {
);
threeRenderer.resetState();
if (this._runtimeScene.getClearCanvas()) threeRenderer.clear();
threeScene.background = new THREE.Color(
this._runtimeScene.getBackgroundColor()
);
threeScene.background = this.texture;
// threeScene.background = new THREE.Color(
// this._runtimeScene.getBackgroundColor()
// );
isFirstRender = false;
} else {