Team Spartan Cookies & Milk Forums
  • Issue Tracker
  • Donations
  • Search
  • Member List
  • Help

Register

Team Spartan Cookies & Milk Forums Garry's Mod Starfall v
« Previous 1 2 3 4 5 … 18 Next »
render.drawPoly() issue with concave polygons
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Threaded Mode
render.drawPoly() issue with concave polygons
14-05-2021, 10:45 PM,
#1
The17thDoctor Offline
TSCM Average Enjoyer
****
Posts: 1,100
Threads: 249
Joined: Oct 2015
render.drawPoly() issue with concave polygons
When drawing a polygon, if a vertex intersects the shape of the polygon without that vertex, it will not render properly
I've added a rough sketch of what should happen vs what happens.


Attached Files Thumbnail(s)
   

The17thDoctor: Server take me to the most handsome person
srcds_linux: I cant send people to themselves...
Website Find
Reply
15-05-2021, 03:53 AM,
#2
57e11a Offline
Cheating Donating Member
***
Posts: 198
Threads: 68
Joined: Apr 2019
RE: render.drawPoly() issue with concave polygons
At the moment, that is just undefined behavior, as the docs say 
Code:
Vertices should be in clockwise order, starting at the upper-left most, and form a convex shape.
But concave poly support would be nice.

she/her
Founder of The Anisu Corporation
[Image: iZUefQi.gif]
Find
Reply
15-05-2021, 09:53 AM,
#3
The17thDoctor Offline
TSCM Average Enjoyer
****
Posts: 1,100
Threads: 249
Joined: Oct 2015
RE: render.drawPoly() issue with concave polygons
(15-05-2021, 03:53 AM)Consolio Wrote: At the moment, that is just undefined behavior, as the docs say 
Code:
Vertices should be in clockwise order, starting at the upper-left most, and form a convex shape.
But concave poly support would be nice.

The thing is that the function supports concave polys up to a point. Could be nice to have full support instead

The17thDoctor: Server take me to the most handsome person
srcds_linux: I cant send people to themselves...
Website Find
Reply
15-05-2021, 02:52 PM,
#4
Veegi Offline
Marker Translator
Posts: 90
Threads: 6
Joined: Sep 2013
RE: render.drawPoly() issue with concave polygons
The built-in function does not support concave polys, as it uses a triangle fan method to render the polygon. In some cases it might work by coincidence.
If it was simple (performance wise) to implement an algorithm to split concave polys into multiple convex polys, we would already be using that.
What could be worth it would be to implement an algorithm that can split arbitrary concave polygons into convex polygons and then use that as a preprocessing step (only once, outside of rendering hooks), feeding the convex polygons to DrawPoly.

Link to the GLua function if you are curious: https://wiki.facepunch.com/gmod/surface.DrawPoly
Polygon triangulation in general: https://en.wikipedia.org/wiki/Polygon_triangulation
Triangle fan triangulation: https://en.wikipedia.org/wiki/Fan_triangulation (It works on a small subset of concave polygons, and is what DrawPoly uses)

ohai
Find
Reply
« Next Oldest | Next Newest »


  • View a Printable Version
Forum Jump:


Users browsing this thread:
Contact UsTeam Spartan Cookies & MilkReturn to TopLite (Archive) ModeMark all forums readRSS Syndication

Powered By MyBB, © 2002-2026 MyBB Group.