Skip to content
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

Partially refactored the lighting / shadowing part of the lit-shader generation #7352

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mvaligursky
Copy link
Contributor

@mvaligursky mvaligursky commented Feb 14, 2025

  • generate defines for the lighting, for example
#define LIGHT_COUNT 3
#define AREA_LIGHTS true
#define LIGHT0 true
#define LIGHT0TYPE DIRECTIONAL
#define LIGHT0SHADOWTYPE PCF3_32F
#define LIGHT0SHAPE DISK
#define LIGHT0CASTSHADOW true
#define LIGHT0SHADOW_PCF true
#define SHADOW_KIND_PCF3 true
#define SHADOW_DIRECTIONAL true
#define LIGHT1 true
#define LIGHT1TYPE OMNI
#define LIGHT1SHADOWTYPE PCF3_32F
#define LIGHT1SHAPE SPHERE
#define LIGHT2 true
#define LIGHT2TYPE SPOT
#define LIGHT2SHADOWTYPE PCF3_32F
#define LIGHT2SHAPE RECT
#define LIGHT2CASTSHADOW true
#define LIGHT2SHADOW_PCF true

the large part of the code get is then based on lighting.js chunk and those defines. This makes it easy to move this code to WGSL, only the chunk needs to be converted.

  • clean up shadow chunks: renames + separation by type, so that the shader generator can only include what is needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: graphics Graphics related issue enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant