steincodes/godot-shader-tutorials

Polygon2D-based fragment shaders?

insomniacUNDERSCORElemon opened this issue · 3 comments

Most shader info I've seen focuses on textures... from testing, that workflow doesn't work for polygons, especially ones that use UV mapping or repeating textures (and for related reasons, built-in gradients).

Does Godot's (fragment) shader system have any way to reference the polygon in some way (possibly coordinates as if it were a texture), so things like outlines and glows can be done without rendering the polygon to a texture first?

And what about the other features of polygons, like the color and vertex color? It seems like if those were supported as layers (along with the texture, and supporting order and blending) it'd allow for much greater flexibility without needing to manually stack nodes with redundant data. Although simple control (shader on top of or blended over existing colors) would be a good first step if it doesn't exist already.

Sorry for late reply. Yes it should work. I remember someone using Polygon2D to create an awesome tool for Godot that used UV Mapping and Textures.

But this deserves some looking into I will mark it for Triaging.

I'm not exactly sure what you mean when mentioning UV mapping and textures, but I'm not super interested in a work-around via a plugin unless maybe a powerful free plugin is created and well supported.

To be clear, my 2nd paragraph is most important here, and to add: it'd be optimal to not need textures (or screen-reading shaders) at all to have full shader support on 2D polygons. I'm aware those can be used to create shader effects-like an outline or glow-for 2D polygons, but that's likely tedious/limiting to the point where it's much less viable to use (especially for beginners or jam games going for a crisp polygonal art style).


I'm guessing Godot does not support most/all of what I've listed (especially in an easily usable form)... and if that is indeed the case, knowledgeable people should write down what should be done (be that for Godot itself or a community plugin).

This would be a helpful fix.