TressFX icon indicating copy to clipboard operation
TressFX copied to clipboard

Design clarification: shader flow

Open lion03 opened this issue 9 years ago • 4 comments

It is very unclear what is the shader flow of TFX 4.0.

It seems that the main shader procedure in the lib source is missing and what I found in the effects dir of the sample is very unclear.

Could you please clarify how to write a standalone shader for each pass?

lion03 avatar Apr 13 '17 10:04 lion03

There's basically two shader flows, but both assume you'd manage shader code through the engine, rather than us managing them within the library. In other words, we'd expect you'd put the code in .usf files, etc. and manage things through FGlobalShaders (or whatever it's called, or is appropriate in UE4). This is partly recognition that you'd have to do this to integrate with lighting anyways (so material shaders? sorry, don't know UE4 that well).

For rendering code, we expect you'd write the VS and/or PS, and we have tried to provide functions you can call. For example, the intent was to have a minimal vertex shader that you might write, and then just call GetExpandedTressFXVert().

For simulation code, we'd expect you'd probably just use the code we have - but still working through the engine's shader management system. The poorly named "EI_CreateComputePSO" is where we'd expect you'd provide code to get the right shader with the right entry point, using the info we pass to that. Maybe we should clarify those entry points a bit better in the hlsl too.

The tressfx shader code is in amd_tressfx/src/shaders. We probably still have some stragglers in amd_tressfx_sample.

Also, we're currently rearranging things a bit to be more UE4 friendly. Specifically, it seems UE4 wants parameters set individually for each shader. Meaning that if the positions are needed in 5 compute shaders, they have to be "set" all 5 times, even if called the same/in same slots for all 5, The whole layout/bind/"ComputeShaderPSO" still needs work for that (and it got overly complicated when some design priorities shifted).

khillesl-AMD avatar Apr 17 '17 18:04 khillesl-AMD

Got it! @khillesl-AMD Thank you very much!

I will start by creating an importer and and a simple baseline.

lion03 avatar Apr 18 '17 14:04 lion03

@khillesl-AMD Would it be possible to provide a document that details which buffers/params/resources belong to to each shader and their bind flags?

P.S.

This is the repo I am pushing my work to

https://github.com/lion03/UE4-K4W-Plugin/tree/TressFX

lion03 avatar Apr 21 '17 14:04 lion03

@khillesl-AMD I ran into an issue regarding coordinate spaces, while your shader is Y up UE is Z up. Can you please let me know what should be changed to convert from Y to Z up?

lion03 avatar Apr 24 '17 18:04 lion03