You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My game use Geometry2D.polygon_offset heavily in animating polygons. i need it to be executed each frame for several polygons. After updating from Godot 4.2.2 to 4.3 I noticed significant performance hit.
This performance hit is only when using Geometry2D.polygon_offset with JOIN_ROUND.
I believe this is related to recent update from clipper1 to clipper2 library #90153
my testing with the same input polygon the resulting offset has significantly more points, could be due to precision change.
code for test:
extendsPolygon2D# Called when the node enters the scene tree for the first time.func_ready() ->void:
varpoly=polygonprints("input polygon:",poly,"\n")
varpoly_offset= []
varstart_time=Time.get_ticks_usec()
foriin10000:
poly_offset=Geometry2D.offset_polygon(poly,10,Geometry2D.JOIN_ROUND)
prints("4.3 offset join round:")
prints("execution time:", Time.get_ticks_usec() -start_time)
prints("result size:",poly_offset[0].size(),"\n")
start_time=Time.get_ticks_usec()
foriin10000:
poly_offset=Geometry2D.offset_polygon(poly,10,Geometry2D.JOIN_MITER)
prints("4.3 offset join miter:")
prints("execution time:", Time.get_ticks_usec() -start_time)
prints("result size:",poly_offset[0].size(),"\n")
polygon=poly_offset[0]
result from 4.2:
result from 4.3:
For compatibility reason, new polygon_offset should have the same precision with previous godot version. Or even better expose precision as an option argument to polygon_offset
Steps to reproduce
execute Geometry2d.polygon_offset with JOIN_ROUND as argument
Tested versions
4.3.stable
System information
Godot v4.3.stable - Fedora Linux 40 (Workstation Edition) - X11 - GLES3 (Compatibility) - AMD Radeon Graphics (radeonsi, renoir, LLVM 18.1.6, DRM 3.57, 6.10.12-200.fc40.x86_64) - AMD Ryzen 7 5700G with Radeon Graphics (16 Threads)
Issue description
My game use Geometry2D.polygon_offset heavily in animating polygons. i need it to be executed each frame for several polygons. After updating from Godot 4.2.2 to 4.3 I noticed significant performance hit.
This performance hit is only when using Geometry2D.polygon_offset with JOIN_ROUND.
I believe this is related to recent update from clipper1 to clipper2 library #90153
my testing with the same input polygon the resulting offset has significantly more points, could be due to precision change.
code for test:
result from 4.2:
result from 4.3:
For compatibility reason, new polygon_offset should have the same precision with previous godot version. Or even better expose precision as an option argument to polygon_offset
Steps to reproduce
Minimal reproduction project (MRP)
geometry 2d test 4.2.zip
geometry 2d test 4.3.zip
The text was updated successfully, but these errors were encountered: