Sign in to follow this  

[Resolved][MDX]Problem with sampling cubemap from HLSL shader when not texture 0

This topic is 4344 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

Hey everyone, I've got a small problem. I've got a cube map(R32F, dynamic + rendertarget) which I'm trying to sample in my HLSL shader. If I sample it from stage 0, D3DDevice.SetTexture(0, CubeTex) texture texture0; samplerCUBE texSamplerCUBE0 : TEXUNIT0 = sampler_state { Texture = (texture0); MIPFILTER = LINEAR; MAGFILTER = LINEAR; MINFILTER = LINEAR; }; It samples correctly If I sample it from any other stage, example, stage 1 D3DDevice.SetTexture(1, CubeTex) texture texture1; samplerCUBE texSamplerCUBE1 : TEXUNIT1 = sampler_state { Texture = (texture1); MIPFILTER = LINEAR; MAGFILTER = LINEAR; MINFILTER = LINEAR; }; It samples black.
Vertex Structure
        Dim Pos as Vector3
        Dim Normal As Vector3
        Dim TexCoord As Vector2
        Dim Tangent As Vector3
        Dim Binormal As Vector3

Vertex Format
        VertexFormats.Position Or VertexFormats.Normal Or VertexFormats.Texture1 Or VertexTextureCoordinate.Size3(1) Or VertexTextureCoordinate.Size3(1)        


Any ideas? [Edited by - CadeF on January 27, 2006 1:08:12 AM]

Share this post


Link to post
Share on other sites
Can't you just set the texture as a parameter on the effect, bypassing the stages entirely? All C# code I've seen uses this approach (using Effect.SetValue), so I'm a bit at a loss why you would want to use the stages with device.SetTexture anyway. Hence, forgive me if this is a dumb suggestion [wink]

Share this post


Link to post
Share on other sites

This topic is 4344 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.

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