• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
bisslad

9000 x 1500 Skybox Texture - XNA

6 posts in this topic

Hi all,

 

I'm working on a 3D space shooter with XNA 4.0 and have downloaded a temporary skybox(actually a sphere) with texture which I would like to replace with another scene.

 

So I finished creating the cube map with the photoshop CS3 Nvidia dds plugin and exported as a cubemap (other settings default) and, while I can import the texture and it displays well, no seams etc, I was forced to scale down to a size below 4096 for use with XNA.

 

However this results in the skybox feeling very "close" to the scene due to the smaller texture size compared to the original.

 

After checking the dimensions of the original texture in photoshop (even though it only displays a black background?) it seems to be a 9000 x 1500 texture size and the file size is just over 100 Mb!

 

My own texture is a paltry 3072 x 512 with a file size of about 1 Mb by comparison.

 

So my question is are there some export settings I am ignoring? Or, why exactly does XNA turn it's nose up at my own texture when it is over 4096 and not another?

 

I have checked the content importer and processor settings for each texture and they appear the same so is there something I'm missing?

 

If anyone can shed some light I would be much obliged.

 

Thanks.

 

 

0

Share this post


Link to post
Share on other sites
Because graphics cards have limited memory and are only able to address so much. When a texture is loaded for use, it goes into a special area where it can be sampled from very quickly. The size of that memory is the maximum size of the texture you can load. Some cards had 256, then 1024, 2048, and then 4096, and beyond.

4096 is the largest size Xbox360 can use. It may be the largest size that XNA GS supports for PC as well. Then your own GPU will have it's own limit, which may be less or more.

There is no way in hell you need a texture any larger than that. Most textures at 4096x4096 are being used for atlasing, and not for a single texture, and there aren't even that many pixels visible on screen. Edited by Daaark
2

Share this post


Link to post
Share on other sites

Yeah that was my understanding as well of the way video memory was handled on the GPU, but there is still the fact that the texture being referenced is of that size and those dimensions in the content folder.. So the only thing I can think of is that its being either scaled down or sampled in some way along the content pipeline that I am unaware of, or perhaps that there is some sort of compression technique that was applied to the original texture during its creation that enables the image data to be referenced at runtime... Im just fishing here because, as you say, it doesn't conform to my understanding of the the addresing limitations of the environment..

 

Cheers though I appreciate the response!

0

Share this post


Link to post
Share on other sites
A lot of people don't realize how the content folder in XNA works.

The content folder in your project is treated like a source code folder, and then the it all gets compiled into new formats. Your models get converted to a format that maps with the MODEL datatype. Textures will be turned to DDS, and any necessary conversions size and bit depth conversions will be done.

A 3072x512 texture * 32 bits is not 1 mb. 512x512 is just under 1mb.
0

Share this post


Link to post
Share on other sites

Yeah I suppose I could have a better grasp though I am aware of the
byte code compilation process during the build process.. The thing is,
that is exactly why I don't understand the differences between the on
screen results I am achieving. I mean, if the content pipeline is
supposed to pretty much automatically apply scale, sampling and other
pertinent texture info at compile time and imbedded in the model, all of which is sent to the GPU to be rendered, then what is causing the scaling issues I am having? If you know what  mean.

 

I
dont mean to sound like an idiot either, but I am not really a guy who
has often tried to stitch his own textures together in photoshop. My
reference to the file sizes are simply what I see on the screen and in
the properties of the files, I was just including them in case it had
context for the problem. I not really an artist. I dont really know how to measure what size an image is except by what I see on the screen. When I create a new photoshop document I set  it to 6144 x 1024 pixels at 300 pixels per inch in 32 bit RGB mode. Then exported it to .dds with default options bar changing it from 2D texture to cubemap. The resulting mipmapped file appears to be 1Mb in the file explorer then.

0

Share this post


Link to post
Share on other sites

Also the shader operating on the texture is as follows skybox.fx

 

uniform extern float4x4 ViewMatrix;
uniform extern float4x4 ProjectionMatrix;

void SkyboxVertexShader( float3 pos : POSITION0,
                         out float4 SkyPos : POSITION0,
                         out float3 SkyCoord : TEXCOORD0 )
{
    // Calculate rotation. Using a float3 result, so translation is ignored
    float3 rotatedPosition = mul(pos, ViewMatrix);           
    // Calculate projection, moving all vertices to the far clip plane 
    // (w and z both 1.0)
    SkyPos = mul(float4(rotatedPosition, 1), ProjectionMatrix).xyww;    

    SkyCoord = pos;
};
uniform extern texture SkyboxTexture;
sampler SkyboxS = sampler_state
{
    Texture = <SkyboxTexture>;
    MinFilter = LINEAR;
    MagFilter = LINEAR;
    MipFilter = LINEAR;
    AddressU = CLAMP;
    AddressV = CLAMP;
};
float4 SkyboxPixelShader( float3 SkyCoord : TEXCOORD0 ) : COLOR
{
    // grab the pixel color value from the skybox cube map
    return texCUBE(SkyboxS, SkyCoord);
};
technique SkyboxTechnique
{
    pass P0
    {
        vertexShader = compile vs_2_0 SkyboxVertexShader();
        pixelShader = compile ps_2_0 SkyboxPixelShader();

        // We're drawing the inside of a model
        CullMode = None;  
        // We don't want it to obscure objects with a Z < 1
        ZWriteEnable = false; 
    }
}

0

Share this post


Link to post
Share on other sites

And the draw and update methods in my skysphere.cs file.

 

 public override void LoadContent()
        {

            SkySphereModel = XNAGame.Instance().Content.Load<Model>("SkySphere/SphereHighPoly");
            TextureCube SkySphereTexture = XNAGame.Instance().Content.Load<TextureCube>("SkySphere/SkySphereTexture");
            SkySphereEffect = XNAGame.Instance().Content.Load<Effect>("SkySphere");
            SkySphereEffect.Parameters["ViewMatrix"].SetValue(XNAGame.Instance().Camera.view);
            SkySphereEffect.Parameters["ProjectionMatrix"].SetValue(XNAGame.Instance().Camera.projection);
            SkySphereEffect.Parameters["SkyboxTexture"].SetValue(SkySphereTexture);

            SkySphereEffect = XNAGame.Instance().Content.Load<Effect>("SkySphere");

            foreach (ModelMesh mesh in SkySphereModel.Meshes)
            {
                foreach (ModelMeshPart part in mesh.MeshParts)
                {
                    part.Effect = SkySphereEffect;
                }
            }
        }

        public override void Draw(GameTime gameTime)
        {
            SkySphereEffect.Parameters["ViewMatrix"].SetValue(XNAGame.Instance().Camera.view);
            SkySphereEffect.Parameters["ProjectionMatrix"].SetValue(XNAGame.Instance().Camera.projection);

            DepthStencilState dss = new DepthStencilState();
            dss.DepthBufferEnable = false;
            XNAGame.Instance().GraphicsDevice.DepthStencilState = dss;
            foreach (ModelMesh mesh in SkySphereModel.Meshes)
            {

                mesh.Draw();
            }

            dss = new DepthStencilState();
            dss.DepthBufferEnable = true;
            XNAGame.Instance().GraphicsDevice.DepthStencilState = dss;
        }
    }
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0