Graphical glitch with drawing textures

Talk about whatever topic you'd like, RPG related or not. (But please discuss things related to our software in the Tools section, below.)

Moderators: dorpond, trevor, Azhrei

Post Reply
Merudo
Giant
Posts: 228
Joined: Wed Jun 05, 2019 7:06 am

Graphical glitch with drawing textures

Post by Merudo »

When I use draw textures with the square tool (with snap to grid), I get weird graphical glitches around the edges of the texture.

For example, I used the following 100 by 100 pixels texture:

Image


You can see that each edge is a different color.

If I put this texture on a 100 by 100 cell (with snap to grid), I get the following image:

Image

You can see the yellow appearing at the very top. If you zoom you can also notice some tiny bit of green on the left side too.

This graphical glitch is no big deal in many settings but when trying to make walls and such by drawing, it really makes the result ugly by creating colored lines where they should be none.

For example, if I try to draw a corner, I get this:

Image

As you can see, there are some tiny strips of brown at the top and the left.

I've also noticed this glitch doesn't happen on cell (0,0), strangely enough.

Phergus
Deity
Posts: 7132
Joined: Fri May 12, 2006 8:56 pm
Location: Middle of Nowhere, NM
Contact:

Re: Graphical glitch with drawing textures

Post by Phergus »

Merudo wrote:
Sun Jul 14, 2019 1:57 am
I've also noticed this glitch doesn't happen on cell (0,0), strangely enough.
Nothing strange about it. 0,0 is where the texture drawing begins from no matter where a drawing is actually placed on the map. This way the texture in all filled areas will line up.

As soon as you get away from a 1:1 zoom, there are going to be artifacts from scaling the "texture" as you get farther from the origin. As your "texture" has single pixel lines on it this will make things even worse as the rounding pushes the single pixel line this way or that way. I'm sure it can be done better but I wouldn't count on it being addressed any time soon.

Drawing building/dungeon walls this way is doing it the hard way. If you want to draw a wall with a texture, just use the free hand or straight line drawing tools and select a texture for the pen color.

Or use your "texture" as a background stamp and just put it down wherever you need it.

Merudo
Giant
Posts: 228
Joined: Wed Jun 05, 2019 7:06 am

Re: Graphical glitch with drawing textures

Post by Merudo »

Phergus wrote:
Sun Jul 14, 2019 9:26 am
Drawing building/dungeon walls this way is doing it the hard way. If you want to draw a wall with a texture, just use the free hand or straight line drawing tools and select a texture for the pen color.
Can't really do corners correctly with your approach, though.

Phergus
Deity
Posts: 7132
Joined: Fri May 12, 2006 8:56 pm
Location: Middle of Nowhere, NM
Contact:

Re: Graphical glitch with drawing textures

Post by Phergus »

You can if you select the square line end instead of round.

Merudo
Giant
Posts: 228
Joined: Wed Jun 05, 2019 7:06 am

Re: Graphical glitch with drawing textures

Post by Merudo »

Phergus wrote:
Sun Jul 14, 2019 9:26 am
Merudo wrote:
Sun Jul 14, 2019 1:57 am
I've also noticed this glitch doesn't happen on cell (0,0), strangely enough.
Nothing strange about it. 0,0 is where the texture drawing begins from no matter where a drawing is actually placed on the map. This way the texture in all filled areas will line up.
I don't think this is correct.

The code in drawBackground() of ShapeDrawable has the part
g.fill(shape);
where shape holds among other things the x and y pixel coordinates of the shape to be filled with the texture.

I don't see how every texture is drawn at 0,0.

Phergus
Deity
Posts: 7132
Joined: Fri May 12, 2006 8:56 pm
Location: Middle of Nowhere, NM
Contact:

Re: Graphical glitch with drawing textures

Post by Phergus »

This is very simple to test.

With the rectangle drawing tool active select a map image (like one of the default ones) for the Fill texture.

Start drawing rectangles on the map. Note that it is like you are revealing the map you chose as the texture as if it was placed on the background layer at 0,0.
Screenshot 2020-03-25 15.30.27.jpg
Screenshot 2020-03-25 15.30.27.jpg (741.03 KiB) Viewed 256 times

Post Reply

Return to “General Discussion”