#Alternative to POLYGON_MODE_LINE?

19 messages · Page 1 of 1 (latest)

rich atlas
#

Hi there,

is the an alternative to POLYGON_MODE_LINE that's available in the browser?

I'm trying to fake it in fragment shaders based on thresholds and barycentric coordinates but I notice it's quite non-trivial with inconsistent line width based on distance from the camera.

Wireframe looks fine (with a bit of tweaking) but it causes a panic in the browser because POLYGON_MODE_LINE isn't available.

#

Huh... https://mattdesl.svbtle.com/drawing-lines-is-hard Maybe I should read that.

#

I suspect that I might just have to generate some triangle geometry to fake drawing lines... Basically, I'm trying to fake a wireframe look in my game.

#

This might actually be non-trivial, lol. This might be fun; might even have to involve some vertex shaders and such :3

narrow swan
#

You should use bevy gizmos. They should work in the browser and don't use the polygon mode

#

It essentially does what you probably wanted to do which is to draw lines using a quad

rich atlas
#

Gizmos? Neat, gotta see what that’s about

#

It's gonna halfway clip into the walls, isn't it?

narrow swan
rich atlas
#

I think I could prevent them from clipping into faces if I offset them the line width off the normal of the surface?

narrow swan
#

I'm not sure which clipping you are referring to

rich atlas
#

Well, since I assume that gizmos are not just 1 pixel lines but rather very thin quads/triangles, the triangles technically can clip into other geometry and not actually look constant-width

#

Eh, they'll probably be close enough

#

I'm betting this will be one of those things literally only I notice about my own game

narrow swan
#

clipping and constant width are 2 different and unrelated things. I believe there's an option to keep the gizmos always on top

rich atlas
#

Eh, I'm sure it'll be fine

#

Woo!

Definitely need to play around with depth biasing, but I'm sure I can make this work. Thanks for the tip!

#

Ok yeah that's basically perfect, thanks!