Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Sprite Alpha. What am I doing wrong?  (Read 6550 times)
0 Members and 1 Guest are viewing this topic.
Offline Dreamcatchermatt

Junior Devvie

« Posted 2011-01-13 22:59:30 »

Hi all,

Im taking a break from XNA (booo) Uni work to do some more Java Gaming.

I'm trying to make a isomorphic turret-defence using Slick2D and I think that I may have just kneecapped myself while making my Sprites. I spent 2 days doing these, so I hope i'm wrong Cheesy

Now, in XNA, and I was sure in Java2D, you can say that a color, say Color(255,45,255), is a chroma-key mask color, and anything with that will get removed. So, I went ahead and made a load of sprites like this:

Now that i've modeled and rendered all these things, I downloaded slick again and got going ... only to not be able to find a way of doing the above.

I realy dont want to re-render all of these things Cheesy

What am I doing wrong here?

Thanks guys,
Offline kappa
« League of Dukes »

JGO Kernel

Medals: 120
Projects: 15


« Reply #1 - Posted 2011-01-13 23:11:19 »

You could just open the images in something like gimp and choose 'Colour to Alpha' to quickly make the pink into alpha.
Not sure if slick has a built in api to do this.
Offline Riven

« JGO Overlord »

Medals: 1340
Projects: 4
Exp: 16 years

Hand over your head.

« Reply #2 - Posted 2011-01-13 23:16:16 »

Please post a PNG image, not a JPG.

Maybe with some crafty code, it can be fixed.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Dreamcatchermatt

Junior Devvie

« Reply #3 - Posted 2011-01-14 00:35:27 »

I've tried fixing them in photoshop, with no luck.

Sorry, I uploaded the image to a facebook gallery, which seems to have swapped it to a jpg.


I need to re-work my rendering I think. The reason that I did it this way is because I want the ambient occlusion 'shadows' from the ground plain (also pink) so that once it's tranceparrent I get just hte shadows, and not the pink.

However, now that I've had a think about it some more, I dont this that this would work as therea re gradients of pink that i would want to remove the pink from, just leaving the colored shadows.

I get the shadows and AND render an alpha chanel, because the ground plain needs to have ) alpha to receive the shadows, so I think I need to figure out a way to do this. I've tryed re-rendering onto a white ground plane, but with similar problems.

If there's a code way of doing it, it would be great Smiley
That way I can have my cake and eat it. I think I may have just made this way to complicated for myself.

Thanks for the help guys.
Offline Dreamcatchermatt

Junior Devvie

« Reply #4 - Posted 2011-01-14 01:59:09 »

Hah, I found out why I'm having troubble removing the pink in Photoshop. When the oclusion renders, it includes 10% of the (pink) background into the resulting color - which is why I cant get rid of the damn stuff without loosing my other colors Cheesy

Cool, I can now manualy remove the pink mask in PS while keeping my shadows.
Offline SwampChicken
« Reply #5 - Posted 2011-01-18 01:24:10 »

Can't you just swap the pink to be 'transparent'?
Offline jezek2
« Reply #6 - Posted 2011-01-18 02:57:50 »

I would rather re-render it with proper alpha instead of this "mask" mess, and forget about this "great" technique in future. There is problem also with antialiasing, not just the ambient in pink areas. You would get poor result if processed somehow to obtain the alpha channel directly from the image.

Also I see slight irregularity in the antialiasing along the walls, was the image scaled?
Offline Nate

« JGO Bitwise Duke »

Medals: 167
Projects: 4
Exp: 14 years

Esoteric Software

« Reply #7 - Posted 2011-01-18 04:11:55 »

Also I see slight irregularity in the antialiasing along the walls, was the image scaled?
* Nate squints
You see what?  Cheesy

Pages: [1]
  ignore  |  Print  

EgonOlsen (59 views)
2018-06-10 19:43:48

EgonOlsen (41 views)
2018-06-10 19:43:44

EgonOlsen (61 views)
2018-06-10 19:43:20

DesertCoockie (240 views)
2018-05-13 18:23:11

nelsongames (142 views)
2018-04-24 18:15:36

nelsongames (141 views)
2018-04-24 18:14:32

ivj94 (883 views)
2018-03-24 14:47:39

ivj94 (144 views)
2018-03-24 14:46:31

ivj94 (795 views)
2018-03-24 14:43:53

Solater (159 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!