Hello,

 

I am curious about how people automate exchange between the engine and the shader,

And how people handle shared parameter between shader ?

 

There is a nice article in Shader X 4 : “Transparent Shader data binding” about automate exchange,

but one of the problem of this Method is all object which will provide data for shader must derived from

a Common class (Engine Resource in this case).

 

I can see a less flexible way like having a class AutomateExchangeShaderPararameter, in which you would gather

All information to retrieve a fixed set of semantic variable (world matric, view matrix, fog color…).

 

For example you can have a :

AutomateExchangeShaderPararameter aesp;

 

Aesp->SetCamera(Camera) which will update projection matrix and other appropriate variable.

 

Then when you render your shader,

Shader->UpdateAutomatedVariable(); // will set projection matrix to right register constant value

 

How people are you handle this ?

 

One other point is how to handle shared parameter?

(Again a good article is shader X5 : case study: designing a shader subsystem for next-gen graphic engine)

You can have a global shared parameter class for your engine which collects all needed information.

Then you have some

UpdateAllFrameShaderParameter()

UpdateAllRenderSceneShaderParameter()

UpdateAllGroupShaderParameter()

Which will update the right value based on their frequency (typically by constant buffer).

 

How people actually do this?

Did you not use automated binding at all and set shader parameter variable at hand before each rendering?

 

I am curious about what design for Material system people use for a shader centric engine.

 

Thanks.

Lagarde Sébastien
Software engineer
Neko entertainment
www.e-neko.com