Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (degenerate_762, AndrewAMD), 877 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Using target_map vs. post processing #416806
02/04/13 22:21
02/04/13 22:21
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline OP
Expert
Uhrwerk  Offline OP
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Hello Mr. Lotter,

here is another thing I stumbled over. The problem is that when you use a target_map for rendering a text or a panel certain bitmap sizes seem to influence the post processing. I made a small code sample so that you can reproduce the strange behavior.

First we need post processing shader. The following file is named "coords.fx" and renders the x texture coordinate in the red channel and the y coordinate in the blue channel:
Code:
float4 PS (float2 texCoord : TEXCOORD0) : COLOR0
{
	return float4(texCoord.x,0,texCoord.y,1);
}

technique t0
{
	pass p0
	{
		VertexShader = null;
		PixelShader = compile ps_1_1 PS();
	}
}


Now we a need .c file:
Code:
#include <default.c>

VIEW* v = NULL;

void on_space_event()
{
	if (camera->stage)
		camera->stage = NULL;
	else
		camera->stage = v;
}

void main()
{
	level_load(NULL);
	
	BMAP* b = bmap_createblack(256,640,8888);

	PANEL* p = pan_create(NULL,1);
	p->flags |= SHOW | LIGHT;
	p->target_map = b; // Commenting this line will "fix" the bug.
	
	MATERIAL* m = mtl_create();
	effect_load(m,"coords.fx");

	v = view_create(1);
	v->material = m;
	v->flags = PROCESS_TARGET | CHILD;
}


The code is nothing too fancy so i won't describe it any further. Once you run the code and press space to activate the "post processing" you'll see this image:

It's pretty obvious that the coordinates are strangely stretched over the screen. If you change the resolution with F5 and change it back with shift + F5 you'll get correct results, like this:

For your comfort I created a difference image of the pictures above:

Looks as if only the x coordinates are wrong.

I tried to find a pattern in the dimension of the target_map that cause this effect but failed. At least I can say that all power of two sizes seem to work. Btw. I think you should issue a warning message when one tries to set a target_map does not match the requirements mentioned in the manual, i.e. the bitmap must be smaller than the camera view etc.

I hope this is of any help to you.


Always learn from history, to be sure you make the same mistakes again...
Re: Using target_map vs. post processing [Re: Uhrwerk] #416949
02/06/13 13:12
02/06/13 13:12
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
I confirm the problem; the view is clipped by the panel target map. That's why the coordinates are stretched after coordinate 256. We'll look into that and will fix it for the next release.

Re: Using target_map vs. post processing [Re: jcl] #416951
02/06/13 13:29
02/06/13 13:29
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline OP
Expert
Uhrwerk  Offline OP
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Thank you!


Always learn from history, to be sure you make the same mistakes again...

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