Has anyone some code about a skydome mesh with a texture and a shader? Or even know how can I create a skydome mesh in Direct3D11? I wanted give an idea from https://ifun01.com/R8CTFZQ.html but it needs the md3 skydome mesh and without a sky texture. So I still think.

  • \$\begingroup\$ You just need to draw a giant cube around the entire map("round" skies can be implemented doing this). \$\endgroup\$
    – Cpp plus 1
    Jan 23, 2018 at 16:39

2 Answers 2


This is a file containing vertices for a triangulated sphere. You can include it in a shader, and if you call Draw() with a vertex count of 240, and have SV_VERTEXID semantic as an input to the vertex shader, you can index into the ICOSPHERE variable in the shader. This will get you a 3D coordinate which you can use as your skydome mesh vertex positions and cubemap sampling coordinates as well. Like this vertex shader for example:

#include "icosphere.hlsli"

struct VSOut {
    float4 pos : SV_POSITION;
    float3 tex : TEXCOORD0;    

VSOut main(uint vid : SV_VERTEXID)
    VSOut Out;
    Out.pos = mul(float4(ICOSPHERE[vid].xyz, 0), g_xCamera_ViewProjection);
    Out.tex = ICOSPHERE[vid].xyz;
    return Out;

I also like to use this method to draw any simple geometry like light geometries, boxes, etc. This way you don't have to bind a vertex buffer to the shader, the mesh gets compiled into the shader binary as an immediate constant buffer.


CPP alluded to it, but you can do it through a few simple things.

1 - Create a ball or box mesh in a 3d program. Most offer Wavefront export, there are a few wavefront to direct 3d mesh converters, but you challenge will be to find one. I found there are more wavefront import libraries around. If you use a box, you could easily hand craft it in your code (not nice but fairly straightforward, lots of render tutorials around). Box is definitely the easiest sky mesh to do first.

2 - It's a background, so just turn Z test/write off in Direct X so it will be written over by everything after.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .