Translucent gfx (i.e. for explosion)

This is a discussion on Translucent gfx (i.e. for explosion) within the Game Programming forums, part of the General Programming Boards category; Sang-drax, I agree that sometimes it's not needed to know what goes on under the hood, but I've already started ...

  1. #16
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Sang-drax, I agree that sometimes it's not needed to know what goes on under the hood, but I've already started with DirectDraw, and I don't feel like abandoning my half-ported game just yet And also, I just feel like doing DirectDraw first, since I once took a course with Direct3D and it went right over my head with matrix world/universe axis-level transform boundary checking, and other confusing stuff like that, and I'm sort of scared

    And I think I'll stop saying "Thanks for the help MrWizard", because it's getting repetitive

    **EDIT**
    MrWizard, looking at the transparency tut you attached, I'm looking at this line:

    unsigned short AlphaVal = lpSourceLine[ ALPHA_OFFSET ];

    Is that just retreiving the alpha value of a certain pixel? If so, I'm sort of confused about how to put the alpha value there to begin with, since Paint doesn't support 32 bit bitmaps, and neither does Paintshop Pro 7 (or at least I don't think so).

    **EDIT2**
    Hmm, new idea: loading a greyscale image for the alpha channel. Would this work?

    And another thing, on the second line ( ), you have Alphaval * Opacity (...). You mentioned that it is combining the two, but how exactly..? Is it something like "50% of 50% of the pixel gets copied"?
    Last edited by Hunter2; 02-09-2003 at 08:30 PM.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  2. #17
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Originally posted by Hunter2
    And also, I just feel like doing DirectDraw first, since I once took a course with Direct3D and it went right over my head with matrix world/universe axis-level transform boundary checking, and other confusing stuff like that, and I'm sort of scared
    Dont be scared!
    Now listen to me: 2D programming in Direct3D is easier than in DirectDraw. Direct3D is only complicated when dealing with 3D-graphics. No matrices are needed, no transform is needed and no other confusing stuff like that are needed when dealing with 2D graphics.

    There are many interfaces like ID3DXSprite and ID3DXFont that are really easy to use.

    I know this, because I've ported my DirectDraw game engine to Direct3D 8 and I got more functionality, faster execution with less code. With Direct3D, there's no need to worry about clipping, locking surfaces, using GDI for drawing text and double buffering.

    But since you've already started, I guess the choice is easy.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  3. #18
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    About Mr Wizard's way of increasing lightness of a pixel.
    Code:
    // MAKE SURE YOU CLAMP THESE VALUES! ( 0 - 255 )
    *lpB += 25; // Brighten by 25
    *lpG += 25;
    *lpR += 25;
    To brighten a pixel by just adding values is wrong, and could alter the color of the pixel etc.
    Instead convert the RBG to HSL (hue,saturation,lightness) and alter the lightness parameter.

    http://www.cprogramming.com/cboard/s...ght=saturation
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  4. #19
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Hmm, I guess Direct3D is the next stop for me. But first I have to fulfill my purpose here on Earth

    But about converting to HLS, how would I do this?
    Code:
    //loop through thing
    COLORREF temp = ColorRGBToHLS(*currentPixel);
    temp = RGB(GetBValue(temp), GetGValue(temp) + 5, GetRValue(temp));
    *currentPixel = temp;
    
    ++currentPixel;
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Making my own gfx engine
    By jverkoey in forum Game Programming
    Replies: 4
    Last Post: 06-07-2003, 02:06 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21