Some sprites question.

edited August 2013 in Help request
I have two simple questions:

1) What is better to use, a single sprite with many objects (such as the soldier one from the examples) or several files, each with a single sprite?

2) Is it possible to set a color to be transparent? For instance, this image: http://th07.deviantart.net/fs71/200H/f/2013/030/a/c/free_radical_game_sprites__attempt__by_demonhuntrpg-d5tbcs4.png

Could I set the greenish background to be transparent?

Thanks in advance.

Comments

  • edited August 2013
    Knolan wrote:
    I have two simple questions:

    1) What is better to use, a single sprite with many objects (such as the soldier one from the examples) or several files, each with a single sprite?
    All the sprites on the same texture brings better performance. This allows orx to batch rendering calls.
    2) Is it possible to set a color to be transparent? For instance, this image: http://th07.deviantart.net/fs71/200H/f/2013/030/a/c/free_radical_game_sprites__attempt__by_demonhuntrpg-d5tbcs4.png

    Could I set the greenish background to be transparent?
    Yes, and there are a few different ways of doing so. The best way would be to modify your image offline, add an alpha layer if there's none, and use the green color to create the alpha mask (I suspect there are many tutorials on the net for doing this).

    If you don't want to modify your resource offline, you can either use a custom shader that will output a fully transparent pixel (alpha = 0) if the color matches the green one or you can modify the texture when it's loaded (there's an event for that, listen for it, then gets the texture content with orxDisplay_GetBitmapData, modify it to set the alpha to zero when a pixel is green, and pushes the data back to the texture with orxDisplay_SetBitmapData).

    I'd go with them in this order. :)
    Thanks in advance.
    My pleasure!
  • edited August 2013
    Thanks iarwain, as I said in my former topic, I am developing some tools to use in a project, I am nearly finished with my scene editor (need to export for orx yet), but since most sprites on the internet are not parted nor transparent I am also creating a module to part those images for me.

    Those are bad news for me, as I was creating several small images =p
    Ok, back to coding, thanks again.
  • edited August 2013
    Knolan wrote:
    Those are bad news for me, as I was creating several small images =p

    Well, it's probably that, unless you render hundreds of objects at once, you won't really notice the difference on current hardware. :)

    Unless you're targeting iOS/Android, in which case it's possible that batching will have some tangible performance impact.
    Ok, back to coding, thanks again.

    My pleasure! Looking forward to seeing your editor. :)
  • edited August 2013
    Since you said you wanted to see it, here it is. Still need some better UI and I need to find a way to import it the scene editor, but it parts sprites and let you add an alpha.

    Here is the first partition mode. You tell the program where to begin and the size of the tiles:

    https://docs.google.com/file/d/0B0UdeUM9pB-nc0p2WnMzWmRCZU0/edit?usp=sharing

    Second mode (the one used in the rest of the pictures), you tell how many partitions you want in each axis (in the case of this image, 12 per 8).
    https://docs.google.com/file/d/0B0UdeUM9pB-ncXNaSWRfbHU5U1U/edit?usp=sharing

    The result after the split:
    https://docs.google.com/file/d/0B0UdeUM9pB-naGs2TmFsQW9kSDg/edit?usp=sharing

    Exporting UI, you may click in the checkbox next to a image to add or remove it from the final image.
    https://docs.google.com/file/d/0B0UdeUM9pB-ncXZIdnpyMWctS3c/edit?usp=sharing

    Exporting UI after I clicked on one of the images, it selected the color of the pixel I clicked and set to the color it will assume to be the alpha = 0. Also I marked the checkbox that turn on the color to alpha option.
    https://docs.google.com/file/d/0B0UdeUM9pB-nZFBQbnE2MGViak0/edit?usp=sharing

    Final Result:
    https://docs.google.com/file/d/0B0UdeUM9pB-nQm1ZR2tzX0VlZUE/edit?usp=sharing

    Important notice: I found this image on google, I used it to test the program, I have no copyrights over it. It is from some of the Tales series games, so all the copyrights of this picture belong to Nanco.
  • edited August 2013
    Thanks for the screenshots and the details.

    I didn't think there were still old school sprite sheet using a color key for transparency out there!
Sign In or Register to comment.