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

Adding hook to material breaks shadows of instanced geometry #369

Closed
vorg opened this issue Apr 9, 2024 · 3 comments
Closed

Adding hook to material breaks shadows of instanced geometry #369

vorg opened this issue Apr 9, 2024 · 3 comments
Projects
Milestone

Comments

@vorg
Copy link
Member

vorg commented Apr 9, 2024

Without hook vs with hook (all hook glsl commented out, just empty stage declarations)
Screenshot 2024-04-09 at 21 30 10

@vorg
Copy link
Member Author

vorg commented Apr 10, 2024

False alarm: I was using saturate (defined here https://github.com/pex-gl/pex-shaders/blob/cb6db08184414ed8a17ff22864d53b424528e35a/shaders/chunks/math.glsl.js#L8) function in hook that is defined when rendering to screen but not included with depth only rendering for shadowmapping.

Makes me wonder about using HSLS function in GLSL code (should be just clamp(f, 0, 1)) as similar problems might occur again in the future when porting code.

@dmnsgn
Copy link
Member

dmnsgn commented May 16, 2024

Agree we should avoid HLSL naming but I'd argue for keeping it as it is part of WGSL naming (and is quite useful, judging by the 24 occurences of it in pex-shaders and the few more clamp(x, 0.0, 1.0) there).

@vorg
Copy link
Member Author

vorg commented May 16, 2024

Well ok but then it should be proper function not define as below as it's crashing if i pass vec2 or vec3

#define saturate(x) clamp(x, 0.0, 1.0)

@dmnsgn dmnsgn added this to To do in 4.0.0 via automation May 22, 2024
@dmnsgn dmnsgn added this to the 4.0.0 milestone May 22, 2024
@vorg vorg closed this as completed May 22, 2024
4.0.0 automation moved this from To do to Done May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
4.0.0
  
Done
Development

No branches or pull requests

2 participants