Jump to content

  • Log In with Google      Sign In   
  • Create Account

V-sync and crispy textures

  • You cannot reply to this topic
8 replies to this topic

#1 cozzie   Members   -  Reputation: 1613

Like
0Likes
Like

Posted 02 September 2014 - 03:31 PM

Hi,
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?

Sponsor:

#2 Hodgman   Moderators   -  Reputation: 30388

Like
0Likes
Like

Posted 02 September 2014 - 03:51 PM

Do you just have an extremely high frame-rate and it's just plain old screen tearing?

#3 Voidmancer   Members   -  Reputation: 115

Like
2Likes
Like

Posted 02 September 2014 - 05:36 PM

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.



#4 /Jeff/   Members   -  Reputation: 649

Like
0Likes
Like

Posted 02 September 2014 - 05:38 PM

Wouldn't grainy / crispy textures indicate a lack of mipmaps? Or maybe incorrect texture sampler settings?

 

[Edit] Oops, Voidmancer beat me to it.


Edited by jrh2365, 02 September 2014 - 05:39 PM.


#5 Jason Z   Crossbones+   -  Reputation: 5062

Like
0Likes
Like

Posted 02 September 2014 - 06:04 PM

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.



#6 Sik_the_hedgehog   Crossbones+   -  Reputation: 1748

Like
0Likes
Like

Posted 02 September 2014 - 07:33 PM

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.


Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.

#7 mark ds   Members   -  Reputation: 1268

Like
0Likes
Like

Posted 02 September 2014 - 07:34 PM

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?


Edited by mark ds, 02 September 2014 - 07:36 PM.


#8 cozzie   Members   -  Reputation: 1613

Like
0Likes
Like

Posted 03 September 2014 - 02:35 PM

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:

crisp_vsync.jpg

Without V-sync:

crisp_novsync.jpg

And without V-sync, at start (no switching):

crisp_novsync_atstart.jpg

 

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);
		}
		


#9 cozzie   Members   -  Reputation: 1613

Like
1Likes
Like

Posted 03 September 2014 - 02:41 PM

Update: I found it, after resetting the device, I wasnt't 'resetting'/initializing my state machine.

So all d3d states (render, texture, sampler) were los and not recovered, all good now (probably texture filtering).

Thanks again for helping me in the right direction.







PARTNERS