Hi @REDACTEDUSER
The way to go here is to declare the parameter by name and enumeration, fill it, and then match it in the shader – here is a pre-existing example for sending a camera's front vector to a shader:
- The enum declaration (ShaderComponents.h):
ECGP_PB_CameraFront,
- The mapping to the shader (ShaderComponents.cpp):
SParamDB(PARAM(PB_CameraFront, ECGP_PB_CameraFront), 0),
- The data structure mapped to the buffer (ShaderComponents.h):
Vec3 pCameraFront; // ECGP_PB_CameraFront
- The setting of the data into the buffer (D3DHWShader.cpp):
case ECGP_PB_CameraFront:
sCameraFront(sData, r);
break;
- And finally, the shader declaration / matching (in Common.cfx) to be used by the shaders:
float4 CameraFrontVector: PB_CameraFront
I'm looking into an answer on this one for you. I'll get back to you soon.
Hi Binky,
Any progress?
The whole shader system seems to be designed to be obfuscated.
I have written a tool to parse the source code and handle all the conditional flags so I can look at what actually gets passed to the shader compiler, but it's not helped me at all.
For example I can see global constants all over the place. ( I hate global shader constants, but that's another issue). When I look for those values in the C++ code, no sign of them.
float4 g_PS_NearestScaled : PF_NearestScaled < psregister = PS_PROJ_RATIO_NEAREST_SCALED; >;
If you do a find in files of the source code
Find all "g_PS_NearestScaled", Match case, Subfolders, Find Results 1, Entire Solution, ""
Matching lines: 0 Matching files: 0 Total files searched: 11083
Or
Find all "PF_NearestScaled ", Match case, Subfolders, Find Results 1, Entire Solution, ""
Matching lines: 0 Matching files: 0 Total files searched: 11083
Nothing,
I can see it is mapped to registers ..
#define PS_PROJ_RATIO_NEAREST_SCALED c221
But that's all.
This is frustrating as hell, I just need to do some really simple changes to the shaders, but if I cannot pass in a vec3, I am screwed.
Time is running short and there is talk of me flying out to LA to work on a UE4 project, so I really want to get this working ASAP.
Anything you can do to speed things up would be worth beer.
I am going to be at the Lumberyard event in London on Monday, but I would like to be in the position to show something to the guys , rather than turn up and batter them with technical questions.
Cheers
Paul
Ah yes, these can be tricky to find. g_PS_NearestScaled is getting used inside of Engine/Shaders/HWScripts/CryFx/ShadowMaskGen.cfx (line 361)
float2 ProjRatio = (fSceneDepth<fNearestScaledLinear)?g_PS_NearestScaled.xy:g_PS_ProjRatio.xy;
Thanks Gene,
That sorted me out. Now I can actually get on with some real work.
Cheers
Paul
Adding new answers, comments, and votes is disabled.
Relevant content
- Accepted Answerasked 6 years ago
- Accepted Answerasked 6 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 5 months ago