godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.01k stars 21.17k forks source link

Polygon2D texture not displaying correctly. #25049

Open ghost opened 5 years ago

ghost commented 5 years ago

Godot version:

9c1768836f25e780a7ef51a1d18a0a15e0b55e42

OS/device including version:

Win10 64bit

Issue description:

When using a atlas/region texture resource for the polygon texture, it works fine in the polygon editor, but shows the whole source texture in the canvas editor and in game.

From this:

godot_master_2019-01-17_01-21-26

To this:

godot_master_2019-01-17_01-21-40

Steps to reproduce:

  1. Create an atlas texture resource.
  2. Assign it to a Polygon2D's texture.
  3. Create the points of the polygon.

Minimal reproduction project:

3.1 Polygon Texture Issue.zip

reduz commented 5 years ago

They are not really meant to work together. AtlasTexture only really works for sprites and UI, not meshes or polygon.

It could probably hacked in Polygon by detecting its an atlas and ajusting the UVs I guess...

ghost commented 5 years ago

Oh, wondering why the UV/Poly editor handles it. Thanks. It would be very useful if it works out.

The new 2D mesh invites texture parts over sprite sheets, and we use Texture Packer to try to make very tightly packed atlas textures.

I'm not sure of the backend rendering performance, but I'm only assuming that it would still be an issue to load thousands of little textures rather than a few dozen larger ones. We'd really like to make use of mesh warping on these atlas parts to solve very difficult and time consuming blending issues on our characters.

reduz commented 5 years ago

In any case, not urgent for 3.1

reduz commented 5 years ago

@avencherus you can now draw on a single image and then use the polygon drawn tool from the UV editor to make your character, no need for atlas

ghost commented 5 years ago

@reduz Thanks, had a blind spot there, hadn't actually considered that. XD I think since most the textures are intended to be assigned to Sprites. Should be able to re-organize parts into their own texture for polygons and maybe write an import tool.

akien-mga commented 4 years ago

Still reproducible in the current master branch.

jonbonazza commented 4 years ago

Radial TextureProgress still shows whole Atlas Texture instead of selected region, but only on values 100 > x > 0. if value is 100 or 0, it works fine.

ghost commented 4 years ago

Cannot think of a work around for when using Polygon2D as a seamless looping texture, other than not use an atlas for certain textures.

image

KoBeWi commented 3 years ago

Still valid in 3.2.4 beta4

mdarius31 commented 2 years ago

Still valid in 3.4.4

Calinou commented 2 years ago

Related to https://github.com/godotengine/godot/issues/34837.

aXu-AP commented 1 year ago

Should this be solved by adding support for AtlasTexture in CanvasItem.draw_polygon (or in RendererCanvasCull)? Code from #66352 could be moved into that class, enabling the fix on larger scale. Needs to check if there's other places where this was supported explicitly.

Other solution is to modify the editor to show the whole texture instead of the AtlasTexture part of it. Ie. what you see is what you get, and polygons don't support AtlasTexture.