Jump to content

View more

Image of the Day

「筋肉兄貴のスーパーラン!」
兄貴に立ちはだかるダンボール・・・(´・ω・`)
ムズい・・激ムズって感じにそろそろ変わってきます。
(o・ω・o)
 #indiedev  #indiegame #screenshotsaturday https://t.co/xKIzRQMdHm
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net's newsletters to receive the latest updates and exclusive content.


Sign up now

Is this a v-sync issue?

2: Adsense
  • You cannot reply to this topic
4 replies to this topic

#1 gearifysoftware   Members   

115
Like
0Likes
Like

Posted 02 March 2017 - 05:50 PM

I am using OpenGL 4.x with SDL2 for my window initialization. Running on an HP laptop with an NVidia Quadro K1100M.

I believe I have the necessary configurations set for vsyncing, such as:

SDL_GL_SetSwapInterval(1);
SDL_SetHint(SDL_HINT_RENDER_VSYNC, "1");

Also, set vertical sync to 'On' in my NVidia Control Panel. 

but if you view the video below, it looks like there is some issue with the vertical redraw. Idk if this is an issue with VSync, with double buffering, or with something else.

 

Note in the video when I move the texture in view left to right, no issues are visible, but when i move forward and back, you see them clearly. The artifacts are much more noticable toward the top of the screen where the texels are taking up fewer pixels.

https://www.youtube.com/watch?v=Xs37hcnMZFI&feature=youtu.be&hd=1

Can anyone confirm that this looks like a VSync issue, or any ideas for what it might be? Much appreciated.



#2 ncsu121978   Members   

1241
Like
1Likes
Like

Posted 02 March 2017 - 06:58 PM

doesnt look like a vsync issue.  looks like the texture you are using for the ground is very noisy meaning the values at individual x,y locations arent very coherent.  yeah its green....ish.  but still very different on neighboring pixels.

 

As you move your matrices get changed and when the matrices change the pixel from the texture actually rendered to a specific pixel on your screen changes.  and when neighboring pixels are very different you will get the effect you are seeing.  at least that is what it looks like to me.

 

so change your texture, or there are same sampling values i think you can set in opengl to not just use the exact pixel from the texture but something like an average of the surrounding ones.  that would probably help some.



#3 gearifysoftware   Members   

115
Like
0Likes
Like

Posted 02 March 2017 - 07:41 PM

so change your texture, or there are same sampling values i think you can set in opengl to not just use the exact pixel from the texture but something like an average of the surrounding ones.  that would probably help some.

 

 

Thanks for the response. 

 

I was using GL_LINEAR for my texture magnification and minification, which I believed would handle this. 

I tried replacing this with: GL_LINEAR_MIPMAP_LINEAR, and it very nicely cleaned up the grass texture.

screenshot_game_zpsjysdol4b.png

 

I had thought that GL_Linear would have handled the averaging of the texture elements though? I don't know why it would require mip-map to not create so much noise.

I am, still, seeing some weird visual distortions when panning/rotating the view vertically, so it looks like I may have two issues at work here, but I'd like to just figure out what's going on with the texture first, before looking at that.



#4 xtrium-lnx   Members   

128
Like
2Likes
Like

Posted 03 March 2017 - 06:52 AM

Linear filtering and mipmapping are two very different things.

While linear filtering does average neighbour pixels in a texture, the fact that the ground plane is near-parallel to the view means that the further from the camera, the more texels per screen pixels there is. Since your texture is quite high-frequency (lots of changes over a tiny area), it means lots of information is lost and it create moiré patterns - what you had on the video.

This is where mipmapping helps. It actually creates scaled-down versions of your texture and the gpu automatically selects which mip level to use depending on the distance from the fragment to the camera, so that what is displayed far away is actually a blurred version of your original texture.

Note that you can filter linearly between mip levels (_MIPMAP_LINEAR) but also in a "nearest neighbor" fashion (_MIPMAP_NEAREST). The linear mode transitions smoothly between mip levels while the nearest mode transitions abruptly from a mip level to the next.

Sometimes, even that does not solve your problem completely. You might want to take a look at anisotropic filtering, though (in GL, glGetTexParameterfv with the GL_TEXTURE_MAX_ANISOTROPY_EXT property, see https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_texture_filter_anisotropic.txt for detailed info but there's plenty of tutorials out there :) ).


Edited by xtrium-lnx, 03 March 2017 - 06:55 AM.


#5 gearifysoftware   Members   

115
Like
0Likes
Like

Posted 03 March 2017 - 02:27 PM

Thank you both so much for your insightful responses! That resolves my texturing issue, but I am still having a few distortions when moving/rotating vertically.  I'll need to get another screen capture for it. Will update later.

Thanks again!