Thread: Alpha blending w/o color loss

  1. #16
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    It looks to concrete for my tastes but I guess I will stick with it.

    Adding a sun glare quad to the screen tonight. I will simply alter the alpha value of the quad based on the normalized dot product of the camera lookVector and the incoming light vector. When the value is 1, the quad will be rendered at near opaqueness and when it is 0 it will not be rendered at all. If it is <0 it also will not be rendered since the angle would be obtuse and the sun rays would be behind the camera.

    This will work for just a camera but when I add in 3D cockpits I will need to cast several rays towards the sun and see if they hit.

    I'm looking heavily into stencil buffer shadow volumes for my engine but I'm not sure that it would really add much to a space genre game. Problem is that there really isn't a lot of occluders and shadows in space. You might have a moon shadow onto a planet, but any render of that would look superficial at best. I do want my ships to shadow onto surfaces, however if they shadow onto a planet it is possible that their actual size in comparison to the planet's may stick out like a sore thumb. Also in pictures from the shuttle it appears that the shuttle is so far away from the earth that it does not cast a shadow onto it.

    What I might do is create small shadow volumes for self-occluders, that is, elements of a ship that self shadow onto the ship. This would be pretty simply since the shadow volume would not need to extend to infinity. If the ship was very far away from the camera shadowing would not be rendered since you would probably never see it. So the shadow volume should never be clipped by the far clip plane. The near clip plane however would be a problem and I'll probably have to hack it since there is no known good algorithm for perfect near plane shadow volume clipping issues.

    Anyways I really need more help on this engine. The whole rendering code needs to be revamped to handle vectors of objects that need to be rendered. The setup code needs to be altered to read the info from a file for the current system and then setup the appropriate variables based on the file contents. Right now a lot of this is hard-coded simpy for testing purposes but the quicker I move away from that mentality and setup, the quicker I can insert new objects into my game to be used by the engine.

    Animation classes, timers, and functionality is already in the engine but has not been tested or used yet. I'm not sure how to implement moving parts on ships and objects and I probably need to develop some type of small scripting language for events, ship patrols/movements, AI, etc.

    Individual targeting of ships systems will not be implemented since that would require a significant more amount of ray to triangle intersection test code, or at the very least ray to bounding volume or cube tests. If I could get it to run at an acceptable frame rate I might consider it.

    If you wish to help in any way please PM me. You can see that this engine is for real and so far has progressed quite nicely. I'm fairly sure my class setup has not coded me into any dark corners and adding classes to the engine is a snap. I'm developing an editor in Visual Basic that will create a type of binary ini file that will describe systems, patrol paths, asteroid/debris fields, suns/stars, rotations, commodities, ambient/specular/diffuse colors, planets (along with their associated colors, materials, shaders, rotational info, etc.), etc., etc.
    Last edited by VirtualAce; 10-24-2004 at 12:15 AM.

  2. #17
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Several new screenshots with sun glare (not lense flares) added to the camera.

  3. #18
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Here is a pic about 5000 from the sun at a range of 10000 for the light.

  4. #19
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    This is very close to the light source or in this case the sun.

  5. #20
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    This is a screenie to prove that even though the light source is not in the frustrum, it's rays can still fall within it.

  6. #21
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    And here is a test of a new 20 planet render. So far everything shuts down perfectly...after a bit of debugging. All colors, positions, etc, are randomized.

  7. #22
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Sorry here is the colored planet demo.

  8. #23
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    And a very nice render from one planet looking toward another.

  9. #24
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    And a more recent shot. Need more textures.

  10. #25
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    Nice work. Althought in some shots the targeting reticule is hard to see.
    I think a small red circle would be good.

    I only wish I had the time, patience, mental capacity, etc.. to learn this stuff.
    What is C++?

  11. #26
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Yeah that reticle will probably be changed about 50 times before I decide what to use.

    You do have the mental capacity to learn this stuff. I flunked my high school algebra class and yet I taught myself all this. Don't underestimate yourself - just dive in head first. It's really sink or swim and you'll do a lot of sinking before you do some swimming, but the end result is worth it.

  12. #27
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Quote Originally Posted by Bubba
    Several new screenshots with sun glare (not lense flares) added to the camera.
    Streaks like those in the image are generated in the camera/eye and should be rendered last, along with the corona -- which also is 99+% generated within the camera/eye.

    Such small planets would be completly invisible in front of the sun without really strong sun glasses -- like the Venus passage in front of the sun this summer.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  13. #28
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    By definition, what exactly is a corona?
    What is C++?

  14. #29
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    Quote Originally Posted by Vicious
    By definition, what exactly is a corona?
    http://fusedweb.pppl.gov/CPEP/Chart_...SunLayers.html

    the corona-ish part.

  15. #30
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    So basically, in programming terms... A texture or effect to create a glowing around an object?
    What is C++?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Direct3D10 Sprites Alpha Blending
    By DarkMasterBosel in forum Game Programming
    Replies: 0
    Last Post: 01-17-2009, 07:17 AM
  2. Replies: 23
    Last Post: 07-09-2007, 04:49 AM
  3. 2 questions in DirectX
    By X PaYnE X in forum Game Programming
    Replies: 4
    Last Post: 12-02-2004, 09:38 AM
  4. Alpha blending rocks
    By VirtualAce in forum Game Programming
    Replies: 12
    Last Post: 04-06-2004, 08:08 PM
  5. Alpha blending
    By SMurf in forum Game Programming
    Replies: 3
    Last Post: 08-29-2003, 06:50 PM