edit : this is working actually, unlike my brain, oops
hello,
I was working this morning on a GL filter that uses a depth function (extracted from a martinsh filter of course)
float readDepth(in vec2 coord)
{
if (gl_TexCoord[3].x<0.0||gl_TexCoord[3].y<0.0) return 1.0;
return (2.0 * znear) / (zfar + znear - texture2D(bgl_DepthTexture, coord ).x * (zfar-znear));
// return (2.0 * znear) / ( zfar + znear - x * (zfar-znear) );
}
the filter work well, provided there’s only one scene.
but in my own project there’s two scenes, and the objects are in the second one,
‘below’ the main scene - logic.addScene(scname,0) :
readDepth() only see the edges of the game window, everything is flat.
‘flat’ filters - that don’t use the bgl_DepthTexture, work fine on the ‘below’ scene - give the same results whereever the object with the filter brick is, the two scenes are here, in bgl_RenderedTexture.
logic.addScene(scname,1) does not solve the problem - actually the objects of the scene are ignored by the filter…
even if the filter brick is on the scname object.
float mood = ( normalize(interesting) + normalize(frustrating)*-9.0) * 0.1…
but maybe Im wrong the project is tricky, I did not test it in a small file. yet.
so before I rewrite my project to put everything in a single scene, have you any pointers or ideas about how I could retrieve the right depth from ‘below’ scene ?
ie a way to tell the BGE how to layer the scene keepZplease = True ?
thanks,