Page 3 of 3 FirstFirst 123
Results 21 to 26 of 26

Thread: Code: Skybox/-dome

  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

  2. #22
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    68
    Posts
    3,865
    Rep Power
    405

    Re: Code: Skybox/-dome

    Jason, I can add haze and control mnay aspects with terragen.

    I will make quite a few without any walls this weekend. Then we can pick which are ok.

    What size do yu want the skybox? It is only 6 quads, so no problem for the video cards to handle.I think we can make it any size then without overhead on the gpu.

    I will make it so the bottom is at 0 y when in our game.
    the box will be centered at 0,0 for the x z dimensions.

    how high should i place the camera when rendering? I am thinking 2 meters.

    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  3. #23
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    68
    Posts
    3,865
    Rep Power
    405

    SkyBox5

    Here are 5 skyboxes, 1 for each city.
    I guess modelers can try the different ones with their city models to see which works best.

    Press 1,2,3,4 or 5 to go between the different skyboxes.
    PageUp and PageDown control the mouse speed: PageUp faster, PageDown slower.
    Escape to exit.

    West being 270, the Sun is at 225 and 60 Altitude in all skyboxes.

    Updated Oct. 19, 2008: You might need to clear your browser cache prior to downloading.
    SkyBox5
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  4. #24
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,153
    Rep Power
    736

    Re: Code: Skybox/-dome

    Hi Kent,

    good job, I like the 4 especially.

    Did you know that using [code=thinbasic]TBGL_ClearFrame(%TBGL_CLEAR_depth)[/code] instead of [code=thinbasic]TBGL_ClearFrame[/code] can give poor mortals like me extra 25 to 30% of performance boost?

    As skybox covers whole screen, you don't need to clear color, as pixels will get overwriten anyway.
    Low end cards suffering from low fillrate appreciate such a tweaks, this trick is used in lot of games.


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  5. #25
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    68
    Posts
    3,865
    Rep Power
    405

    Re: Code: Skybox/-dome

    Thanks Petr, did not know, will make the change and update the download. Thanks.
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  6. #26
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,153
    Rep Power
    736

    Re: Code: Skybox/-dome

    I will add this information to help file,

    it is really useful trick.


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

Page 3 of 3 FirstFirst 123

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
  •