-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draw lines and points using triangles #8276
Comments
I think even GLES 3.1 doesn't include support for geometry shaders, so one way or another we need a solution that doesn't require them. At that point the question is - do we build two solutions to this problem, or just one? -[Unknown] |
Though OpenGL ES 3.2 does have geometry shaders. |
That's true, but hardly any devices support ES 3.2 yet, there will be devices with ES 3.1 or lower around for the foreseeable future so we still need a non-geometry shader solution. |
What about this simias/rustation@f6514ed |
Not really, that seems to be doing what we currently do: using glLineWidth or something, which is unsupported on GLES. It also seems to be inaccurate for our needs. Also it's written in Rust. -[Unknown] |
We already sort-of do this for RECT primitives, it would not be very hard to add triangulation of points and lines, a nice little project. Geometry shaders are probably not worth it as they are (almost) only available on PC, which will easily be fast enough for software triangulation anyway. |
Geometry shaders are starting to show up on mobile devices using Vulkan (for example, my Galaxy S8 has them after upgrading to Android 8.0 Oreo) but still, we probably shouldn't use them for this, instead we'll just do the same we do with rectangles - transform them in software and split into triangles, as discussed. @unknownbrackets , you had some WIP code for this, right? You removed it from #8270 , and now I can't find it. |
Oh, sorry, yes. It's not doing many things, I was just trying to get it to draw the lines in Ridge Racer (#8509) as a test but didn't account for diagonal lines (perpendicular unit vector for width, I guess?), or more importantly transform (could possibly just multiply to get the perpendicular unit vector?) Pushed it here after a quick rebase: But the speedometer wasn't working iirc and I forgot about it... -[Unknown] |
Thanks. Getting a perpendicular vector is very easy: rotate90(x, y) = (-y, x). So not much complicated math needed really. |
Right, but wasn't so sure about transform (since we want to do that in screen coordinates - which software transform doesn't do.) I think you'd suggested just transforming the entire line into through, which I haven't really thought through. -[Unknown] |
Well we already do it with rectangles. We put the two points defining them through software transform and out they come in screen space, at which point we expand them in 2D. Same would go for lines and points. EDIT: Never mind, it's not that easy - the space we expand rectangles in is before projection and that's inappropriate for the scaling of lines and points. |
Hi there But how about Test Drive Unlimited minimaps lines? Here's a GE dump: |
I tried this frame dump on a PSP, but there's some post-processing at the end which seems to be pulling from a previously renderered frame, and so it's hard to compare. Just noting for later. -[Unknown] |
Drawing Lines using triangles is a bad idea for Echochrome and Test Drive Unlimited Mini-map, see (#15556) |
Nah, it's a good idea, just seems like there's some bug to fix in the implementation. But thanks for tracking it down. |
Points and lines are drawn using triangles now. There's still some things that could be improved, but there are already other issues open for them. I'm going to close this. -[Unknown] |
Some games use lines and points (not a ton.) At higher resolutions than 1x, these draw incorrectly, especially on mobile.
We currently use glLineWidth and glPointSize to emulate these on desktop. However, glLineWidth is deprecated - it won't work in Core Profile (Mac) and is unsupported in GLES. Further, lines still draw incorrectly even with this - especially at non-even resolutions.
See #8270 for more discussion on how to technically construct lines/points using polygons. Ideally some testing on how these work in transform mode (especially width) might make sense.
This would fix #3871 and #3332.
As noted in #3332, line caps can be a concern.
-[Unknown]
The text was updated successfully, but these errors were encountered: