I don't know if this a bug, my stupidity or just normal:
For my deferred renderer i make use of bmap_rendertarget, which is called for a bmap struct the camera renders into. 3 MRTs are being used. Everything works perfectly fine, except one thing:
When i try to create a bmap with
myBmap = bmap_createblack(screen_size.x/4,screen_size.y/4,32);
and the MRTs size is screen_size.x and screen_size.y i can't render into that bmap.
I know that when using MRTs you have to use the same size for all bmaps a view renders into. But i'm trying to render into that smaller bmap from another view, which has nothing to do with the view i use MRTs with. It seems as if ABSOLUTELY ALL rendertargets have to be the same size when making use of bmap_rendertarget anywhere in your code.
Is this the correct behavior for MRTs? As far as i know, i should be able to e.g. downsample a rendertarget, even if i use MRTs anywhere else.
example:
typedef struct
{
BMAP* col;
BMAP* norm;
BMAP* depth;
}SC_GBUFFER;
SC_GBUFFER sc_bmap_gBuffer; //the g-buffer
BMAP* sc_bmap_ssao; //bitmap which holds the screen spaced ambient occlusion map
//material for downsampling
MATERIAL* sc_mtl_defSSAODown =
{
effect = "sc_defSSAODown.fx";
}
//the view which will be used for downsampling
VIEW* sc_view_defSSAODown = {
layer = -4;
flags = PROCESS_TARGET;
material = sc_mtl_defSSAODown;
}
//setup deferred renderer
void sc_setupDeferred()
{
sc_bmap_gBuffer.col = bmap_createblack(screen_size.x,screen_size.y,32);
sc_bmap_gBuffer.norm = bmap_createblack(screen_size.x,screen_size.y,32);
sc_bmap_gBuffer.depth = bmap_createblack(screen_size.x,screen_size.y,14);
camera.material = sc_mtl_gBuffer;
camera.bmap = sc_bmap_gBuffer.col;
bmap_rendertarget(sc_bmap_gBuffer.norm,1,1);
bmap_rendertarget(sc_bmap_gBuffer.depth,2,1);
.
.
.
// Here comes the part where i try to downsample a bmap which isn't using MRTs and has no relation to the
// camera view
sc_mtl_defSSAODown.skin1 = sc_bmap_gBuffer.depth;
var sc_ssaoRT;
//doesn't work
sc_ssaoRT = 4;
sc_bmap_ssao = bmap_createblack(screen_size.x/sc_ssaoRT ,screen_size.y/sc_ssaoRT ,32);
//works
sc_ssaoRT = 1;
sc_bmap_ssao = bmap_createblack(screen_size.x/sc_ssaoRT ,screen_size.y/sc_ssaoRT ,32);
sc_view_defSSAODown.bmap = sc_bmap_ssao;
}
Here is what i should get And here is what i get when i try to downsample the bmap (sc_ssaoRT = 4;)Any ideas?
Please don't tell me this is normal behaviour for MRTs. If i can't downsample anymore, i also can't do efficient hdr,dof or ssao anymore
I really hope i'm doing something wrong or this is a bug