well, with my trying to bring litSolid shader on GS-rails gives some results
but i found what GS shader also need copy all VSdefinitions to pass all varyings(output variables) through GS shader into PS properly.
the problem with passing vShadowPos[NUMCASCADES]; through GS shader into PS i try to solve with mat4 without using structs in shaders (actually structs also working well), to avoid additional index in data.
VS write in mat4:
#ifdef PERPIXEL
#ifdef SHADOW
out mat4 vShadowPos;
#endif
#ifdef SHADOW
// Shadow projection: transform from world space to shadow space
for (int i=0; i < NUMCASCADES; i++)
vShadowPos[i] = GetShadowPos(i, projWorldPos);
#endif
in GS we have 3 matrixes input, by one for each vertex output
#ifdef PERPIXEL
#ifdef SHADOW
in mat4 vShadowPos[3];
and one for output into PS
#ifdef PERPIXEL
#ifdef SHADOW
out mat4 gsShadowPos;
#endif
GS emit shadow mat4 for vertex
#ifdef PERPIXEL
#ifdef SHADOW
gsShadowPos = vShadowPos[i];
#endif
after all PS gets one matrix and parse it
#ifdef PERPIXEL
#ifdef SHADOW
in mat4 gsShadowPos;
#endif
#ifdef SHADOW
vec4 vShadowPos[NUMCASCADES];
for (int i=0; i < NUMCASCADES; i++)
vShadowPos[i] = gsShadowPos[i];
diff *= GetShadow(vShadowPos, gsWorldPos.w);
#endif
but still i have some visual bugs with shading of model.
Edit:
I’am restore my brunch with GS with current master
now actual repo: github.com/MonkeyFirst/Urho3D/tree/gs-shader-gl
Known bugs:
bug1: [solved (with adding “gsi” to same place with vsi, psi )]forward renderer material based on DiffNormal+Packed tech some light problems (dark objects), DS work fine in this case.
bug2: CustomGeometry bug glitch of mesh (for example editor grid)