stride3d / stride3d/stride

How to generate shader source from material as text?

Open
#2,080 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
C#
Stars
7.8k
Forks
1.2k
Avg merge
2d 17h
Merged PRs (30d)
49

Description

Hello,
For educational purposes i want to create material and then generate shader source as text and read this text. How can I do that? I tried to read shader files from repository but it is difficult.

I started with something like that but I failed. This snipper returns null ;/

var context = new MaterialGeneratorContext(material, GraphicsDevice);
 context.Step = MaterialGeneratorStep.GenerateShader;
 context.PushLayer(null);
 context.PopLayer();
 var source = context.ComputeShaderSource(MaterialShaderStage.Vertex);

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the provided MaterialGeneratorContext snippet and inspect MaterialGeneratorStep.GenerateShader, PushLayer, PopLayer, and ComputeShaderSource(MaterialShaderStage.Vertex). Read the shader files in the repository to understand the expected generation flow. Done means documenting a working way to obtain the generated shader text, or clearly explaining why the snippet returns null.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
computer-graphics, game-dev
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.