Skip to main content
GameDev.net gamedev.net
🔒 Locked

Strange vertex artifacts on iphone4s, doesn't appear on simulator

Started by Njguy Jun 7, 2015 at 3:43 AM 8 replies 3.8k views
Original Post
Njguy
Njguy

In the pictures below there is a green background with an orange foreground. The orange foreground is literally a 2d mesh. The curved outline is actually the mesh geometry itself. In the top picture it draws nicely on android and the iphone4s simulator. On a real iphone 4s it is jagged and messed up as shown on the bottom screenshot. I am reading in the vert data from a binary file. The iphone and the iphone simulator print the verts seemingly in an identical way. Does anyone have any idea's why the mesh draws nice on the simulator but not the real iphone? I've never encountered this one before.

Good (iPhone4s Simulator)
lLvI6ga.jpg
Bad (Real iPhone 4S)
F3sBB7u.jpg
phil_t
phil_t

Could be an issue with depth buffer precision. Are you drawing with the depth buffer enabled? What are the values for your near/far plane? How far is your sphere from the camera?

Hodgman
Hodgman
What primitive type are you drawing, and what data format are the vertex positions in? What precision are the vertex shader variables involved in transforming the positions?
Erik Rufelt
Erik Rufelt

Is the exact mesh outline exactly the triangle edges, or is there also transparency involved?

Could be that lowp shader variables aren't actually lowp on simulator, which is also dependent on the GPU model on the device.

alh420
alh420

Definitely looks like there is some problem with the precision of the vertices positions as previous posters imply.

Look at those shading errors, and jaggedness in the inside of the mesh, on that orange edge.

Apart from the data format used, what is the size of it, is it using big or very small numbers in vertices positions?

Njguy
Njguy

Wow thanks guys. Turns out I had specified medium precision in my shaders. I changed it to high and the issue was resolved. I didn't realize there was that much difference between the two. Kind of scary actually because mediump really had the verts in the wrong locations. It wasn't an issue on my android phone though. Looking good now though. Much appreciated.

L. Spiro
L. Spiro
Sometimes it is more about your shader practices than the precision of the position values.
This may reveal that you just have bad coding practices that are simply exposed via medium-precision floats, and raising them to high-precision not only comes at a cost but hides the underlying issue.
For example, do you multiply a single point by multiple matrices or just a single world-view-projection matrix? Unnecessary matrix multiplications on the same point is yet another performance problem that would remain, on top of the cost of higher precision.
What is the range of numbers in use here? You shouldn’t have this kind of issue if your numbers remain reasonably small.


L. Spiro
I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid
Njguy
Njguy

Sometimes it is more about your shader practices than the precision of the position values.
This may reveal that you just have bad coding practices that are simply exposed via medium-precision floats, and raising them to high-precision not only comes at a cost but hides the underlying issue.
For example, do you multiply a single point by multiple matrices or just a single world-view-projection matrix? Unnecessary matrix multiplications on the same point is yet another performance problem that would remain, on top of the cost of higher precision.
What is the range of numbers in use here? You shouldn’t have this kind of issue if your numbers remain reasonably small.


L. Spiro

I only pass in a single mvp matrix to the shader.

L. Spiro
L. Spiro

…and the range of visibility and the range occupied by the model?

L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid
Rattenhirn
Rattenhirn

My guess is that either the position or texture coordinate attributes are lowp or that one of the variables is. If you'd post the shader code, we could confirm.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.