Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,649 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
bmap_blitpart + transparency (UNSOLVED) #425591
07/09/13 00:10
07/09/13 00:10
Joined: Nov 2007
Posts: 318
Brasil, Paraná
NeoNeper Offline OP
Senior Member
NeoNeper  Offline OP
Senior Member

Joined: Nov 2007
Posts: 318
Brasil, Paraná
Code:
//skin is the BTMAP of the terrain blendMap 
	...
	VECTOR* pos = terrain_pixel_for_pos(terrain,x,y,skin);
	var dx = 64 / PIXEL_DX(terrain,skin);
	
        bmap_blitpart(skin,brush_1, //tga with transparence
	vector(pos->x-dx,pos->y-dx,0),
        vector(2*dx,2*dx,0),
	NULL,NULL);



I'm using the function above, for Append the contents tga in another picture!


The problem is that I'm not managing to remove the background of the image that is being annexed.


LOOK:


PS:I am saving the image as tga with transparency, but no work
Someone would know me know where I am going wrong?

Last edited by NeoNeper; 07/11/13 13:56.

Please! Use easy words to be translated. because my English is not very good! Grateful.
_______________________________________________________
Re: bmap_blitpart + transparency [Re: NeoNeper] #425598
07/09/13 08:58
07/09/13 08:58
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
I don't think that transparency is supported, you have to code that yourself with pixel-instructions (or even a shader).
Maybe the panel.target_map feature supports transparency but I am not sure.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: bmap_blitpart + transparency [Re: Superku] #425613
07/09/13 11:36
07/09/13 11:36
Joined: Nov 2007
Posts: 318
Brasil, Paraná
NeoNeper Offline OP
Senior Member
NeoNeper  Offline OP
Senior Member

Joined: Nov 2007
Posts: 318
Brasil, Paraná
Complicated (T.T).
I thought that using this feature (bmap_blitpart), I would be able to implement different types of brushes in painting of the a blandMAP.
I currently use (terrain_setpixel), for paint a blendMAP of the terrain Mult Texture. I'm trying to implement the types of brushes, and for this reason I tried to use the function (bmap_blitpart).If i solved this problem with transparency, it would be a perfect technique and simple!


Please! Use easy words to be translated. because my English is not very good! Grateful.
_______________________________________________________
Re: bmap_blitpart + transparency [Re: NeoNeper] #425625
07/09/13 13:32
07/09/13 13:32
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
yeah, that would be nice, but it still is pretty slow (done on cpu) and has wrong filtering when scaling images...


POTATO-MAN saves the day! - Random
Re: bmap_blitpart + transparency [Re: Kartoffel] #425631
07/09/13 13:57
07/09/13 13:57
Joined: Nov 2007
Posts: 318
Brasil, Paraná
NeoNeper Offline OP
Senior Member
NeoNeper  Offline OP
Senior Member

Joined: Nov 2007
Posts: 318
Brasil, Paraná
for small application, as is the case with my editor that I've been working on my own game is a good solution. I observed no delay at runtime. The only drawback that prevents me from using it is the lack of transparency.


How else could I work to achieve this same goal? anyone have an idea?


Please! Use easy words to be translated. because my English is not very good! Grateful.
_______________________________________________________
Re: bmap_blitpart + transparency [Re: NeoNeper] #425635
07/09/13 14:38
07/09/13 14:38
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
What is wrong with my suggestion?


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: bmap_blitpart + transparency [Re: Superku] #425639
07/09/13 15:03
07/09/13 15:03
Joined: Nov 2007
Posts: 318
Brasil, Paraná
NeoNeper Offline OP
Senior Member
NeoNeper  Offline OP
Senior Member

Joined: Nov 2007
Posts: 318
Brasil, Paraná
LOl.
Nothing. (^.^).

Could you explain better how to work with target_map in this case?.
I can not understand how to apply here!.

As the option to Shader!
I believe it really is possible. I have great difficulty in working with shaders and not do the least idea where to start.

If you can show me some material practical for adapt, I would be grateful


Please! Use easy words to be translated. because my English is not very good! Grateful.
_______________________________________________________
Re: bmap_blitpart + transparency [Re: NeoNeper] #425642
07/09/13 15:10
07/09/13 15:10
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
A shader would use bmap_process but that's in your case not so easy for a shader newbie.

I suggest you use pixel instructions, it's straight forward and easy to implement.

The target_map approach would probably only support none/ full transparency because the bitmap/ panel gets written into the target each frame, thus it probably does not even support transparency at all.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: bmap_blitpart + transparency [Re: Superku] #425667
07/09/13 21:49
07/09/13 21:49
Joined: Nov 2007
Posts: 318
Brasil, Paraná
NeoNeper Offline OP
Senior Member
NeoNeper  Offline OP
Senior Member

Joined: Nov 2007
Posts: 318
Brasil, Paraná
I tried several ways but I am not succeeding!.
Seeing that no success trying to paint the blend Map using another patern figure, i decided paint, used pixel by pixel of the blendMap from coordinate of my mouse.
For Brush Size and Circle form i I made the following function.

Code:
var format = bmap_lock(skin,0);
	var i,j;
	for(j=0; j<skin->height; j++)
	for(i=0; i<skin->width; i++)
	{
		// read the pixel from the texture
		var pixel = pixel_for_bmap(skin,i,j);
		COLOR* csrc = pixel_to_vec(NULL,NULL,format,pixel);
		vec_normalize(csrc,255);
	
			if(vec_dist(terrain_pixel_to_pos(terrain,i,j,skin),_vec(TARGET.x,TARGET.y,0)) < 100)
			{
		
			csrc->red = 0;
			csrc->green = 255;
			csrc->blue = 255;
			pixel = pixel_for_vec(csrc,100,format);
			pixel_to_bmap(skin,i,j,pixel);
		}
	}
	bmap_unlock(skin);
{



this way I can paint map from the coordenada of my mouse, utilizando a fixed size and circular shape for painting. COOOL, But this function does not work well. She is too Slow because need read the entire map pixel by pixel to determine who need to be painted

Someone has a formula that works quickly?

Last edited by NeoNeper; 07/09/13 21:50.

Please! Use easy words to be translated. because my English is not very good! Grateful.
_______________________________________________________
Re: bmap_blitpart + transparency [Re: NeoNeper] #425668
07/09/13 22:04
07/09/13 22:04
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Calculate the pixels before you enter the loop, approximately as follows:

d = size*0.5 of decal to draw on terrain

get pos_x in 0..1 via terrain size (might not be defined, take care)
pos_x = (mouse.x-d-terrain.x+terrain.min_x)/(terrain.max_x-terrain.min_x);
pos_x *= bmap_width(terrain.skin);

get pos_x2 with "+d" for upper pixel limit
pos_x2 = (mouse.x+d-terrain.x+terrain.min_x)/(terrain.max_x-terrain.min_x);
pos_x2 *= bmap_width(terrain.skin);

same for pos_y

for(i = pos_x; i <= pos_x2; i++)
for(j = pos_y; j <= pos_y2; j++)
{
grab pixel at (i-pos_x)/(pos_x2-pos_x)*bmap_width(decal),(j-...);
write at i,j into terrain skin
}
}


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Page 1 of 2 1 2

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

Gamestudio download | 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