Gamestudio Links
Zorro Links
Newest Posts
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
M1 Oversampling
by 11honza11. 04/20/24 20:57
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (rki), 405 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Postprocessing over panels #413191
12/09/12 23:02
12/09/12 23:02
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
I have nice "old movie" postprocessing shader, and I want it to affect on HUD (inventory etc). So I wanted to ask, is it possible to make postprocessing shaders somehow affect on panels? I have a small idea in my head (as I'm noob at shaders, this idea has no point), maybe there is a way, to create one blank panel, set it's layer around 99 (so it will be over all other panels) stretch it to the screen's size and attach "somehow" postprocessing shader?? Thank you for your time! Any kind of help is appreciated!


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Postprocessing over panels [Re: 3run] #413206
12/10/12 08:39
12/10/12 08:39
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
It seems a good way to go when the process has nothing to do with the render/panels colors and so.
Code:
MATERIAL *mtlEffect = mtl_create ();
mtlEffect.effect = "myeffect.fx";

PANEL *panSource = pan_create ( "", 1 );
...
panSource.bmap = bmap_createblack ( panSource.size_x, panSource.size_y, 32 );
set ( panSource, SHOW );

...

while ( 1 )
{
   bmap_process ( panSource.bmap, NULL, mtlEffect );
   wait(1);
}



Otherway I know two other similar ways to go.

If you want to process just the panels, render them over a render target and show it throught an other panel with a bmap_process.
Code:
MATERIAL *mtlEffect = mtl_create ();
mtlEffect.effect = "myeffect.fx";

PANEL *panSource = pan_create ( "", 99 );
...
panSource.render_target = bmap_createblack ( panSource.size_x, panSource.size_y, 32 );
set ( panSource, SHOW );

PANEL *panDestiny = pan_create ( "", 1 );
panSource.bmap = bmap_createblack ( panSource.size_x, panSource.size_y, 32 );
set ( panDestiny, SHOW );

...

while ( 1 )
{
   bmap_process ( panDestiny.bmap, panSource.render_target, mtlEffect );
   wait(1);
}



If you want process the camera too, you can go like in the example above and include the camera render target in a material skin, or you can enlarge the render chain with a process_target view.

Code:
PANEL *panSource = pan_create ( "", 1 );
...
panSource.render_target = bmap_createblack ( panSource.size_x, panSource.size_y, 32 );
set ( panSource, SHOW );

MATERIAL *mtlEffect = mtl_create ();
mtlEffect.effect = "myeffect.fx";
mtlEffect.skin1 = panSource.render_target;

VIEW *camFinal = view_create ( 1 );
camFinal.material = mtlEffect;
set ( camFinal, SHOW | PROCESS_TARGET | CHILD );

camera.stage = camFinal;



In both cases, you'll need to check the texture sampler sources of the shader.

hope it helps,
salud!

Last edited by txesmi; 12/10/12 08:46. Reason: ups, code error ;)
Re: Postprocessing over panels [Re: txesmi] #413209
12/10/12 11:28
12/10/12 11:28
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
I wanted to try the second solution, but it says that "render_target" isn't member of a panel.
BTW, if I do by second solution, for all other panels, do I need to do anything? Thank you for your help man.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Postprocessing over panels [Re: 3run] #413210
12/10/12 12:44
12/10/12 12:44
Joined: Feb 2010
Posts: 320
TANA/Madagascar
3dgs_snake Offline
Senior Member
3dgs_snake  Offline
Senior Member

Joined: Feb 2010
Posts: 320
TANA/Madagascar
Hi,

The true name is "target_map".

Re: Postprocessing over panels [Re: 3dgs_snake] #413211
12/10/12 12:53
12/10/12 12:53
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Hi snake, I tried to replace "render_target" with "target_map", but it crashes each frame from the while loop:
Quote:
bmap_process ( panDestiny.bmap, panSource.target_map, mtlEffect );
I guess problem was that bmap for "panDestiny" wasn't defined...


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Postprocessing over panels [Re: 3dgs_snake] #413212
12/10/12 13:00
12/10/12 13:00
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
ops, that is true blush target_map!

You can render all the panels in the same render target, but I remember some troubles with alpha...

edit___
the source panel should have a content, too

Last edited by txesmi; 12/10/12 13:02.
Re: Postprocessing over panels [Re: txesmi] #413213
12/10/12 13:03
12/10/12 13:03
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
In the same render target? You mean like this:
Code:
bmap_process(panel.bmap, panSource.target_map, mtlEffect);

I'm noob at rendering, shaders stuff, so please don't be confused grin

Edit: "content" ?


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Postprocessing over panels [Re: 3run] #413214
12/10/12 13:09
12/10/12 13:09
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
i mean use same bmap as render target in all the panels.

Code:
BMAP *bmpRT = bmap_createblack ( screen_size.x, screen_size.y, 32 );
PANEL *pan1 = pan_create ( "", 1 );
pan1.target_map = bmpRT;
PANEL *pan2 = pan_create ( "", 2 );
pan2.target_map = bmpRT;
PANEL *pan3 = pan_create ( "", 3 );
pan3.target_map = bmpRT;

while (1)
{
   bmap_process ( panVisible, bmpRT, mtlEffect );
   wait(1);
}



whit content i mean, a background bmap, or a digit, or so. Something to render in the render target. grin


edit__
sorry, I miss with the hurry in the code above...
Code:
MATERIAL *mtlEffect = mtl_create ();
mtlEffect.effect = "pp_oldMovie.fx";

PANEL *panSource = pan_create ( "", 99 );
panSource.size_x = 128; // Define the size, otherwise...
panSource.size_y = 128; // 
panSource.bmap = bmap_createblack ( panSource.size_x, panSource.size_y, 32 ); // ir has 0 values!!

panSource.target_map = bmap_createblack ( panSource.size_x, panSource.size_y, 32 );
set ( panSource, SHOW );

PANEL *panDestiny = pan_create ( "", 1 );
panDestiny.bmap = bmap_createblack ( panSource.size_x, panSource.size_y, 32 ); // panDestiny bmap was pan Source, my fault...
set ( panDestiny, SHOW );

while(1){
	bmap_process(panDestiny.bmap, panSource.target_map, mtlEffect);
	wait(1);
}


Last edited by txesmi; 12/10/12 13:19.
Re: Postprocessing over panels [Re: txesmi] #413215
12/10/12 13:32
12/10/12 13:32
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
fucking shaders... I still can't get it... mad
Code:
MATERIAL* mtlEffect = mtl_create ();
mtlEffect.effect = "pp_oldMovie.fx";

PANEL* panSource = pan_create("", 99 );
panSource.size_x = 128; // Define the size, otherwise...
panSource.size_y = 128; // 
panSource.bmap = bmap_createblack(panSource.size_x, panSource.size_y, 32); // ir has 0 values!!
panSource.target_map = bmap_createblack(panSource.size_x, panSource.size_y, 32);
set(panSource, SHOW);

PANEL* panDestiny = pan_create("", 1);
panDestiny.bmap = bmap_createblack(panSource.size_x, panSource.size_y, 32); // panDestiny bmap was pan Source, my fault...
set(panDestiny, SHOW);

PANEL* test_pan = pan_create("bmap = inv_temp.bmp;", 1);
test_pan.target_map = panSource.bmap;
set(test_pan, SHOW);

while(1){
	bmap_process(panDestiny.bmap, panSource.target_map, mtlEffect);
	bmap_process(test_pan.bmap, panSource.target_map, mtlEffect);
	wait(1);
}

I've defined size as you've said (can I use screen size, or isn't that necessary?), I've set target map of a new panel to the bmap of the main (source) panel, all I can see, is that my (test pan) panel is smaller than it was (playing with the size of the source panel doesn't affect on it), and it's isn't affected by shader! What am I doing wrong? frown


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Postprocessing over panels [Re: 3run] #413223
12/10/12 14:40
12/10/12 14:40
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
try this. it is tested grin

Code:
#include <acknex.h>

MATERIAL *mtlEffect =
{
	effect = "
		float4 vecCycle;
		texture TargetMap;
		sampler ColorSampler = sampler_state { Texture = <TargetMap>; };
		
		float4 PS ( in float2 inTex: TEXCOORD0 ) : COLOR0
		{
			float2 Coord = inTex.xy * vecCycle.y;
			float4 Color1 = tex2D ( ColorSampler, Coord );
			Color1.a = 1.0f;
			return Color1;
		}
		
		technique blur
		{
			pass p0
			{
				VertexShader = null;
				PixelShader  = compile ps_2_0 PS();
			}
		}
	";
}


function main ()
{
	video_set(256,256,32,2);
	wait(1);
	
	FONT *fntArial = font_create ( "Arial#30" );
	STRING *strText = str_create ( "ABCDEFGHIJKL" );
	PANEL *panSource = pan_create ( "", 1 );
	panSource.size_x = 256;
	panSource.size_y = 256;
	pan_setstring ( panSource, 0, 0, 0, fntArial, strText );
	pan_setstring ( panSource, 0, 0, 30, fntArial, strText );
	pan_setstring ( panSource, 0, 0, 60, fntArial, strText );
	pan_setstring ( panSource, 0, 0, 90, fntArial, strText );
	set ( panSource, SHOW );
	panSource.target_map = bmap_createblack ( 256, 256, 32 );
	
	PANEL *panDestiny = pan_create ( "", 1 );
	panDestiny.bmap = bmap_createblack ( 256, 256, 32 );
	set ( panDestiny, SHOW );
	
	while ( !key_esc )
	{
		bmap_process ( panDestiny.bmap, panSource.target_map, mtlEffect );
		wait(1);
	}
	
	sys_exit ( NULL );
}


Page 1 of 2 1 2

Moderated by  Blink, Hummel, Superku 

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