Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (VoroneTZ, 7th_zorro), 1,071 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
bmap_rendertarget confusion #255857
03/13/09 01:04
03/13/09 01:04
Joined: Jun 2004
Posts: 655
to your left
BoH_Havoc Offline OP
User
BoH_Havoc  Offline OP
User

Joined: Jun 2004
Posts: 655
to your left
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:

Code:
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 cry

I really hope i'm doing something wrong or this is a bug smile


Shade-C EVO Lite-C Shader Framework
Re: bmap_rendertarget confusion [Re: BoH_Havoc] #255885
03/13/09 08:02
03/13/09 08:02
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
I know no reason why MRTs should not be smaller than the screen size.

Maybe it's a problem with the view offset and size. Have you set it to the size of the bitmap? If the size is 0, it defaults to the screen size, not to the render target size.

Re: bmap_rendertarget confusion [Re: jcl] #256289
03/15/09 20:13
03/15/09 20:13
Joined: Jun 2004
Posts: 655
to your left
BoH_Havoc Offline OP
User
BoH_Havoc  Offline OP
User

Joined: Jun 2004
Posts: 655
to your left
The view size equals the render target size. I also tested setting it to a different size, but no luck.

I made more tests: As soon as i call bmap_rendertarget ANYWHERE in my code, i can't use smaller render targets anymore. They always have to be the same size as screen_size.x/y. Happens with my shade-c plugin, happens with the shaderviewer: Call bmap_rendertarget anywhere in the code and small rendertargets go haywire wink

[edit] Don't know if this is of any interest, but here are my PC specs:
- Windows XP Prof, SP 3
- Gamestudio A7 7.7
- Core 2 Duo P8400 @ 2.26GHz
- Gefore 9800M GTS
- 3GB RAM


Shade-C EVO Lite-C Shader Framework
Re: bmap_rendertarget confusion [Re: BoH_Havoc] #256329
03/16/09 08:04
03/16/09 08:04
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Ok, then I'll have to look into it. It could be a bug. In my test levels I have smaller render targets, but it might be some setting particular to your project.

Re: bmap_rendertarget confusion [Re: jcl] #257493
03/23/09 15:16
03/23/09 15:16
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Some thoughts:

Your script looks as if you set all render targets globally, in an init function. This means all render targets stay enabled until you disable them. In that case you must indeed make sure that all render targets have the same size.

Normally, you switch on the render targets for a certain view in a view event, and switch them off afterwards. In that case you should be able to use different sizes for the render targets as long as all active targets have the same size.

Can this be the reason?


Moderated by  jcl, Nems, Spirit, Tobias 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1