Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, TipmyPip, Edgar_Herrera), 804 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
render-targets dont work with OVERLAY ?!? #412260
11/24/12 19:14
11/24/12 19:14
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline OP
Expert
EvilSOB  Offline OP
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Sorry I cant post code, but its messy and complex and semi-secret.

But my problem is this...


1> I render a view into a BMAP. (256x256x24) ... EVERY frame.

2> I use that bmap as the background bmap of a panel.
And I put a 32bit button on this panel too. (256x256x32)

3> I capture this panel.target_map into another 256x256x24 BMAP.

4> This bmap is then used as the BMAP of a new visible panel.

So, in essence, this is a single MANUAL render chain.
I THINK it could be described that way...


Now my problem begins...

What I WANT to do is use the OVERLAY flag to to chop away the
BLACK pixels, and I would also LIKE to alpha-fade the rest.

Ive got the translucent to work on its own, but I'll be damned
if I can get the OVERLAY to work at all!
Ive tried it without the transparency included but still cant
get the overlay to function at all. I suspect it is the
fact that render-targets APPARENTLY have a different format?


Any suggestions anyone?


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: render-targets dont work with OVERLAY ?!? [Re: EvilSOB] #412431
11/27/12 12:02
11/27/12 12:02
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline OP
Expert
EvilSOB  Offline OP
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Bump?

Even if it is just to verify my assumptions...


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: render-targets dont work with OVERLAY ?!? [Re: EvilSOB] #412435
11/27/12 12:58
11/27/12 12:58
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline
Senior Expert
HeelX  Offline
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
A bit more info would be cool. Are you using an 8888 rendertarget? Maybe could provide a small, minimal testscenario? Maybe it helps as well, if you clear the target_map before rendering into.

Last edited by HeelX; 11/27/12 13:00.
Re: render-targets dont work with OVERLAY ?!? [Re: HeelX] #412505
11/28/12 05:22
11/28/12 05:22
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline OP
Expert
EvilSOB  Offline OP
Expert

Joined: Feb 2008
Posts: 3,232
Australia
OK ... its taken a while, but here is the simplest demo I can come up with.

ONLY pay attention to the coding BETWEEN the lines full of "===".
The rest is code that is just to support the demo.
(This demo requires no external files, it is a purely stand-alone script)
AFAIK none of it should have any impact on my issue...

Click to reveal..
Code:
#include <acknex.h>
#include <default.c>
//
ENTITY* player_ent;
//
//
//===  Problem Area  ======================================================================
//
// declare workspace bmaps and view and controllers
//
BMAP*  mm_overlay      = "#256x256x32";	// actual FINAL bmap INTENDED for use as panel.bmap
														// in visible mini_map panel with OVERLAY set ON
//
VIEW*  mm_stage1 = { pan=90; tilt=-90; arc=135; bmap="#256x256x24"; flags=ISOMETRIC;	}
//
BMAP*  mm_overlay_butt = "#256x256x32";	//normally "mm_overlay_art.TGA"
PANEL* mm_stage2 = { button(0,0, mm_overlay_butt,mm_overlay_butt,NULL,NULL,NULL,NULL);	}
//
PANEL* mini_map =	{ alpha=75;		flags= TRANSLUCENT | SHOW; /* | OVERLAY; */ 				}
//
// START minimap render processes
//
void mini_map_startup()
{	
	mm_stage2.bmap  		= mm_stage1.bmap;		//render stage1 onto background of stage2
	mm_stage2.target_map = mm_overlay;			//render stage2 output to BMAP 'mm_overlay'
	mini_map.bmap 			= mm_overlay;			//apply BMAP 'mm_overlay' as background of mini_map
	//
	wait(1);		// //PAUSE to allow renderchain to initialise in correct order (it APPEARS)
	set(mm_stage1, SHOW);	set(mm_stage2, SHOW);
	//
	while(1)
	{	if(player_ent!=NULL)
		{	
			// keep mini-map aligned in top-right corner
			mini_map.pos_x = screen_size.x - mini_map.size_x;
			//
			// move stage1(view) around to it follows the player
			vec_set(mm_stage1.x, player_ent.x);		mm_stage1.z = 1000;
		}
		wait(1);
		bmap_fill(mm_overlay, COLOR_BLACK, 100);		// as per Heelx's suggestion... no change
}	}
//
//
//=========================================================================================
//
//
void mm_overlay_butt_startup()		// FABRICATE an SAMPLE overlay-artwork for DEMO ONLY
{	wait(1);		var x,y, xx,yy, tmp, fmt=bmap_lock(mm_overlay_butt,0);
	var opaque = pixel_for_vec(COLOR_BLACK, 100, fmt);
	var border = pixel_for_vec(COLOR_BLUE,   50, fmt);
	var clear  = pixel_for_vec(COLOR_WHITE,   0, fmt);
	var center = mm_overlay_butt.width/2;
	for(x=0; x<mm_overlay_butt.width; x++)		for(y=0; y<mm_overlay_butt.height; y++)
	{	pixel_to_bmap(mm_overlay_butt, x,y, opaque);
		if			(sqrt(pow(x-center,2)+pow(y-center,2))<(center-3))
		{	pixel_to_bmap(mm_overlay_butt, x,y, clear);						}
		else if	(sqrt(pow(x-center,2)+pow(y-center,2))<(center-0))
		{	pixel_to_bmap(mm_overlay_butt, x,y, border);						}					}
	bmap_unlock(mm_overlay_butt);
}
//
//
void main()		// nothing in MAIN is important, it is just to create a DEMO environment.
{
	video_mode = 7;		wait(1);				level_load(NULL);		wait(1);		sun_light=25;
	vec_set(camera.x, vector(-100,-500,500));	vec_set(camera.pan, vector(75,-45,0));
	draw_textmode("Times",0,32,100);
	//--------------------------------------------------------------------------------------
	//
	you = ent_create(CUBE_MDL, vector(000,000,-100), NULL);	set(you, LIGHT);	
		vec_fill(you.blue, 15);		vec_set(you.scale_x, vector(51,51,2));
	you = ent_create(CUBE_MDL, vector(400,000,0), 	NULL);	set(you, LIGHT);	
		vec_fill(you.blue, 15);		vec_set(you.scale_x, vector(1,51,10));
	you = ent_create(CUBE_MDL, vector(000,400,0), 	NULL);	set(you, LIGHT);	
		vec_fill(you.blue, 15);		vec_set(you.scale_x, vector(51,1,10));
	you = ent_create(CUBE_MDL, vector(-400,000,0), 	NULL);	set(you, LIGHT);	
		vec_fill(you.blue, 15);		vec_set(you.scale_x, vector(1,51,10));
	you = ent_create(CUBE_MDL, vector(000,-400,0), 	NULL);	set(you, LIGHT);	
		vec_fill(you.blue, 15);		vec_set(you.scale_x, vector(51,1,10));
	you = ent_create(CUBE_MDL, vector(175, 175,0), 	NULL);	set(you, LIGHT);	
		vec_fill(you.blue, 15);		vec_set(you.scale_x, vector(27,1,10));
	you = ent_create(CUBE_MDL, vector(-175,-175,0), NULL);	set(you, LIGHT);	
		vec_fill(you.blue, 15);		vec_set(you.scale_x, vector(27,1,10));
	you = ent_create(CUBE_MDL, vector(175,-175,0), 	NULL);	set(you, LIGHT);	
		vec_fill(you.blue, 15);		vec_set(you.scale_x, vector(1,27,10));
	you = ent_create(CUBE_MDL, vector(-175,175,0),	NULL);	set(you, LIGHT);
		vec_fill(you.blue, 15);		vec_set(you.scale_x, vector(1,27,10));
	//
	// Create Player Entity
	player_ent = ent_create(SPHERE_MDL, nullvector, NULL);	set(player_ent, LIGHT);
		vec_set(player_ent.blue, COLOR_GREEN);	vec_fill(player_ent.scale_x, 2);
	//
	// Create Other Entities
	ENTITY* blob[4];
	blob[0] = ent_create(SPHERE_MDL, vector(250,250,0), NULL);	set(blob[0], LIGHT);
	blob[1] = ent_create(SPHERE_MDL, vector(-250,250,0), NULL);	set(blob[1], LIGHT);
	blob[2] = ent_create(SPHERE_MDL, vector(-250,-250,0), NULL);set(blob[2], LIGHT);
	blob[3] = ent_create(SPHERE_MDL, vector(250,-250,0), NULL);	set(blob[3], LIGHT);
	//
	//--------------------------------------------------------------------------------------
	//
	while(1)
	{
		//move entity about
		player_ent.x += (key_d-key_a)*time_step*15;	player_ent.x=clamp(player_ent.x,-375,375);
		player_ent.y += (key_w-key_s)*time_step*15;	player_ent.y=clamp(player_ent.y,-375,375);
		//
		//move blobs about randomly
		int i;	for(i=0; i<4; i++)	
		{	vec_set(blob[i].blue, COLOR_RED);	vec_fill(blob[i].scale_x, 2.5+random(1));
			blob[i].x += (random(10)-5)*time_step*5;
			if((abs(blob[i].x)-250)>50)	blob[i].x = sign(blob[i].x)*300;
			if((abs(blob[i].x)-250)<-50)	blob[i].x = sign(blob[i].x)*200;
			blob[i].y += (random(10)-5)*time_step*5;	
			if((abs(blob[i].y)-250)>50)	blob[i].y = sign(blob[i].y)*300;
			if((abs(blob[i].y)-250)<-50)	blob[i].y = sign(blob[i].y)*200;						}
		//
		wait(1);
	}
}

I tried your suggestion HeelX, with several variants, but to no avail...

Thanks guys...


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: render-targets dont work with OVERLAY ?!? [Re: EvilSOB] #412509
11/28/12 09:09
11/28/12 09:09
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline
Senior Expert
HeelX  Offline
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
Hm, I also don't get it to run. I guess you want to apply that lens effect to your minimap, right? Since you are saying in your signature that you have A8.30.5 Commercial, why don't you use bmap_process and render zero-Alpha on those pixels you want to clip? Might be the easier way.

Re: render-targets dont work with OVERLAY ?!? [Re: HeelX] #412510
11/28/12 09:25
11/28/12 09:25
Joined: Feb 2010
Posts: 320
TANA/Madagascar
3dgs_snake Offline
Senior Member
3dgs_snake  Offline
Senior Member

Joined: Feb 2010
Posts: 320
TANA/Madagascar
That was exactly what I tried to achieve. I think that the black is not completely black grin

Code:
#include <acknex.h>
#include <default.c>


MATERIAL* mtlTransp = { // transparent black
  effect = "
  Texture TargetMap; // source bitmap
  sampler2D smpSrc = sampler_state { texture = <TargetMap>; };
          
  float4 process_transparent(float2 Tex: TEXCOORD0): COLOR 
  {
    float4 Color = tex2D( smpSrc, Tex.xy);
    if (Color.r <= 0.004 && Color.g <= 0.004 && Color.b <= 0.004)
    {
       Color.a = 0;  
    }
    return Color;
  }

  technique Transp {
    pass p1 {
      AlphaBlendEnable = false;  
      PixelShader = compile ps_2_0 process_transparent();
    }
  }   
  ";
}

//
ENTITY* player_ent;
//
//
//===  Problem Area  ======================================================================
//
// declare workspace bmaps and view and controllers
//
BMAP*  mm_overlay      = "#256x256x32";	// actual FINAL bmap INTENDED for use as panel.bmap
														// in visible mini_map panel with OVERLAY set ON
BMAP* mm_overlay2      = "#256x256x32";   // Processed BMAP
//
VIEW*  mm_stage1 = { pan=90; tilt=-90; arc=135; bmap="#256x256x16"; flags=ISOMETRIC;	}
//
BMAP*  mm_overlay_butt = "#256x256x32";	//normally "mm_overlay_art.TGA"
PANEL* mm_stage2 = { button(0,0, mm_overlay_butt,mm_overlay_butt,NULL,NULL,NULL,NULL);	}
//
PANEL* mini_map =	{ alpha=75;		flags= SHOW | OVERLAY; /*| OVERLAY; */ 				}
//
// START minimap render processes
//
void mini_map_startup()
{	
	mm_stage2.bmap  		= mm_stage1.bmap;		//render stage1 onto background of stage2
	mm_stage2.target_map = mm_overlay;			//render stage2 output to BMAP 'mm_overlay'
	mini_map.bmap 			= mm_overlay2;			//apply BMAP 'mm_overlay' as background of mini_map
	//
	wait(1);		// //PAUSE to allow renderchain to initialise in correct order (it APPEARS)
	set(mm_stage1, SHOW);	set(mm_stage2, SHOW);
	//
	while(1)
	{	if(player_ent!=NULL)
		{	
			// keep mini-map aligned in top-right corner
			mini_map.pos_x = screen_size.x - mini_map.size_x;
			//
			// move stage1(view) around to it follows the player
			vec_set(mm_stage1.x, player_ent.x);		mm_stage1.z = 1000;
		}
		wait(1);
		//bmap_fill(mm_overlay, COLOR_BLACK, 100);		// as per Heelx's suggestion... no change
		bmap_process(mm_overlay2, mm_overlay, mtlTransp);
}	}
//
//
//=========================================================================================
//
//
void mm_overlay_butt_startup()		// FABRICATE an SAMPLE overlay-artwork for DEMO ONLY
{	wait(1);		var x,y, xx,yy, tmp, fmt=bmap_lock(mm_overlay_butt,0);
	var opaque = pixel_for_vec(COLOR_BLACK, 100, fmt);
	var border = pixel_for_vec(COLOR_BLUE,   50, fmt);
	var clear  = pixel_for_vec(COLOR_WHITE,   0, fmt);
	var center = mm_overlay_butt.width/2;
	for(x=0; x<mm_overlay_butt.width; x++)		for(y=0; y<mm_overlay_butt.height; y++)
	{	pixel_to_bmap(mm_overlay_butt, x,y, opaque);
		if			(sqrt(pow(x-center,2)+pow(y-center,2))<(center-3))
		{	pixel_to_bmap(mm_overlay_butt, x,y, clear);						}
		else if	(sqrt(pow(x-center,2)+pow(y-center,2))<(center-0))
		{	pixel_to_bmap(mm_overlay_butt, x,y, border);						}					}
	bmap_unlock(mm_overlay_butt);
}
//
//
void main()		// nothing in MAIN is important, it is just to create a DEMO environment.
{
	video_mode = 7;		wait(1);				level_load(NULL);		wait(1);		sun_light=25;
	vec_set(camera.x, vector(-100,-500,500));	vec_set(camera.pan, vector(75,-45,0));
	draw_textmode("Times",0,32,100);
	//--------------------------------------------------------------------------------------
	//
	you = ent_create(CUBE_MDL, vector(000,000,-100), NULL);	set(you, LIGHT);	
		vec_fill(you.blue, 15);		vec_set(you.scale_x, vector(51,51,2));
	you = ent_create(CUBE_MDL, vector(400,000,0), 	NULL);	set(you, LIGHT);	
		vec_fill(you.blue, 15);		vec_set(you.scale_x, vector(1,51,10));
	you = ent_create(CUBE_MDL, vector(000,400,0), 	NULL);	set(you, LIGHT);	
		vec_fill(you.blue, 15);		vec_set(you.scale_x, vector(51,1,10));
	you = ent_create(CUBE_MDL, vector(-400,000,0), 	NULL);	set(you, LIGHT);	
		vec_fill(you.blue, 15);		vec_set(you.scale_x, vector(1,51,10));
	you = ent_create(CUBE_MDL, vector(000,-400,0), 	NULL);	set(you, LIGHT);	
		vec_fill(you.blue, 15);		vec_set(you.scale_x, vector(51,1,10));
	you = ent_create(CUBE_MDL, vector(175, 175,0), 	NULL);	set(you, LIGHT);	
		vec_fill(you.blue, 15);		vec_set(you.scale_x, vector(27,1,10));
	you = ent_create(CUBE_MDL, vector(-175,-175,0), NULL);	set(you, LIGHT);	
		vec_fill(you.blue, 15);		vec_set(you.scale_x, vector(27,1,10));
	you = ent_create(CUBE_MDL, vector(175,-175,0), 	NULL);	set(you, LIGHT);	
		vec_fill(you.blue, 15);		vec_set(you.scale_x, vector(1,27,10));
	you = ent_create(CUBE_MDL, vector(-175,175,0),	NULL);	set(you, LIGHT);
		vec_fill(you.blue, 15);		vec_set(you.scale_x, vector(1,27,10));
	//
	// Create Player Entity
	player_ent = ent_create(SPHERE_MDL, nullvector, NULL);	set(player_ent, LIGHT);
		vec_set(player_ent.blue, COLOR_GREEN);	vec_fill(player_ent.scale_x, 2);
	//
	// Create Other Entities
	ENTITY* blob[4];
	blob[0] = ent_create(SPHERE_MDL, vector(250,250,0), NULL);	set(blob[0], LIGHT);
	blob[1] = ent_create(SPHERE_MDL, vector(-250,250,0), NULL);	set(blob[1], LIGHT);
	blob[2] = ent_create(SPHERE_MDL, vector(-250,-250,0), NULL);set(blob[2], LIGHT);
	blob[3] = ent_create(SPHERE_MDL, vector(250,-250,0), NULL);	set(blob[3], LIGHT);
	//
	//--------------------------------------------------------------------------------------
	//
	while(1)
	{
		//move entity about
		player_ent.x += (key_d-key_a)*time_step*15;	player_ent.x=clamp(player_ent.x,-375,375);
		player_ent.y += (key_w-key_s)*time_step*15;	player_ent.y=clamp(player_ent.y,-375,375);
		//
		//move blobs about randomly
		int i;	for(i=0; i<4; i++)	
		{	vec_set(blob[i].blue, COLOR_RED);	vec_fill(blob[i].scale_x, 2.5+random(1));
			blob[i].x += (random(10)-5)*time_step*5;
			if((abs(blob[i].x)-250)>50)	blob[i].x = sign(blob[i].x)*300;
			if((abs(blob[i].x)-250)<-50)	blob[i].x = sign(blob[i].x)*200;
			blob[i].y += (random(10)-5)*time_step*5;	
			if((abs(blob[i].y)-250)>50)	blob[i].y = sign(blob[i].y)*300;
			if((abs(blob[i].y)-250)<-50)	blob[i].y = sign(blob[i].y)*200;						}
		//
		wait(1);
	}
}


Last edited by 3dgs_snake; 11/28/12 09:27.
Re: render-targets dont work with OVERLAY ?!? [Re: 3dgs_snake] #412537
11/28/12 17:46
11/28/12 17:46
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
An isometric view gives the chance to compute the render target pixel coordinates very easily, and apply a mask directly in the first pass.

Click to reveal..

example:
Code:
#include <acknex.h>
#include <default.c>

ENTITY* player_ent;

BMAP*  mm_overlay_butt = "#256x256x32";	//normally "mm_overlay_art.TGA"
BMAP*  bmpMinimap = "#256x256x32";

MATERIAL *mtlMinimap =
{
	skin1 = mm_overlay_butt;
	
	effect = "
		const float4x4 matWorldViewProj;
		float4 vecColor, vecSunDir, vecAmbient;
		
		texture mtlSkin1;
		sampler MaskSampler = sampler_state { Texture = <mtlSkin1>; };
		
		void VS (
			in float4 inPos: POSITION,
			in float3 inNormal : NORMAL,
			out float4 outPos: POSITION,
			out float2 outScreen: TEXCOORD0,
			out float3 outNormal: TEXCOORD1 )
			{
				outPos = mul( inPos, matWorldViewProj );
				outScreen = ( outPos.xy * 0.5f ) - 0.5f;
				outNormal = inNormal;
			}
		
		void PS (
			in float2 inScreen: TEXCOORD0,
			in float3 inNormal: TEXCOORD1,
			out float4 Color0 : COLOR0 )
			{
				float fDiffuse = saturate ( dot ( -vecSunDir.xyz, inNormal ) ) + vecAmbient.w;
				float Mask = tex2D ( MaskSampler, inScreen ).r;
				Color0.rgb = vecColor.rgb * fDiffuse;
				Color0.a = Mask;
			}
		
		technique tech
		{
			pass p0
			{
				VertexShader = compile vs_2_0 VS();
				PixelShader  = compile ps_2_0 PS();
			}
		
		}

	";
}

VIEW*  mm_stage1 = { bmap=bmpMinimap; material=mtlMinimap; pan=90; tilt=-90; arc=115; flags=ISOMETRIC;	}
PANEL* mini_map =	{ bmap=bmpMinimap; }

void mm_overlay_butt_startup()		// FABRICATE an SAMPLE overlay-artwork for DEMO ONLY
{	wait(1);		var x,y, xx,yy, tmp, fmt=bmap_lock(mm_overlay_butt,0);
	var opaque = pixel_for_vec(vector(255,255,255), 100, fmt);
	var border = pixel_for_vec(vector(128,128,128),   100, fmt);
	var clear  = pixel_for_vec(vector(0,0,0),   100, fmt);
	var center = mm_overlay_butt.width/2;
	for(x=0; x<mm_overlay_butt.width; x++)		for(y=0; y<mm_overlay_butt.height; y++)
	{	if	(sqrt(pow(x-center,2)+pow(y-center,2))>center)
		{	pixel_to_bmap(mm_overlay_butt, x,y, clear);						}
		else if	(sqrt(pow(x-center,2)+pow(y-center,2))>(center-6))
		{	pixel_to_bmap(mm_overlay_butt, x,y, border);						}
		else { 	pixel_to_bmap(mm_overlay_butt, x,y, opaque); }
	}
	bmap_unlock(mm_overlay_butt);
}

//
// START minimap render processes
//
//
void main()		// nothing in MAIN is important, it is just to create a DEMO environment.
{
	video_mode = 7;		wait(1);				level_load(NULL);		wait(1);		sun_light=25;
	vec_set(camera.x, vector(-100,-500,500));	vec_set(camera.pan, vector(75,-45,0));
	draw_textmode("Times",0,32,100);
	//--------------------------------------------------------------------------------------
	//
	you = ent_create(CUBE_MDL, vector(000,000,-100), NULL);	set(you, LIGHT);	
		vec_fill(you.blue, 128);		vec_set(you.scale_x, vector(51,51,2));
	you = ent_create(CUBE_MDL, vector(400,000,0), 	NULL);	set(you, LIGHT);	
		vec_fill(you.blue, 128);		vec_set(you.scale_x, vector(1,51,10));
	you = ent_create(CUBE_MDL, vector(000,400,0), 	NULL);	set(you, LIGHT);	
		vec_fill(you.blue, 128);		vec_set(you.scale_x, vector(51,1,10));
	you = ent_create(CUBE_MDL, vector(-400,000,0), 	NULL);	set(you, LIGHT);	
		vec_fill(you.blue, 128);		vec_set(you.scale_x, vector(1,51,10));
	you = ent_create(CUBE_MDL, vector(000,-400,0), 	NULL);	set(you, LIGHT);	
		vec_fill(you.blue, 128);		vec_set(you.scale_x, vector(51,1,10));
	you = ent_create(CUBE_MDL, vector(175, 175,0), 	NULL);	set(you, LIGHT);	
		vec_fill(you.blue, 128);		vec_set(you.scale_x, vector(27,1,10));
	you = ent_create(CUBE_MDL, vector(-175,-175,0), NULL);	set(you, LIGHT);	
		vec_fill(you.blue, 128);		vec_set(you.scale_x, vector(27,1,10));
	you = ent_create(CUBE_MDL, vector(175,-175,0), 	NULL);	set(you, LIGHT);	
		vec_fill(you.blue, 128);		vec_set(you.scale_x, vector(1,27,10));
	you = ent_create(CUBE_MDL, vector(-175,175,0),	NULL);	set(you, LIGHT);
		vec_fill(you.blue, 128);		vec_set(you.scale_x, vector(1,27,10));
	//
	// Create Player Entity
	player_ent = ent_create(SPHERE_MDL, nullvector, NULL);	set(player_ent, LIGHT);
		vec_set(player_ent.blue, vector(0,128,0));	vec_fill(player_ent.scale_x, 2);
	//
	// Create Other Entities
	ENTITY* blob[4];
	blob[0] = ent_create(SPHERE_MDL, vector(250,250,0), NULL);	set(blob[0], LIGHT);
	blob[1] = ent_create(SPHERE_MDL, vector(-250,250,0), NULL);	set(blob[1], LIGHT);
	blob[2] = ent_create(SPHERE_MDL, vector(-250,-250,0), NULL);set(blob[2], LIGHT);
	blob[3] = ent_create(SPHERE_MDL, vector(250,-250,0), NULL);	set(blob[3], LIGHT);
	//
	//--------------------------------------------------------------------------------------
	//
	
	
	
	camera.ambient = -100;
	
	wait(1);		// //PAUSE to allow renderchain to initialise in correct order (it APPEARS)
	set(mm_stage1, SHOW);
	set(mini_map, SHOW);

	
	
	
	while(1)
	{
		//move entity about
		player_ent.x += (key_d-key_a)*time_step*15;	player_ent.x=clamp(player_ent.x,-375,375);
		player_ent.y += (key_w-key_s)*time_step*15;	player_ent.y=clamp(player_ent.y,-375,375);
		//
		//move blobs about randomly
		int i;	for(i=0; i<4; i++)	
		{	vec_set(blob[i].blue, vector(0,0,128));	vec_fill(blob[i].scale_x, 2.5+random(1));
			blob[i].x += (random(10)-5)*time_step*5;
			if((abs(blob[i].x)-250)>50)	blob[i].x = sign(blob[i].x)*300;
			if((abs(blob[i].x)-250)<-50)	blob[i].x = sign(blob[i].x)*200;
			blob[i].y += (random(10)-5)*time_step*5;	
			if((abs(blob[i].y)-250)>50)	blob[i].y = sign(blob[i].y)*300;
			if((abs(blob[i].y)-250)<-50)	blob[i].y = sign(blob[i].y)*200;						}
		//
		
		
		mini_map.pos_x = screen_size.x - mini_map.size_x;
		//
		// move stage1(view) around to it follows the player
		vec_set(mm_stage1.x, player_ent.x);		mm_stage1.z = 1000;
		
		
		wait(1);
	}
}



Re: render-targets dont work with OVERLAY ?!? [Re: txesmi] #412558
11/29/12 01:20
11/29/12 01:20
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline OP
Expert
EvilSOB  Offline OP
Expert

Joined: Feb 2008
Posts: 3,232
Australia
3dgs_snake:: Yeah, the demo wasnt TRUE black because I was using COLOR_BLACK
instead of nullvector in the overlay_button bmap-simulator...

Ive now fixed that, and adjusted your PP-shader and it displays what I wanted
perfectly... BUT ... I am HOPING to achieve this result without a shader
IF POSSIBLE. Otherwise I will probably go with your solution.
(yes .. I consider a bmap_process to be a shader... but thats just me)

Thanks for giving me a functional 'fall-back' process that works though!


txesmi:: interesting solution that will definately got into my snippet archives.
But unfortunately no good in this instance.
I cant use a 'formula' to generate the transparency as the 'overlay' is
NORMALLY retrieved from an external 32_bit TGA, so the resulting panel will
not necessarily be a perfect circle, or any 'perfect' shape that can be formula-ized.

But this solution is certainly helpful with my shader-learning needs... Thanks.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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