Original Post
I'm sending a array of data to the GPU (as a 1D texture) that I sample in my pixel shader. I use the data to draw a figure onto a quad in the PS. Everything's kosher until I zoom in. After getting very close, my figure is highly aliased with large stair-steps, even though I believe my sampler's filtering is set up correctly.
What part of the equation am I missing here? I appreciate the suggestions! The following code is SharpDX, but the important parts should be easy to read.
[source lang="csharp"]
Texture1DDescription textureDesc = new Texture1DDescription();
t1dDesc.ArraySize = 1;
t1dDesc.Usage = ResourceUsage.Immutable;
t1dDesc.Width = dataArray.Length;
t1dDesc.Format = Format.R32_Float;
t1dDesc.BindFlags = BindFlags.ShaderResource;
t1dDesc.CpuAccessFlags = CpuAccessFlags.None;
t1dDesc.OptionFlags = ResourceOptionFlags.None;
t1dDesc.MipLevels = 1;
DataStream ds = DataStream.Create(dataArray, false, false, false);
dataTexture = new Texture1D(d3dDevice, textureDesc, ds);
ds.Dispose();
this.dataTextureView = new ShaderResourceView(d3dDevice, dataTexture);
this.dataSampler = new SamplerState(d3dDevice, new SamplerStateDescription()
{
Filter = Filter.MinMagMipLinear,
AddressU = TextureAddressMode.Clamp,
AddressV = TextureAddressMode.Clamp,
AddressW = TextureAddressMode.Clamp
});[/source]
HLSL:
[source]
float4 PS(PixelShaderInput input) : SV_TARGET
{
float4 color = float4(0,0,0,0);
float dataValue = data.Sample(dataSampler, input.texcoord.x);
if(input.texcoord.y <= dataValue)
{
color = dataValue;
}
return color;
}[/source]
[attachment=9452:Awful.jpg]
What part of the equation am I missing here? I appreciate the suggestions! The following code is SharpDX, but the important parts should be easy to read.
[source lang="csharp"]
Texture1DDescription textureDesc = new Texture1DDescription();
t1dDesc.ArraySize = 1;
t1dDesc.Usage = ResourceUsage.Immutable;
t1dDesc.Width = dataArray.Length;
t1dDesc.Format = Format.R32_Float;
t1dDesc.BindFlags = BindFlags.ShaderResource;
t1dDesc.CpuAccessFlags = CpuAccessFlags.None;
t1dDesc.OptionFlags = ResourceOptionFlags.None;
t1dDesc.MipLevels = 1;
DataStream ds = DataStream.Create(dataArray, false, false, false);
dataTexture = new Texture1D(d3dDevice, textureDesc, ds);
ds.Dispose();
this.dataTextureView = new ShaderResourceView(d3dDevice, dataTexture);
this.dataSampler = new SamplerState(d3dDevice, new SamplerStateDescription()
{
Filter = Filter.MinMagMipLinear,
AddressU = TextureAddressMode.Clamp,
AddressV = TextureAddressMode.Clamp,
AddressW = TextureAddressMode.Clamp
});[/source]
HLSL:
[source]
float4 PS(PixelShaderInput input) : SV_TARGET
{
float4 color = float4(0,0,0,0);
float dataValue = data.Sample(dataSampler, input.texcoord.x);
if(input.texcoord.y <= dataValue)
{
color = dataValue;
}
return color;
}[/source]
[attachment=9452:Awful.jpg]