Skip to content

[DRAFT] implementation of Shadowmapping #7592

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

NeylMahfouf2608
Copy link
Collaborator

@NeylMahfouf2608 NeylMahfouf2608 commented May 5, 2025

I tried implementing the built-in shadowmapping system of threeJS exposed here (this implementation is only for DirectionalLight, but the concept is the same for each type of light):

https://threejs.org/examples/webgl_shadowmap_viewer.html

a course on the subject (very short) : https://threejs-journey.com/lessons/shadows#

In my implementation, i forced every required booleans absolutely everywhere it could be necessary. I did not have any good result with this way, nor with a more precise implementation. I push this for clarity.

I have only two theories to explain why there is no shadows :

  • A conflict of any sort with Pixi
  • A problem of scale within our implementation of 3D. We seem to use very high values for our most basic mesh (cube) compared to what I could find on other project. This might be a big problem to solve if we want to implement shadows, as it will force the shadow camera to have a huge plan, which will probably be horrible for performance.

Comment on lines 29 to 38
this.light.position.set(1, 0, 0);
this.light.castShadow = true;
this.light.shadow.mapSize.width = 1024;
this.light.shadow.mapSize.height = 1024;
this.light.shadow.camera.near = 0.1;
this.light.shadow.camera.far = 10;
this.light.shadow.camera.right = 10;
this.light.shadow.camera.left = 10;
this.light.shadow.camera.top = 10;
this.light.shadow.camera.bottom = 10;
this.light.position.set(0, 20, 0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change of position?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgotten small change for better visualization of the light with the lightHelper in my gdevelop game (does not modify behavior)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change of axis is not an issue?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not, it only changes the "direction" of the directionalLight, but it still is a light that (should) casts shadow normally

@NeylMahfouf2608 NeylMahfouf2608 changed the title [DRAFT] Failed implementation test of Shadowmapping [DRAFT] implementation of Shadowmapping Jun 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants