hajimehoshi / ebiten

Ebitengine - A dead simple 2D game engine for Go
https://ebitengine.org
Apache License 2.0
10.74k stars 649 forks source link

vector: add a utility function to make vector data finer #2884

Closed hajimehoshi closed 3 weeks ago

hajimehoshi commented 7 months ago

Operating System

What feature would you like to be added?

When a vector data is rendered with DrawTrianglesOptions.AntiAlias = true (MSAA actually), unfortunately rendering results for curves are not ideal since the vector data itself is not considered for MSAA: a vector data is not enough for an internal big offscreen.

So, can we make a utility function to make the vector data finer for MSAA?

Why is this needed?

No response

hajimehoshi commented 7 months ago

Or,

package vector

type DrawVectorPathOptions struct {
    // ...
    AntiAlias bool
}

func DrawVectorPath(dst *ebiten.Image, path vector.Path, options DrawVectorPathOptions)

and deprecate DrawTrianglesOptions.AntiAlias?

?

hajimehoshi commented 3 weeks ago
type Quality int

const (
    QualityNormal Quality = iota
    QualityHigh // This is for anti-alias.
)

// SetQuality sets the quality for the result of vertices.
func (*Path) SetQuality(quality)
hajimehoshi commented 3 weeks ago

Until we improve the performance of vector rendering, introducing a high quality rendering (= increasing vertices) would be risky. Now I found a performance issue in examples/fontvector.

image

Apparently, AppendVerticesAndIndicesForStroke is simply heavy.

hajimehoshi commented 3 weeks ago

I failed to find any visible differences by changing the 'allow' parameter at isPointCloseToSegment from 0.5 to 0.25. Thus, I'll close this issue as "wont' fix".