the-mallory/factorygame

Vertex Array separation on certain graphics cards

Closed this issue · 3 comments

Minor vertex array glitching of the terrain can occur during motion on certain graphics cards (GT 730M). Potentially caused by using float values in vertex assignment (check values used?).

Fixed. The issues was due to pixel rounding, and was solved by offsetting each corner of the triangle 0.5 in the x and y away from the center of the overall quad. The issue was likely due to the vertices being on the corner of four pixels, forcing some hardware to select a certain pixel of their choice, leading to some GPUs displaying this issue.

This issue seems to go deeper than I expected. Although not as obvious as previously before the round fix, it still occurs in different ways now. Now, sometimes the texture is overdrawn (too much of the texture is selected and drawn) at specific view scales and positions. It seems to be most obvious when the camera is aligned along some integer positions, as adding a non integer float to the rounded down camera position and using that seems to fix the issue.

I seem to have implemented something of a fix, by clamping the new view size to powers of 2. Seems to have reduced any noticeable issues as far as I can tell, but does lead to some weird scales at certain window sizes. Will close for now.