XNA Creators Club Online
Page 1 of 1 (4 items)
Sort Posts: Previous Next

CubeTexture.Load

Last post 03-16-2008 1:01 PM by John Rapp. 3 replies.
  • 03-11-2008 2:44 PM

    CubeTexture.Load

    Although the DX SDK's docs says

    "Object A texture-object type (except TextureCube). "

    .. Could be possible to perform a .Load on a cube texture? What would be the geometric meaning of the fetch input... a 3D texture?

    Well, I tried to make a TextureCube.Load(int4(10,10,10,0)) and FXC returned this error:

    "error X3088: TextureCube object does not have method 'Load'"

    I want this to scholatic-sample a cubemap for glossy reflections... If I cannot do a Load on a cube map I would need to pass the cubemap to CPU and perform the sample there... so will be slower.

    thx

  • 03-12-2008 3:28 AM In reply to

    Re: CubeTexture.Load

    Can’t you use just Sample instead?

  • 03-12-2008 12:47 PM In reply to

    Re: CubeTexture.Load

    I could use Sample but I need a method to transform the 3D cubemap fetch vector to 2D(+cube face hit) and also the inverse way.
    That will be slower than allowing the programmers to use a CubeTexture.Load just fetching it like a texture 3D.
    The D3D10.1 gather4 can help, but ideally I should be able to fetch in 2D a texel in the cubemap face using Load.
  • 03-16-2008 1:01 PM In reply to

    Re: CubeTexture.Load

    A Cube texture is treated at the API level like a 6-element array of 2D textures, so you *should* be able to bind a 2D array view of the cube, and use the Texture2DArray.Load intrinsic.

    You'll find that the real trick here is handling the edge cases, since in sampling, if you have a vector that hits right on the edge of the two textures, you need to interpolate across two different textures with potentially different texture coordinates.

    Using the same 3-D coordinate system doesn't make sense when you're attempting to fetch a single texel from a cube map (since it's not a 1-1 direct mapping), so we don't expose anything that lets you address single texels on cube textures (you'll notice the offset intrinsics are also not available, partially because the offset direction actually changes depending on which face you're on). Note that if you really just want a non-interpolated value, you can use point sampling.

    But if you want to directly address single texels in a cube map, you have to do it in a way that makes sense. This will mean using Texture2DArray, and a lot more work for you if you need to to support 3D directions as addresses.

Page 1 of 1 (4 items) Previous Next