Jump to content

  • Log In with Google      Sign In   
  • Create Account


adress mode issues


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 directx user   Members   -  Reputation: 154

Like
0Likes
Like

Posted 23 December 2012 - 10:10 AM

hi,

iam currently having some issues with my sample texture to wrap proper on my geodesic sphere, actually it seems like the address mode of my sampler doesnt works. I need the texture to repeat on the other side of the sphere, so i assigned a wrap samplerstate:
D3D11_SAMPLER_DESC samplerdesc = D3D11_SAMPLER_DESC();ZeroMemory( &samplerdesc, sizeof(samplerdesc) );samplerdesc.AddressU = D3D11_TEXTURE_ADDRESS_MODE::D3D11_TEXTURE_ADDRESS_WRAP;samplerdesc.AddressV = D3D11_TEXTURE_ADDRESS_MODE::D3D11_TEXTURE_ADDRESS_WRAP;samplerdesc.Filter = D3D11_FILTER::D3D11_FILTER_ANISOTROPIC;device->CreateSamplerState(&samplerdesc,&sampstate);////////////////////////////////immediatecontext->PSSetSamplers(0,1,&sampstate);immediatecontext->VSSetSamplers(0,1,&sampstate);
Shadercode:
Texture2D<float4> Textur : register(t0);sampler sampler1 : register(s0);cbuffer Matrix : register( b0 ){	row_major matrix World;	row_major matrix View;	row_major matrix Projection;};struct VS_INPUT{    float4 Pos : POSITION;    float2 texcoord : TEXCOORD;};struct PS_INPUT{    float4 Pos : SV_POSITION;    float2 texcoord : TEXCOORD;};//--------------------------------------------------------------------------------------// Vertex Shader//--------------------------------------------------------------------------------------PS_INPUT VS( VS_INPUT input ){    PS_INPUT output = (PS_INPUT)0;    output.Pos = mul(input.Pos,World);    output.Pos = mul(output.Pos,View);    output.Pos = mul(output.Pos,Projection);    output.texcoord = input.texcoord;    return output;}//--------------------------------------------------------------------------------------// Pixel Shader//--------------------------------------------------------------------------------------float4 PS( PS_INPUT input) : SV_Target{	float4 ret = Textur.Sample(sampler1,input.texcoord);	return ret;}
Is there a problem with the shader itself?


The resolution of the image is 512X512, so there shouldnt be a problem with it?merkurfail.PNG

the u coordinate ranges from 0 to 2, and the white strip has nothing to do with the texture, will replace it soon

edit:




Its working now, i missed to set the addressmode w parameter in the samplerstate, but i have another question anyway.
While searching in the internet i saw this code snippet:
Texture2D Textur : register(t0);
SamplerState sampler1 : register(s0);


while i used this one:
Texture2D<float4> Textur : register(t0);
sampler sampler1 : register(s0);

both is working but where is the difference, besides the float4 telling hlsl the format.

Edited by directx user, 23 December 2012 - 12:09 PM.


Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS