Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, 7th_zorro, VoroneTZ, HoopyDerFrood), 1,264 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19053 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
A7.10 bmap_zbuffer and d3d_antialias #214894
07/08/08 01:31
07/08/08 01:31
Joined: Sep 2005
Posts: 274
Switzerland - Zurich
zwecklos Offline OP
Member
zwecklos  Offline OP
Member

Joined: Sep 2005
Posts: 274
Switzerland - Zurich
Hi dear Conitec,
First of all I want to thank you for the latest update.
Many new features and all of them are just amazing crazy

I have a question about the new bmap_zbuffer function and d3d_antialias.
Its an easy question smile
How does it work?

Lite-C Code:
Code:
MATERIAL* mtlBloom =
{
	effect = "pp_bloom.fx";	// The effect file containing the postprocessing shader.
	//flags = AUTORELOAD;		// allows to edit the shader at runtime
}

VIEW* viewBloom =
{
	material = mtlBloom;	// use the shader
	flags = PROCESS_TARGET; // process the previous view's render target
}

function main()
{
	

	video_mode = 8;	 // screen size 1024x768
	video_screen = 1;
	video_depth = 32; // 32 bit colour D3D mode
	d3d_antialias = 4;
	
	wait(1);
	camera.stage = viewBloom;
	bmap_zbuffer(bmap_createblack(1024,768,32));



FX Code:
Code:
Texture TargetMap;
sampler2D g_samSrcColor = sampler_state { texture = <TargetMap>; MipFilter = Linear;	};

float4 vecViewPort;
float4 vecSkill1;

float4 postprocessing_bloom(float2 Tex : TEXCOORD0) : COLOR0 
{	
	float facBlur = vecSkill1.x + 20;
	float4 Color = tex2D( g_samSrcColor, Tex.xy);
	Color += tex2D( g_samSrcColor, Tex.xy+vecViewPort.zw*facBlur)*0.1;
	Color += tex2D( g_samSrcColor, Tex.xy+vecViewPort.zw*facBlur*0.2);
	Color += tex2D( g_samSrcColor, Tex.xy+vecViewPort.zw*facBlur*0.3);	

	return Color / 2.0;
}


technique PostProcess 
{
	pass p1 
	{
		AlphaBlendEnable = false;	
		VertexShader = null;
		PixelShader = compile ps_2_0 postprocessing_bloom();
	}
}


I tried several things to make it work with no success yet.
Do I need to work with render_zbuffer? And when yes, how? smile

I remember some pp-effects, they were using a transparent view-entity layed on the camera (quad). This worked with bmap_for_entity to render the view on that quad.
Is this the way to go?
Sorry for those dumb questions but I have no idea on how to use it correctly.

I would be pleased to get any informations about how to use bmap_zbuffer and d3d_antialias in the right way.

sincerely

zwecklos

Last edited by zwecklos; 07/09/08 01:42.
Re: A7.10 bmap_zbuffer and d3d_antialias [Re: zwecklos] #214929
07/08/08 09:34
07/08/08 09:34
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Offline
Expert
Joey  Offline
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
i think the z-buffer must be larger than your actual screen resolution. i'm not quite sure about the numbers behind d3d_antialias, but for 2xfsaa you'd probably need twice the size for the backbuffer (either 1.414... or 2, i'm not sure).

Re: A7.10 bmap_zbuffer and d3d_antialias [Re: Joey] #214933
07/08/08 09:48
07/08/08 09:48
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
The target z buffer must have the same or bigger size as the render target buffer.

However antialiasing only works when rendering to the screen, not when rendering into a target buffer. Using bmap_zbuffer has the advantage that you can then also use antialiasing at the same time. But it only affects the views that directly render on the screen.

Re: A7.10 bmap_zbuffer and d3d_antialias [Re: jcl] #215028
07/08/08 21:53
07/08/08 21:53
Joined: Sep 2005
Posts: 274
Switzerland - Zurich
zwecklos Offline OP
Member
zwecklos  Offline OP
Member

Joined: Sep 2005
Posts: 274
Switzerland - Zurich
Thanks a lot for your answers,
I still have some questions, I hope its ok to ask em here. If not please move this thread to another topic.

Quote:

The target z buffer must have the same or bigger size as the render target buffer.


Does that mean that the bmap_zbuffer paramters must have the size of the actual screen resolution?
So the statement “bmap_zbuffer(bmap_createblack(1024,768,32));” would be ok when I use “video_mode = 8;” and “video_depth = 32;” ?

Is there a need to use a pre-defined bmap pointer?
like "BMAP* pp_blender = "test.tga";" and "bmap_zbuffer(pp_blender);"

When yes, does it matter what file format Im using? Is there a need of an alpha channel?
Im also not sure about the new CHILD flag for views, do I need it for pp effects and aa?

It would be so awesome when I could see an example code on how to implement “d3d_antialias” beside a pp-effect by using “bmap_zbuffer”.
Anyway, Ill go now and try harder to get it to work smile

Cheers

Zwecklos


Last edited by zwecklos; 07/08/08 22:07.
Re: A7.10 bmap_zbuffer and d3d_antialias [Re: zwecklos] #215085
07/09/08 06:58
07/09/08 06:58
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
bmap_createblack(1024,768,32) is ok for a z buffer. If the format is wrong, i.e. different from 32, it's converted automatically, so it does not really matter. Only the size matters. The z buffer normally uses 24 bits for the depth and 8 bits for the stencil.


Moderated by  old_bill, 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