Jump to content
  • Advertisement
Sign in to follow this  
directx user

adress mode issues

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

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?[attachment=12894: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

Share this post


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

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!