Jump to content
  • Advertisement
Sign in to follow this  
Funkymunky

CubeMap Coordinates

This topic is 1251 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to manually render the mipmap levels of a cubemap.  First I rendered level 0 of the cubemap by setting up a framebuffer and passing 6 projection/modelview matrices to a geometry shader, duplicating the triangles for each face.  Next I attached level 1 of the cubemap and bound the same texture as the input to the pixel shader.

 

And then i realized that I need a float3/vec3 to sample the cubemap.  Is there a good way to create this to sample the 6 faces cleanly?  Or do I need to re-evaluate my setup and attach each face independently...?

Share this post


Link to post
Share on other sites
Advertisement

Which API are you using? In D3D11 I believe that you can create a shader resource view that treats the cubemap as a texture array, which would let you perform "normal" 2D sampling. 

Share this post


Link to post
Share on other sites

Either OpenGL 4+ or DX11.  I've realized that I also put together a little skybox class when I was testing the cubemap which does basically what I'm trying to do already.  And on your suggestion I found this page:

 

http://msdn.microsoft.com/en-us/library/windows/desktop/ff476906(v=vs.85).aspx#Texture2D_Resource

 

which says "A 2D texture array that contains 6 textures may be read from within shaders with the cube map intrinsic functions, after they are bound to the pipeline with a cube-texture view."

 

Perfect.  Thanks!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!