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

Configurable World Shader Commands System #1738

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ZzzhHe
Copy link
Contributor

@ZzzhHe ZzzhHe commented Dec 30, 2024

Resolve #1541

  • Add WorldShaderCommands class to manage shader commands
  • Support adding/removing commands with custom GLSL code
  • Integrate command system into WorldRenderStage

@heinezen heinezen added area: renderer Concerns our graphics renderer nice new thing ☺ A new feature that was not there before lang: c++ Done in C++ code labels Dec 31, 2024
@heinezen
Copy link
Member

Hey thanks a lot and cool that it already works :)

I think we need to design this a bit more to make it more in line in the way that it is supposed to be used, i.e. by putting these snippets as files somewhere and merging the shader code better.

I'll think about it and will come back to you with more ideas.

@heinezen
Copy link
Member

Okay, I finally have time to respond here :D As said before, I like the direction where this is going, but I have a few requests for how commands should be integrated.

  1. If shader source code is supposed to be templated, I don't think it should be loaded as ShaderSource at the start as the code may be incomplete. Instead, there should probably be a ShaderTemplate class that the template is loaded into which can be fed with ShaderSnippets to insert into placeholder in the template. Once ShaderTemplate is configured with snippets, it should be able to create the final source code which can then be passed to the ShaderSource constructor. This additional layer would probably prevent a lot of problems for templates that are not properly initialized.
  2. I think we can already make the feature more versatile and extendable by not having a generic INSERT_POINT in the shader source code and instead assigning placeholder IDs. Multiple shader snippets could then be inserted into different position in the shader template based on their ID.
  3. I don't think the logic for creating shader code should be hardcoded, e.g. in WorldShaderCommands, because it defeats the point of making the commands configurable. The command code should be loadable from a file that the user can create. If we have to recompile the engine every time you want to change the commands, we might ass well just use the current solution.
  4. It's probably better to create a renderer demo for this feature rather than using it in the actual renderer. This way, we can test the design and change it without having to worry about it affecting the main rendering loop just yet.

@TheJJ TheJJ added kevin-rebuild-pl0x instruct kevin to rebuild this pull request and removed kevin-rebuild-pl0x instruct kevin to rebuild this pull request labels Jan 14, 2025
@SFTbot SFTbot removed the kevin-rebuild-pl0x instruct kevin to rebuild this pull request label Jan 14, 2025
@TheJJ TheJJ added the kevin-rebuild-pl0x instruct kevin to rebuild this pull request label Jan 14, 2025
@SFTbot SFTbot removed the kevin-rebuild-pl0x instruct kevin to rebuild this pull request label Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: renderer Concerns our graphics renderer lang: c++ Done in C++ code nice new thing ☺ A new feature that was not there before
Projects
Status: 📋 Backlog
Development

Successfully merging this pull request may close these issues.

Configurable world fragment shader
4 participants