For example Notice that the forward3D access inPs.pos directly :-
Code: Select all
float fSlice = log2( max( -inPs.pos.z - ....
The Ogre's official piece should use more-local-like name e.g. forward3D_inPsPos, and the external "caller" responsible to pass it like:-
Code: Select all
vec3 forward3D_inPsPos=inPs.pos; //user code
.... insert piece "forward3dLighting" .... which use "forward3D_inPsPos" instead of "inPs.pos"
..... float fSlice = log2( max( -forward3D_inPsPos.z - ....
If it is done, in custom HLMS implemention, I don't have to try to identify the fields the Forward3D sneakily want, and riskily rename mine to match it.
Another interpretation
It is hard to explain, so here is another attempt:-
Current pixel shader is roughly-like :-
Code: Select all
input: inPs
algorithm :{
my hlms
forward3D block (access inPs.pos)
}
Code: Select all
input: inPs
algorithm :{
my hlms
vec3 forward3D_inPsPos = inPs.pos; //<-- still my code
//^--- like a parameter to a Forward3D function
forward3D block (access forward3D_inPsPos)
}
Many other places are also hard-coded, but I am not sure whether it should be/easy-to encapsulate :-
Code: Select all
float f3dMinDistance = passBuf.f3dData.x;
Code: Select all
vec3 tmpColour = BRDF( lightDir, viewDir, NdotV, lightDiffuse.xyz, lightSpecular );
If this post is too hard to understand, please tell me, I will try even harder.
I am not sure if it is a good idea though.
Custom C++ HLMS implementation is used by just a few user anyway.