Ebiten: graphics: Texel violation with linear filter

Created on 10 Mar 2018  路  8Comments  路  Source: hajimehoshi/ebiten

Edge glitches appears when i draw an image with not FilterDefault and not (45n) angle of rotation.
Is this a known issue?
1

bug

All 8 comments

I think it's a bug. I'd be glad if you could give me a minimum code to reproduce this.

And what machine are you using? If GPU is different, it might be hard to reproduce on my machine.

A few interesting details was found while composing minimum code. Here it is:

import (
    "github.com/hajimehoshi/ebiten"
    "github.com/hajimehoshi/ebiten/ebitenutil"
    _ "image/jpeg"
    _ "image/png"
)

var img *ebiten.Image

func update(image *ebiten.Image) error {
    op := &ebiten.DrawImageOptions{}
    op.GeoM.Rotate(0.234)           //random non 45-degree angle
    op.GeoM.Translate(100, 100)     //just for a fine pic, not important
    op.Filter = ebiten.FilterLinear //non DefaultFilter here needed
    image.DrawImage(img, op)
    return nil
}

func main() {
    //order is important: first load drawable image
    img, _, _ = ebitenutil.NewImageFromFile("ship.png", ebiten.FilterLinear) //non DefaultFilter here needed
    filter := ebiten.FilterDefault                                           //any, doesn't matter

    //then load another image
    //no matter png or jpg
    //as you see we do not do anything with it later
    //ebitenutil.NewImageFromFile("small.png", filter) without variable do the same
    img2, _, _ := ebitenutil.NewImageFromFile("small.png", filter)
    _ = img2

    ebiten.Run(update, 800, 800, 1, "minitest")
}

This error appears with any drawable images.
But not any img 2 files cause a problem: it has to be non-transparent, and probably larger than 128x128. Nature of image doesnt matter, filled rectangle is enough.
This may be important: color is glitches is equal to color of img2 flood color!
scrshot2
May it be some wicked effect with texture packaging when linear filter grabs an edge pixel of adjacent texture?

My system: Win7x64, Radeon HD 7800 series
i do not include images, cz first may be any of size ~100-400 px, and second is easy to generate, but i will attach it on first request

Thank you for the helpful information!

This may be important: color is glitches is equal to color of img2 flood color!
May it be some wicked effect with texture packaging when linear filter grabs an edge pixel of adjacent texture?

Your guess is right. Ebiten tries to share GL textures for multiple image instances as much as possible.

My system: Win7x64, Radeon HD 7800 series
i do not include images, cz first may be any of size ~100-400 px, and second is easy to generate, but i will attach it on first request

OK, I don't have Radeon HD machine, but I'll try this on another Windows machine.

Got same result with Win7x64 GForce GTX 560Ti

Looks like there was a bug in the linear filter. Could you update and take a look? Thank you!

Yay! Dat works! Thanks for fast response )

Great! Thank you very much for the bug reporting!

Was this page helpful?
0 / 5 - 0 ratings