Results 1 to 10 of 26

Thread: Code: Skybox/-dome

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #21
    Member
    Join Date
    Sep 2008
    Age
    48
    Posts
    326
    Rep Power
    49

    Re: Code: Skybox/-dome

    The only thing I have issues with is the wall inside the skybox.

    If you imagine a floor under you, and it slides away from your camera, it slides closer to the skybox wall. (Giving the illusion that the wall is moving closer to you, as you travel backwards.)

    On the opposite end... If you approach the end of the city, where the wall should be... it seems to run away from you. (The wall, not the city.)

    We do have one thing to our advantage. In a race game, the camera does not usually look up and down, so we can use a 4-wall object, as opposed to making a floor and ceiling. (The wall should actually slide-up and down, depending on game-camera height, to give the illusion of perspective. The motion should be a percentage of the height-value, which will determine where our eyes think the horizon actually rests.)

    I would also go on to suggest that the horizon be made to look more realistic, without using a real life panoramic image, by fading to white where the land meets the sky. As hills/mountains roll-off into the distance, they loose vibrancy as there is more atmosphere between our eyes and the distant land. Grassy hills go from bright green under our feet, to dark green at the tops of the curves in the near-distance, while they get more washed-out to grey/white/green, with each hill-roll. (The grey-wash is on a curve, not linear. So you would have 1 pixel of white on the horizon, than 2 pixels on the next layer that are grey/green/mint, than 4 darker, 8, 16, 32, 64... and that is where the near-distant graphics would begin to change. 64-256 would be about normal for color.)

    Same with the sky... directly above you, looking up, it is bright blue. In the distance, at the horizon, it is pure white... (At noon). At night white would be reversed to black for both the sky and ground. That white would be a color of the sun-set/rise.

    We can actually simulate that "Color" by making the sky and land full color, but use an alpha-horizon of pure white which matches the contour of the land-graphic-levels and solid-fade sky-line... then colorize the alpha image as white, orange, grey, mint, red, yellow... to match the sun-level.

    Takes a little bit of graphical know-how to pull that off... but with a "Rendered" scene as your images, it is not that difficult to separate the required images.

    1. Make a full 3D scene...
    - Setup normal lighting (Sun light and Ambient)
    - Sky is solid blue (Sky color), add clouds if desired.
    - Land is full-color, generic tiles work fine, but grass green, mountain tan, snow-capped... etc...
    - Create FOG levels so distant land, about 1/2 mile is crystal clear, but it fills to pure white before your land runs out.
    - Now turn off the fog... you need a shot without it.

    Get a full panoramic rendering of this scene.

    - Now... Turn on the fog on, you will need it for this shot.
    - Turn off the Sun light, and keep the ambient light, to light the fog.
    - Dump all image-maps, and turn the sky and land pure black, with the fog still pure white.

    You now have an alpha-mask view of the fog-element.

    Get a full panoramic rendering of this scene.

    If you overlay this image as an alpha... onto your full-color image... you have the fog which matches all the contours of the land.

    You can adjust the blend-level to make it less dramatic. But when it goes to a night scene, black should be black, so alpha would have to be 100%. Whatever color you colorize the alpha, should be the color-blend on the land. (You can make white alpha (100% MOD) less blended, but you can't make a grey alpha (50% MOD) get darker. EG, if the alpha is originally 50% translucent, to change the land to grey, not pure white... that will give you land at night that is half-bright, or dark 50% when the horizon should be dark 100%.)

    (Actually, the LAND and SKY and CLOUDS all would have separate alphas, as the sun hits them at separate times depending on sun-rise/set/overcast. But that is way above us. We can do the other things!)

    Here is a link to a sample "Fogged-out" atmosphere horizon. (GL fog is not an option, it gets too thick too fast. Like within feet.)
    http://chris-a-dilla.com/Assignment1/chinoH.html

    Here is a good example of sky... Going from dark-navy blue above, to white on the horizon... (At noon, above sky does not get that dark, and turns to Lt-blue/cyan.
    http://flickr.com/photos/smartvital/...n/photostream/

    I attached a hand-drawn sample of an ALPHA from FOG, imposed on a non-fogged rendering...
    Top Left: Normal "Toon" style depth-shadow render (What GL makes)
    Top Right: Same 3D scene, but with all black-objects, and full-white-fog (Saved as alpha)
    Bottom Left: Overlay of alpha colored white @ 50% translucent.
    Bottom Right: Same overlay colored black @ 50% translucent, but at night, so 3D is darker ambient.

    Darker ambient is the same as coloring the object that the image is imposed onto, 128,128,128 as opposed to 255,255,255

    Again, only because using a real life panoramic image, or a half/half real/rendered looks unnatural to the game.

    I also wanted to say... the skybox does not need to be that large. 2000 x 2000... The purpose of a skybox is to use a smaller box which is less processor/code demanding. (Again, I realize this is only a sample.)

    Great work. Should fit-in nicely with the core-code too.
    Attached Images Attached Images

Similar Threads

  1. skybox
    By kryton9 in forum TBGL Scripts and Projects
    Replies: 12
    Last Post: 18-06-2007, 22:56

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •