This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Preparing gfx for a game


Re: Preparing gfx for a game

Postby John Lomax » Aug 31, 2001 @ 6:08am

Btw looking at the png file format, it does say it supports an optional alpha channel.<br><br>However my photoshop doesnt support the saving of alpha channels in the png file format (dunno about importing them though as I havent rendered out one in that format)<br><br>John.
User avatar
John Lomax
pm Member
 
Posts: 185
Joined: May 16, 2001 @ 6:04pm


Re: Preparing gfx for a game

Postby Avatar » Sep 1, 2001 @ 3:45am

That's some great info, I'll make sure to export to TIFF format, but...<br>No one did tell me what I should do with the image afterwards. Can I somehow use the TIFFs (or whatever format w/ alpha channel) in the game? Or do I seperate the alpha from the image and somehow use that? Please clarify :) (and backup by some code, hehehe ;)
Avatar
pm Member
 
Posts: 59
Joined: Aug 16, 2001 @ 8:32pm


Re: Preparing gfx for a game

Postby Avatar » Sep 1, 2001 @ 3:50am

BTW, in regards to the 3d packages, I use the following:<br>Poser 4 + Pro Pack for initial character design<br>Bryce 5 for some basic texture rendering (coz it's so damn simple)<br>Animatek's World Builder for creating advanced models of plants/vegitations/ground/etc...<br><br>I don't particularly like to export from one format to another unless I absolutely have to, as there is a quality loss in every conversion. So if anyone can give me advice with regard to the 3 programs I use, I would really appreciate it...
Avatar
pm Member
 
Posts: 59
Joined: Aug 16, 2001 @ 8:32pm


Re: Preparing gfx for a game

Postby Avatar » Sep 3, 2001 @ 3:23am

Not all at once now! :( Heh...So, can anyone reply to the above 2 posts?<br><br>Thanks...
Avatar
pm Member
 
Posts: 59
Joined: Aug 16, 2001 @ 8:32pm


Re: Preparing gfx for a game

Postby Digby » Sep 3, 2001 @ 12:50pm

I haven't used any of those 3D packages you've listed so I can't help you.  Maybe no one here has used those packages and that's why you aren't getting any replies?<br><br><br>It doesn't really matter whether you separate the alpha channel into another image or use the packed pixel format of a TIFF or PNG.  I personally use my own format where the entire color data comes first in the file, followed by the alpha mask (if there is one).  This keeps me from having to unpack the alpha when I'm blitting.  Probably not too good for cache locality though.<br><br>I don't have any code for reading TIFF or PNG images.  As I said, I use my own image format so that my application and graphics routines do as little work as possible.  I try to preprocess everything I can and modify content so that it is in a format that better matches the target platform.<br><br>
Digby
pm Insider
 
Posts: 1011
Joined: Apr 29, 2001 @ 1:53pm


Re: Preparing gfx for a game

Postby Avatar » Sep 3, 2001 @ 6:42pm

Let's forget the formats for a second. Let's say I have a raw bitmap of the sprite and a raw bitmap of alpha-channel. These could be in the same file or a different file, it doesn't matter. Now let's say I loaded both of these into program's memory (into a BITMAP structure, for example). Finally, let's say I have a 3rd bitmap that is the background.<br>What I want to do is display an alpha-blended sprite (which is a result of the sprite + alpha) on this background.<br>How do I do it? With bitblt routines this would require some logical operations with masks, with GAPI it would be something different. Since I am only familiar with the former, the question is regarding the GAPI...
Avatar
pm Member
 
Posts: 59
Joined: Aug 16, 2001 @ 8:32pm


Re: Preparing gfx for a game

Postby Digby » Sep 4, 2001 @ 2:30am

If you're trying to mimic the masking technique with BitBlt's raster ops, then the easiest and fastest way to do this with GAPI is to use a color-key.  Choose a color that isn't used in your sprite's image (magenta usually works) and set every transparent pixel in your sprite to that color.  When you copy the sprite to the screen buffer (or back buffer), if you come across a pixel that matches the color-key, then you don't write a pixel to the screen and go on to the next pixel.<br><br>This is extremely easy to code, doesn't involve masks, or the addition of an alpha channel and should be much faster than the multiple BitBlt calls you were previously making.<br><br>If you want to perform actual alpha blending, that's a bit more involved.  You should try the above method first, if for no better reason to familiarize yourself with GAPI and copying pixel data around manually.  After that, read over my previous posts on alpha blending (I seem to explain this once a week these days).  I'm happy to answer questions here or in e-mail but I'm not too hip on writing code for people.  It seems to cause more problems than it's worth.<br><br><br>
Digby
pm Insider
 
Posts: 1011
Joined: Apr 29, 2001 @ 1:53pm


Re: Preparing gfx for a game

Postby Jaybot » Sep 4, 2001 @ 4:56am

Lol, I'm sorry but I love Digby's replies, he just seems to know Everything and it still amazes me.
-------
|\\ //|
-- ^ --
|||
User avatar
Jaybot
pm Insider
 
Posts: 3208
Joined: Mar 22, 2001 @ 10:04pm
Location: Desk.


Previous

Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

Forum permissions

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

cron