Why could my skybox textures be so poor quality?

Discussion in 'Game Development (Technical)' started by zoombapup, Nov 28, 2011.

  1. zoombapup

    Moderator Original Member

    Joined:
    Nov 25, 2004
    Messages:
    2,890
    Likes Received:
    0
    Hey all.

    I've got a skybox I made using ATI cubemapgen and some sky textures I had from cgskies.com and when I render them in my game they look really horrible. Just too grainy in the clouds etc.

    The texture res is 1024 for each cubemap face, which is pretty common as far as I can tell. Yet my skybox looks terrible :)

    So, I'm just wondering, anyone got any ideas why? I mean I've tried higher res for the skybox faces and they still don't look good. I can obviously filter the skybox faces in cubemapgen but that seems to just blur things.

    I'm wondering if its a GL render setting, but it cant be, the shaders are as simple as it gets (pass through vertex and pixel shader just looks at the right pixel in the cubemap, cant really see anything going wrong there).

    Assuming 1k faces, I guess a typical scene at say 1280x720 isnt going to get any better if I up the resolution on the cubemap faces to a silly res is it? Just cant for the life of me figure out why it looks so poor :)
     
  2. Desktop Gaming

    Moderator Original Member Indie Author

    Joined:
    Feb 24, 2005
    Messages:
    2,297
    Likes Received:
    12
    Last time I did any stuff like this was in Blitz3D so I don't know if what I'm about to say will apply, or even make sense.

    The biggest problem I had was when I created a skycube which was as small as possible - there were visible seams along the cube faces. Scaling up the cube also scaled up the seams and didn't solve the problem. The only way around it was to create a larger cube in the first place. Given that the problem was down to floating point accuracy it might cause problems beyond Blitz3D too.

    Second, is your skybox too small, or too big? I'm thinking maybe if you've created a huge skybox so the surfaces are too far from the viewpoint, then the textures might be getting influenced by some sort of filtering?
     
  3. electronicStar

    Original Member

    Joined:
    Feb 28, 2005
    Messages:
    2,068
    Likes Received:
    0
    what texture format are you using?
     
  4. JeBuS

    JeBuS New Member

    Joined:
    Jul 9, 2008
    Messages:
    140
    Likes Received:
    0
    The only thing I can think is that your texture sampler state isn't set properly. For mine I usually use:

    Code:
    sampler SkyboxS = sampler_state
    {
        Texture = <SkyboxTexture>;
        MinFilter = LINEAR;
        MagFilter = LINEAR;
        MipFilter = LINEAR;
    };
    I don't think there's any difference in quality from AddressU/V states in this instance, so I didn't include them.

    Edit: In case it isn't obvious, this is HLSL. The GL equivalent shouldn't be too different, I imagine.
     
  5. Bram

    Indie Author Greenlit

    Joined:
    May 1, 2010
    Messages:
    178
    Likes Received:
    1
    Like jeBuS said: it is probably the filtering.
    To set it in OpenGL, do:

    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );

    Do this before you do the call to glTexImage2D.

    As skyboxes are always roughly at the same depth, I recommend not using MIPMAPs.

    Bram
     
  6. oNyx

    Original Member

    Joined:
    Jul 26, 2004
    Messages:
    1,212
    Likes Received:
    0
    Nah. It's using GL_CLAMP and hoping that you're using horribly outdated drivers where it's incorrectly implemented in a way which mirrors GL_CLAMP_TO_EDGE. (Old games rely on this. CTE didn't exist yet. It was added with 1.2.)

    With GL_CLAMP you get some kind of border in the vertex color, which is... pretty useless. The first time I read about this was over 10 years ago and I still can't think of a use case.
     

Share This Page

  • About Indie Gamer

    When the original Dexterity Forums closed in 2004, Indie Gamer was born and a diverse community has grown out of a passion for creating great games. Here you will find over 10 years of in-depth discussion on game design, the business of game development, and marketing/sales. Indie Gamer also provides a friendly place to meet up with other Developers, Artists, Composers and Writers.
  • Buy us a beer!

    Indie Gamer is delicately held together by a single poor bastard who thankfully gets help from various community volunteers. If you frequent this site or have found value in something you've learned here, help keep the site running by donating a few dollars (for beer of course)!

    Sure, I'll Buy You a Beer