Slick Forums

Discuss the Slick 2D Library
It is currently Fri May 24, 2013 11:05 pm

All times are UTC




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Idea: bitmap masks
PostPosted: Sat Jun 16, 2007 8:56 am 
Offline
Oldbie

Joined: Sat Nov 18, 2006 3:11 pm
Posts: 254
Location: Helsinki
For example, if you want to make a circular Radar like u can see in lot of games, u just apply a circular shape as a mask. For tiled terrain transitions it would be very fast and very nice looking, you would just have to draw your masks (all the different kinds of transition, for example a rounded shape for transition, or just a linear transition ,...) on photoshop or whatever then you can apply them on the first image (grass for example), then u draw the result on the second texture (stone for example) and you get easyly the expected transition.
If it's badly explained, here is what it looks when it is done tx to photoshop:
Image
Image
Image

That would incredibly save memory for tiled terrains and permit some things impossible to do like the circular radar.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 16, 2007 9:20 am 
Offline
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 3143
Alpha mapping, ok, tis a good idea. Anyone up for giving it a go? I can take it but the lead time is looking to be a while at this rate.

Kev


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 16, 2007 11:10 am 
Offline
Regular
User avatar

Joined: Mon Mar 05, 2007 11:05 pm
Posts: 111
Location: Burträsk, Norrland, Sweden
Would be great to see accually, I want to use alpha maps to controll light in my game, This will be a top layer on my tile map that will only use alpha maps, to this I want to be able to controll the color of the alpha, so that I can use different kinds of lights with the same alpha image.

So it wont be for transitions on the above example but just a way to at some places block the light and on some places enhance it, Would be coolt to be able to pic different kinds of blend mode to this as well, the GL blendmodes would be great to have!

Ok, here some sort of psudo code to explain the functions some:

Blend b = new Blend(color, BLEND_MODE);
alphamap.drawAlpha(x,y, b);
b.setColor(color);
b.setBlendMode(BLEND_MODE);

something like that hehe, dont know if you understand what I mean but im open for enquiering :P


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 16, 2007 9:03 pm 
Offline
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 3143
This just went in. In next build.

Image

EDIT: This is probably slightly more impressive:

Image

Code:
g.clearAlphaMap();
g.setDrawMode(Graphics.MODE_NORMAL);
textureMap.draw(10,50);
      
// write only alpha
g.setDrawMode(Graphics.MODE_ALPHA_MAP);
alphaMap.draw(300,50);
g.setDrawMode(Graphics.MODE_ALPHA_BLEND);
textureMap.draw(300,50);
g.setDrawMode(Graphics.MODE_NORMAL);


Kev


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 16, 2007 9:11 pm 
Offline
Oldbie

Joined: Sat Nov 18, 2006 3:11 pm
Posts: 254
Location: Helsinki
This is simply AMAZING.
Dunno whether it was hard to achieve that or not.
Anyway I'm really amazed :!:
Certainly a very useful feature.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 16, 2007 9:14 pm 
Offline
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 3143
Should note is puts an extra requirement on the opengl card for Slick, alpha in the frame-buffer. If that turns out to be an issue we'll have to rethink and maybe move to some other means of getting the same effect.

Kev


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 16, 2007 10:14 pm 
Offline
Regular
User avatar

Joined: Mon Mar 05, 2007 11:05 pm
Posts: 111
Location: Burträsk, Norrland, Sweden
Wow, now that's super sweet! I'll be ready to work on my lightning thingies when the next release is up then! Gr8 work kev!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 16, 2007 10:24 pm 
Offline
Oldbie

Joined: Sat Nov 18, 2006 3:11 pm
Posts: 254
Location: Helsinki
Quote:
Should note is puts an extra requirement on the opengl card for Slick, alpha in the frame-buffer. If that turns out to be an issue we'll have to rethink and maybe move to some other means of getting the same effect.


:o Is there any way to know if it's supported by the graphics card ?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 16, 2007 10:28 pm 
Offline
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 3143
It appears not - I've just added code that copes if it fails - and resets to normal. I can add an indicator to let you know if thats happened.

I've not seen a card that it fails on yet tho.

Only works for AppGameContainer at the moment - this is all still very new. Great effect though - good idea guys! :)

Kev


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group