Sign in to follow this  
ryan mccabe

texture ghosting on camera move

Recommended Posts

I have a scene with a rotating cube with the same image on each side. The camera moves (no ration yet), and the cube spins. When the camera is still the cube is fine. When I move the camera the texture starts to ghost, no matter how fast the camera moves the texture on the cube gets a horrible ghosting effecting. I don't think its my camera movement algorithm, the first thing I did was rebuild my camera class using [url="http://www.two-kings.de/tutorials/basics/basics01.html"]this[/url] one from two kings which seems to be similar to other recommended models. Ive been playing around with stencils, buffers, and swap chains for a while, and while I'm pretty sure Ive got half of it memorized, nothing has effected the ghosting on camera movement, not even rebuilding the camera. I hope there is enough detail there for someone to pick out whats going on, if not ask and Ill fill in any gaps. Why is my texturing ghosting when the camera is moving??

Multisample AA, and vsync are on. The monitor doesn't ghost with anything else. . .
Thanks

Share this post


Link to post
Share on other sites
[quote name='ryan mccabe' timestamp='1305910464' post='4813535']
Its a faded afterimage so semi transparent. Im working with direct3d 11.
[/quote]

In that case my best bet would be it's a blending issue of some kind. Are you manually setting the blendstate somewhere? And could you post your pixel shader?

Share this post


Link to post
Share on other sites
ClearRenederTargetView is called at the start of each scene / frame. The blendstate description isn't touched, perhaps I should set it? The pixel shader:

[code]

// Filename: texture.ps
///////////
//GLOBALS//
///////////

//shaderTexture is the texture resource
Texture2D shaderTexture;

//SampleType determines how the texture is downsized
SamplerState SampleType;

//diffuse and light direction
cbuffer LightBuffer
{
float4 diffuseColor;
float3 lightDirection;
float padding;
};

/////////////
// TYPEDEFS//
/////////////

struct PixelInputType
{
float4 position : SV_POSITION;
float2 tex : TEXCOORD0;
float3 normal : NORMAL;
};

// Pixel Shader
float4 TexturePixelShader(PixelInputType input) : SV_TARGET
{
float4 textureColor;
float3 lightDir;
float lightIntensity;
float4 color;

//Sample the pixel color from the texture using the sampler at this texture coord location
textureColor = shaderTexture.Sample(SampleType, input.tex);

// Invert the light direction for calculations.
lightDir = -lightDirection;

// Calculate the amount of light on this pixel.
lightIntensity = saturate(dot(input.normal, lightDir));

// Determine the final amount of diffuse color based on the diffuse color combined with the light intensity.
color = saturate(diffuseColor * lightIntensity);

// Multiply the texture pixel and the final diffuse color to get the final pixel color result.
color = color * textureColor;


return color;
}

[/code]


I'm adapting the engine from [url="http://www.rastertek.com/tutindex.html"]http://www.rastertek.com/tutindex.html[/url]. So far the pixel shader is something I haven't touched but there have been a few places where the tutorials have led me down the wrong path and I've needed to rework the code for proper functionality. I'll start working on improved shader and see what happens.

Also, the effect is worst on light areas. Right now the scene contains multiple spheres with a night time image of earth applied, the lights turn in to streaks as I move the camera. It actually looks somewhat realistic however its undefined behavior so Id like to correct it.

Share this post


Link to post
Share on other sites
[font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"]If you're not setting the blendstate anywhere it should already be set to its default, and should work if I'm not mistaken. [/size][/font][font="arial, verdana, tahoma, sans-serif"][size="2"]That SamplerState object you're creating, is it defined and set somewhere within the source code? Otherwise I think you might have to set it's filter type and texture adress mode,[/size][/font][font="arial, verdana, tahoma, sans-serif"][size="2"]for example:[/size][/font][/size][/font][/size][/font][/size][/font]
[font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"]SamplerState SampleType
{
Filter = MIN_MAG_MIP_LINEAR;
AdressU = Wrap;
AdressV = Wrap;
};
[/size][/font][/size][/font][/size][/font][/size][/font][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"]Another thing that I think might be causing problems is how you multiply the lighting vectors. Did you try using [/size][/font][/size][/font][/size][/font][/size][/font]
[font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"] [/font][/size][/font][/size][/font][/size][/font]
[font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"]color = mul(color, textureColor); [/size][/font][/size][/font][/size][/font][/size][/font]
[font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"] [/font][/size][/font][/size][/font][/size][/font]
[font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"]instead of [/size][/font][/size][/font][/size][/font][/size][/font]
[font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"] [/font][/size][/font][/size][/font][/size][/font]
[font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"]color = color * textureColor; [/size][/font][/size][/font][/size][/font][/size][/font]
[font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"] [/font][/size][/font][/size][/font][/size][/font]
[font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"]and [/size][/font][/size][/font][/size][/font][/size][/font]
[font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"] [/font][/size][/font][/size][/font][/size][/font]
[font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"]color = saturate(mul(diffuseColor, lightIntensity)); [/size][/font][/size][/font][/size][/font][/size][/font]
[font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"] [/font][/size][/font][/size][/font][/size][/font]
[font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"]instead of [/size][/font][/size][/font][/size][/font][/size][/font]
[font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"] [/font][/size][/font][/size][/font][/size][/font]
[font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"][font="arial, verdana, tahoma, sans-serif"][size="2"]color = saturate(diffuseColor * lightIntensity);[/size][/font][/size][/font][/size][/font][/size][/font]

Share this post


Link to post
Share on other sites
hey :) ya sample states covered and the different filters have been tried.

[code] samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
...
samplerDesc.MipLODBias = 0.0f;
samplerDesc.MaxAnisotropy = 1;
samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
...
samplerDesc.MinLOD = 0;
samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;[/code]


Maybe a little after image is more normal than I'm thinking?

Share this post


Link to post
Share on other sites
[quote name='ryan mccabe' timestamp='1306082059' post='4814269']Maybe a little after image is more normal than I'm thinking?[/quote]Do you have a cheap LCD monitor with low response times?
If you open mspaint, fill the screen black and then drag a while box across the screen, does it streak too?

Share this post


Link to post
Share on other sites
I had just bought the [font="Arial, Verdana, Helvetica, Georgia"]Asus VE278Q LED, with 2ms gtg. Big, but standard fair . The MS paint test shows that its more the monitor than anything, which is unfortunate. Anyway sorry for the goose chase I suppose, kind of sad that 2ms is so noticeable. [/font]

Share this post


Link to post
Share on other sites
GtG is a horrible and misleading statistic. For gaming, what you really want to know is the worst case response times :'(

GtG only tells you how good it is at eliminating ghosting in slowly changing pictures. Furthermore there's no strictly defined testing standard for GtG tests -- each manufacturer does it differently.

For all you know, the white-to-black response time could be 50ms, because they choose not to tell you that statistic.

Share this post


Link to post
Share on other sites

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