Page 1 of 1

Semi Transparent Pixels in Sprites and/or Backgrounds?

Posted: Tue Jan 06, 2009 7:39 am
by olwildcory723
Hi all! New to the forums here. Was going to jump into PA Lib, but wintermute convinced me to join the dark side.

Anyway, I've been doing all Patater's Tutorials (thanks patater! way to keep your stuff up to date!--the hardest part about trying to learn NDS programming is all my resources are outdated or the technical jargon is explained by more technical jargon) and I've been trying to learn by playing with the examples included with the latest libnds.

My question is: Is there a way to have semi transparent pixels (alpha levels instead of on/off) in graphics or does the ds just not do this?

I've seen a similar effect in commercial games (Etrian Odyssey) but it could have been done in a graphics program on just one flattened background and not on the ds via layers.

Re: Semi Transparent Pixels in Sprites and/or Backgrounds?

Posted: Tue Jan 06, 2009 8:01 am
by Sylus101
I'm sure someone will correct me if I am mistaken, but AFAIK this is available with Sprites but not Backgrounds.

http://nocash.emubase.de/gbatek.htm#lcdobjoamattributes

For Attribute 0, bits 10-11 you can set it to be semi-transparent, but I can't find where to set it's value. If you look at the SimpleSprite example (updated for libnds 1.3.1) there are comments on the parameters for the oamSet() function, and this is included. It appears the sprite must be of the bmp and not tiled/palette type.

EDIT - And as a recommendation, Patater's tutorial is awesome, but take care that although it is compatible with the newest libnds, there are some new functions for handling sprites and backgrounds in libnds that aren't covered. Definitely explore the 2D Graphics examples for libnds included with devkitpro to see their usage.
Still, Patater's tutorial will be very helpful and you'll absolutely want to review the earlier parts of Dovoto's tutorial as there is some great hardware background information that you should really know even before using the newer functions. Best of luck, I'm new to libnds myself but have used PALib quite a bit.

Re: Semi Transparent Pixels in Sprites and/or Backgrounds?

Posted: Tue Jan 06, 2009 4:59 pm
by olwildcory723
Thanks for the info Sylus. If its possible, then the next thing is to figure out how. I'm hoping I'll just be able to do the bitmap in grit and that it can do the alpha levels, and then if the attributes are set right in oam, it should work right?

I've really enjoyed reading all your posts where you work through your problem/question -- that also definitely helps a newb like me. I actually have read like every tutorial out there, but I never know how outdated things are, etc. so it's hard to know what the good information is, and what isn't. I really wish there were some better resources that explained things in more depth and at a level easily understood....as I wish the examples explained every line with comments. Anyway, just makes my learning curve bigger, but I'll get there.

Re: Semi Transparent Pixels in Sprites and/or Backgrounds?

Posted: Tue Jan 06, 2009 7:00 pm
by Sylus101
Hey, thanks. I'm very glad to hear some of my efforts are helping someone else. I'm sort of an experienced PALib user that is tackling getting into libnds now that sprites and backgrounds have a bit more abstraction.

Check that same page I sent before for information on the BLDCNT (blend control). You'll find that quite a few things covered in the GBA section apply to NDS if not covered in the NDS section. The Background control registers are another good example.

I'm struggling a little bit with a few things, particularly with backgrounds, but Dovoto is answering things when he can so with patience we'll get this figured out. He is looking for input on how easy the new API is to learn so keep on posting. I'll try to field what I can as I go through the motions.

Read and re-read Dovoto's Days 2-4. Where I got hung up, particularly with different bg's using different vram, was not realizing the limitations of what could be stored where. When I jumped back into libnds, I naively thought, "Hey, look at all that VRAM! I can store this here, and this there and blah, blah, etc..." It's very important to understand how a couple of particular things work with respect to video modes, vram offsets and a few important register settings. I'm hoping to spend some time on my blog page going into great detail on it, as long as I can get some time to update it soon.