Skip to content

Conversation

@mvaligursky
Copy link
Contributor

@mvaligursky mvaligursky commented Apr 30, 2025

  • removed private and non-functional StandardMaterial.customFragmentShader
  • added custom empty chunks allowing vertex and fragment shader of StandardMaterial and LitMaterial to be customized:
    litUserDeclarationPS: '',  // empty chunk allowing user to add custom code
    litUserDeclarationVS: '',  // empty chunk allowing user to add custom code
    litUserCodePS: '',  // empty chunk allowing user to add custom code
    litUserCodeVS: '',  // empty chunk allowing user to add custom code
    litUserMainStartPS: '',  // empty chunk allowing user to add custom code
    litUserMainStartVS: '',  // empty chunk allowing user to add custom code
    litUserMainEndPS: '',  // empty chunk allowing user to add custom code
    litUserMainEndVS: '',  // empty chunk allowing user to add custom code

These are included into existing shader chunks, either at the very start of the shader, just before the main function, and also at the start and end of the main function, which should cover most common places to inject code (apart from replacing existing chunks)

  • also created new chunk litMainPS (similar to existing litMainVS) which is the single entry point to fragment shader for all passes, removing any hardcoded parts. As long as the user knows this is the entry point, they can follow the rest of the shader from there:
Screenshot 2025-04-30 at 13 05 49

@Maksims
Copy link
Collaborator

Maksims commented Apr 30, 2025

This is amazing, as it will allow an easy injections into shaders!

@mvaligursky mvaligursky merged commit 133a99e into main Apr 30, 2025
7 checks passed
@mvaligursky mvaligursky deleted the mv-lit-user-chunks branch April 30, 2025 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: graphics Graphics related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants