Photoshit Question

Discussion in 'Game Development (Technical)' started by Applewood, Jan 2, 2009.

  1. Nutter2000

    Original Member Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    993
    Likes Received:
    3
    If I remember correctly proper 32bit TGA support was mysteriously dropped from Photoshit a few versions ago, although you could get a plugin to support it (at least a couple of versions ago).

    Apparently Adobe found out people were trying to make these things called "games" and decided they should stop that immediately :rolleyes:

    After several years in the past swearing at photostrop (I'm purely a programmer btw) whenever I had the misfortune to use it, I've now eventually switched to Gimp.
    Which is an open source photostrop wannabe but I managed to get the hang of it pretty quickly and there's a number of half-decent tutorials knocking around so you might want to give that a try Paul if you haven't already.

    My main irritation with it is that it uses a floating windows MDI style interface. Something which always annoys me when I see it in applications because I know I'm going to waste time bringing windows to the front when it should just be there when I need it!

    Iain
     
  2. Reactor

    Moderator Original Member Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    1,637
    Likes Received:
    0
    Okay, call me stupid but... why would anyone want to use a 32bit TGA image for game artwork?
     
  3. Applewood

    Moderator Original Member Indie Author

    Joined:
    Jul 29, 2004
    Messages:
    3,859
    Likes Received:
    2
    ok, you're stupid!

    Any format that supports 32 bit is required, right? TGA is the easiest to load in by a bloody mile. My entire loader is about 200 lines. LibPNG etc is about 200 files!
     
  4. Nikster

    Original Member

    Joined:
    Jul 27, 2004
    Messages:
    698
    Likes Received:
    0
    clicky might have what you need, the pico stuff especially, problem with png compared to tga is that png's can be huffmanized, interlaced etc etc, if you took the root balls out and assume it's going to be raw data (not compressed or other farty stuff) a loader wouldn't be to far different from a tga loader, but generally libs need to be as compatible as possible hence all the added shit which us programmers tend not to use.
     
  5. Applewood

    Moderator Original Member Indie Author

    Joined:
    Jul 29, 2004
    Messages:
    3,859
    Likes Received:
    2
    Wow, that's dead on. Thanks muchly :)
     
  6. Sol_HSA

    Indie Author

    Joined:
    Feb 27, 2005
    Messages:
    470
    Likes Received:
    1
    Tapwave Zodiac had a force feedback feature, where you could turn the rumble on and off. Problem was, there was only "on" and "off", and we really needed more steps than that. Plus side was that you could turn it "on" or "off" once per 10ms (iirc).

    So I created a horizontal grey gradient and converted that to b/w using heavy random dither, and got a rather decent pattern I could sample. Then, when a game wanted a force feedback of strength N, I'd just pick 8 samples from that image with the offset of N, and let it fly.

    I did have to go in and fix a couple pixels here and there so that there wasn't any weird groupings of 1's near the 0-end or 0's near the 1-end, but anyway.

    Worked beautifully.

    On the subject of libpng being horrible, here's a very nice lightweight zlib and libpng implementation that's also under a very liberal license.
     
  7. Applewood

    Moderator Original Member Indie Author

    Joined:
    Jul 29, 2004
    Messages:
    3,859
    Likes Received:
    2
    Thanks for the link. That looks like the best one yet :)
     
  8. Jim Buck

    Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    1,158
    Likes Received:
    0
    Heh, I would say that's more you solving a force-feedback problem than Photoshop. :)

    On the topic of .png code, PopCap framework has just a handful of source files for .png decoding.
     
  9. Reactor

    Moderator Original Member Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    1,637
    Likes Received:
    0
    Thanks! :p

    Yes, but png is worth the trouble :)
     
  10. Nutter2000

    Original Member Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    993
    Likes Received:
    3
    Depends on whether size of download or speed of loading is the bigger issue.

    Incidently has anyone else ever tried to implement LibMng?
    Thats the animated version of png, I had to do that during the gif-copyright problems a few years back, if you like pain, that's the wait to go ;)

    Iain
     
  11. lobotony

    lobotony New Member

    Joined:
    Mar 10, 2008
    Messages:
    37
    Likes Received:
    0
    You should also take a look at stb_image , reads bmp, png, tga, jpeg, hdr, psd, writes tga/bmp, all in one c file. While it doesn't like all files and formats from every program, it's very compact and simple to use.
    There's also an ogg vorbis decoder by the same guy.
     
  12. Applewood

    Moderator Original Member Indie Author

    Joined:
    Jul 29, 2004
    Messages:
    3,859
    Likes Received:
    2
    Thanks, but Luggage already pointed me in that direction.

    Since looking at that, I think the lodepng will be more suitable for my case. When I get time I'm going to give these a whirl.
     
  13. ChrisP

    Indie Author

    Joined:
    Feb 5, 2007
    Messages:
    971
    Likes Received:
    0
    I found that virtual desktops solved this problem to my satisfaction. Stick Gimp on its own virtual desktop and arrange your windows nicely and you don't have to think about window focus as much.
     
  14. Reactor

    Moderator Original Member Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    1,637
    Likes Received:
    0
    No it doesn't- just learn to balance your use of jpegs and pngs throughout your game. You can put out a heavily graphical game and keep the file size pretty darn small these days.
     
  15. Bad Sector

    Original Member

    Joined:
    May 28, 2005
    Messages:
    2,742
    Likes Received:
    5
    GIMP is mostly a X program, so yes it was designed with virtual desktops in mind. Virtual desktops are very helpful because you can separate the windows in "groups", like this desktop is for internet stuff, this desktop is for the compiler/ide, this desktop is for the documentation, this desktop is for gimp :), etc. Its a Good Thing and Apple realised it by adding it in Leopard as 'Spaces' (not sure how good their implementation is though). Using virtuawin adds this flexibility to Windows too.

    This is my Ubuntu setup with GIMP and how i usually use GIMP. Also in the image you can see Applewood's psd file edited to use the alpha channel and as a bonus the alpha in a separate window.

    Just to be complete in this thread (and to make sure everyone understands i'm a GIMP fanboy :), here is how to do it in GIMP:

    Alpha from channel
    1. From the Layers tab (Ctrl+L) right click on the layer which you want to edit.
    2. Select Add Layer Mask and from the Initialize Layer Mask to select the Channel option. From the combo box select the channel that contains the transparency information.
    3. Press Add.
    4. Right click on the layer again and select Apply Layer Mask.

    Edit a non-RGB channel
    1. From the Channels tab (should be at the right side of the Layers tab, if not click on the little left arrow at the right side of the window and from Add tab select Channels) right click on the channel you want to edit.
    2. Select Channel to Selection.
    3. Enter in Quick mask mode (this mode allows you to edit the selection buffer as if it is an image). To do this press the red square button at the bottom left side, select Toggle Quick Mask from the Select menu or simply press Shift+Q.
    4. Copy (Ctrl+C).
    5. Paste the copied buffer in a new image. To do this select Edit -> Paste as -> New Image or press Ctrl+Shift+V.
    6. Edit the image as you like
    7. Once you finish, make sure there is no selection (Ctrl+Shift+A) and what you see is in a single layer (Ctrl+M).
    8. Copy the buffer image (Ctrl+C) and switch to the original image that contained the channel.
    9. The original image should still be in Quick Mask mode. Paste the buffer (Ctrl+V) and exit the Quick Mask mode (Shift+Q).
    10. From the Select menu select Save to channel. A new channel with the selection buffer's contents will be created. Delete the previous channel and move the new channel in place using the arrow buttons in the channels window.

    Note: all the above are for editing a non-RGB channel as a separate image (so you can use full filters, convert in RGB mode for extra editing options, mix with other images, etc and have the image appear as a grayscale image in the full grayscale "scale", not just some semitransparent pixels). If you just want to do a simple operation in the channel (like moving arrow some pixels, filling an area or applying a simple filter such as blur), just select it from the Channels window and make sure its the only channel selected (if it is not a RGBA channel, make it visible by clicking in the first square).

    What the last part basically means is that you could just offset the image using Offset (with X=-10) from Layer -> Transform and then select the channel and repeat the offset task there too.
     
  16. Reactor

    Moderator Original Member Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    1,637
    Likes Received:
    0
    Bad Sector, that taskbar of yours would drive me completely insane.
     
  17. Bad Sector

    Original Member

    Joined:
    May 28, 2005
    Messages:
    2,742
    Likes Received:
    5
    I don't use the taskbar, i just click on windows or use Alt+Tab. Now that you mentioned it, i haven't used the taskbar at all since in Ubuntu :p.
     
  18. ChrisP

    Indie Author

    Joined:
    Feb 5, 2007
    Messages:
    971
    Likes Received:
    0
    Yeah, you just have to ignore the taskbar when Gimp is open, because it's totally useless when cluttered up by all of Gimp's windows. Another good reason to put it on its own virtual desktop - then you can still use the taskbar for your other programs!
     
  19. Reactor

    Moderator Original Member Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    1,637
    Likes Received:
    0
    I don't know... looking at a taskbar like that is like someone waving a giant, "Look how badly this is designed!" flag in my face, and then hitting me over the head with it every few minutes. Hiding things away in virtual desktops (which I've never felt were that reliable) is one option, but eventually I have to go back to... that flag waving ;)
     
  20. ChrisP

    Indie Author

    Joined:
    Feb 5, 2007
    Messages:
    971
    Likes Received:
    0
    Oh, it is badly designed. I don't like Gimp's use of windows at all. But you get used to it, and the rest of the program is useful enough (and free enough) to make it all worthwhile. :)

    Virtual desktops are totally reliable. Just as long as you remember that you've used them. :p Ubuntu makes it easy to tell that a desktop is used, provided you don't minimise all the windows, although VirtuaWin is lacking here.
     

Share This Page

  • About Indie Gamer

    When the original Dexterity Forums closed in 2004, Indie Gamer was born and a diverse community has grown out of a passion for creating great games. Here you will find over 10 years of in-depth discussion on game design, the business of game development, and marketing/sales. Indie Gamer also provides a friendly place to meet up with other Developers, Artists, Composers and Writers.
  • Buy us a beer!

    Indie Gamer is delicately held together by a single poor bastard who thankfully gets help from various community volunteers. If you frequent this site or have found value in something you've learned here, help keep the site running by donating a few dollars (for beer of course)!

    Sure, I'll Buy You a Beer