Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#Actualdirectx user

Posted 23 December 2012 - 12:09 PM

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.

#7directx user

Posted 23 December 2012 - 11:46 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?[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

#6directx user

Posted 23 December 2012 - 11:44 AM

hi,

iam currently getting some issues with my sample texture to wrap proper on my geodesic sphere, actually it seems like the adress 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

#5directx user

Posted 23 December 2012 - 11:43 AM

hi,

iam currently getting some issues with my sample texture to wrap proper on my geodesic sphere, actually it seems like the adress 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

#4directx user

Posted 23 December 2012 - 10:15 AM

hi,

iam currently getting some issues with my sample texture to wrap proper on my geodesic sphere, actually it seems like the adress 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( &sampDesc, sizeof(sampDesc) );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 them soon

#3directx user

Posted 23 December 2012 - 10:12 AM

hi,

iam currently getting some issues with my sample texture to wrap proper on my geodesic sphere, actually it seems like the adress 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( &sampDesc, sizeof(sampDesc) );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

PARTNERS