V-sync and crispy textures
I've noticed something strange in my engine:
- v-sync on = all good
- v-sync off = lit textures look 'crispy' (sand like) when I move the camera
- turn it on again, still crispy
When I restart my application with v-sync enabled it's all good.
I update vsync realtime by:
- change present parameters (default vs intermediate)
- on lost device/ reset/ on reset device
Any idea what might be causing this?
From my experience "crispy" textures usually comes from point filtering on texture samplers or disabled mip-mapping. Have you tried starting with vsync off? Something may be getting fubar'd during device reset.
Wouldn't grainy / crispy textures indicate a lack of mipmaps? Or maybe incorrect texture sampler settings?
[Edit] Oops, Voidmancer beat me to it.
If you take a screen shot with and without the crispy textures, do you see a difference in the still images? Perhaps you could post a before and after image, which would help to figure out what the issue is.
Do you just have an extremely high frame-rate and it's just plain old screen tearing?
Reenabling vsync still shows the problem, so I doubt it has to do with that.
I'd imagine it's some reinitialization oversight (if it's reinitializing the video hardware), otherwise I have no idea.
As others have alluded too, it sounds like a mip-mapping issue, rather than an engine issue.
Have you created mipmaps for your entire image chain, and are you reloading them after each device lost/reset event?
Thanks for all pointers and replies.
I did some more testing and made some screenshots/ still images:
1. With v-sync
2. Without v-sync
3. Without v-sync at start (no switching)
It appears that results 1 and 3 are the same, so that probably means it doesn't have anything to do with V-sync.
Maybe something with the resetting of the device.
Below are the 3 screenshots and my reset code, what would you think?
With V-sync:
Without V-sync:
And without V-sync, at start (no switching):
Some code:
/**************************************************************************************/
/*** SET VSYNC ***/
/*** ==> usage: enables or desable vsync for d3d rendering ***/
/*** ==> updates the vsync bool in the d3d settings struct and resets the device ***/
/**************************************************************************************/
bool CD3d::SetVsync(const bool pVsync)
{
if(mSettings.GetVsync() == pVsync) return false;
mSettings.SetVsync(pVsync);
if(mSettings.GetVsync()) mD3dpp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT; // v-sync ON
else mD3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; // v-sync OFF
OnLostDevice();
while(!ResetDevice()) ResetDevice();
OnResetDevice();
return true;
}
// input handling routine
if(_input.KeyPressed(VK_F4)) // PRESSED
{
if(!_d3d.mSettings.GetVsync()) _d3d.SetVsync(true);
else _d3d.SetVsync(false);
}