I’m thinking about making a character entirely out of Polygon2D nodes without textures. One thing I haven’t figured out how to do is make each polygon cast a “permanent” shadow on top of the ones that are Z levels below it.

Below is an image of what I want to do, but using shaders/lights. I’ve only managed to do this by making extra polygons to fill in as the shadows.

How exactly do I have to set up a light source to achieve this effect? Using a DirectionalLight2D or a PointLight2D just brightens the polygons and I can’t figure how to use a LightOccluder2D, or even if this is the correct way to get this result

(The polygons are green due to the DirectionalLight being green) - The occlusion simply applies the shadow on anything that is Z levels below it.

You are viewing a single thread.
View all comments View context
4 points

That’s exactly the kind of thing that I need, just a shame I need to have a texture on the polygon and, code as is, it offsets the texture a lot compared to the polygon’s center. While not “ideal”, I can probably work with this, though creating anything other than squares will be quite a pain if I don’t use large textures, due to the zoom level of Godot’s UV editor

I’ll mess around and see if I can get it to work as I want until a more definitive solution shows up, thanks!

permalink
report
parent
reply

Godot

!godot@programming.dev

Create post

Welcome to the programming.dev Godot community!

This is a place where you can discuss about anything relating to the Godot game engine. Feel free to ask questions, post tutorials, show off your godot game, etc.

Make sure to follow the Godot CoC while chatting

We have a matrix room that can be used for chatting with other members of the community here

Links

Other Communities

Rules

  • Posts need to be in english
  • Posts with explicit content must be tagged with nsfw
  • We do not condone harassment inside the community as well as trolling or equivalent behaviour
  • Do not post illegal materials or post things encouraging actions such as pirating games

We have a four strike system in this community where you get warned the first time you break a rule, then given a week ban, then given a year ban, then a permanent ban. Certain actions may bypass this and go straight to permanent ban if severe enough and done with malicious intent

Wormhole

!roguelikedev@programming.dev

Credits

  • The icon is a modified version of the official godot engine logo (changing the colors to a gradient and black background)
  • The banner is from Godot Design

Community stats

  • 788

    Monthly active users

  • 237

    Posts

  • 852

    Comments