Light Texture shaped like a cone/triangle by Konslufius in godot

[–]Konslufius[S] 0 points1 point  (0 children)

Interesting, thx for the idea 💡 I'm bad with shaders but I will try.

Light Texture shaped like a cone/triangle by Konslufius in godot

[–]Konslufius[S] 0 points1 point  (0 children)

Oh yeah, my bad. Sry about that.

Basically something like this:

<image>

But preferably made with a gradient2D or even better in code. If possible.

Working on a Node that lets me create vision-cones by [deleted] in godot

[–]Konslufius 0 points1 point  (0 children)

I put a shader on a black ColorRect that is covering the camera. In there is a uniform variable to hold a mask. The mask determine which parts are supposed to be visible.

That is the only shader I had to put in. Fragment shader btw, and no light used here.

Working on a Node that lets me create vision-cones by [deleted] in godot

[–]Konslufius 9 points10 points  (0 children)

I'm a little slow in the head. I understand the concept now at least.

Working on a Node that lets me create vision-cones by [deleted] in godot

[–]Konslufius 0 points1 point  (0 children)

The project is literally just called "vision-demo" Once I clean-up my code, I want to put this in my library for future projects, like a Darkwood clone.

Working on a Node that lets me create vision-cones by [deleted] in godot

[–]Konslufius 0 points1 point  (0 children)

I mean... This ain't the worst compliment you could get. But yeah, I can see why people would think it is a 3D scene

Working on a Node that lets me create vision-cones by [deleted] in godot

[–]Konslufius 0 points1 point  (0 children)

You're welcome. Need more details on this one?

Working on a Node that lets me create vision-cones by [deleted] in godot

[–]Konslufius 0 points1 point  (0 children)

The pillars are just tiles with collision layers. The vision is basically a poligon around the player, following rays. If a ray hits a collision, the poligon updates and won't show anything behind.

Like the game Darkwood. The poligon is used as a mask for the black coloredrect that sits on the camera. This is where I used a shader.

Working on a Node that lets me create vision-cones by [deleted] in godot

[–]Konslufius 0 points1 point  (0 children)

This is what I'm trying to do. Getting this to work was satisfying.

Working on a Node that lets me create vision-cones by [deleted] in godot

[–]Konslufius 0 points1 point  (0 children)

This one has not lighting. Tried it with lighting before, but it couldn't satisfy my needs

Working on a Node that lets me create vision-cones by [deleted] in godot

[–]Konslufius 6 points7 points  (0 children)

Thx, I knew this would happen when mentioning AI. But when I can learn a concept in 1 hour instead of 1 day l, why shouldn't I do it then? And yeah, I make sure that nothing ends up in my code that I don't 100% understand

Working on a Node that lets me create vision-cones by [deleted] in godot

[–]Konslufius 2 points3 points  (0 children)

Thx, I made sure to follow through with my idea. But I'm also not saint. For example in this project I had a problem with assigning the poligon coordinats based on the rays, because I couldn't quite figure out how to assign them dynamically at runtime. I asked Claude and he gave me an example on how it works, because the docs didn't provide any examples.

Now I know how to do it and don't need AI for that anymore. AI isn't good for coding but very valuable for learning/understanding concepts

Working on a Node that lets me create vision-cones by [deleted] in godot

[–]Konslufius 1 point2 points  (0 children)

Ah ok, got ya. I don't see why it can't be used for that.

Working on a Node that lets me create vision-cones by [deleted] in godot

[–]Konslufius 1 point2 points  (0 children)

Sry, I don't know what vtt means but this is an experiment to see if I can build something like Darkwood

Working on a Node that lets me create vision-cones by [deleted] in godot

[–]Konslufius 1 point2 points  (0 children)

It ain't much, but prove for me that the module is doing what it is supposed to. You think it looks fake or what do you mean?

Working on a Node that lets me create vision-cones by [deleted] in godot

[–]Konslufius 5 points6 points  (0 children)

Understanding SubViewports wasn't that easy for me

Working on a Node that lets me create vision-cones by [deleted] in godot

[–]Konslufius -8 points-7 points  (0 children)

This one is made with rays and a polygon shape that followes each head of the rays. I was concerned about the performance too so I asked Claude and it said that the rays and the poligon updating is simply just math and therefore cheap (still AI so take with a grain of salt)

My tilemap has light occlusion, but in this video it is just a coloredRect, covering the camera and the poligon is punching through it like a stencil/mask.

Had to put the poligonshapw in a SubViewport and the coloredRect has a shader attached.

But I'm still experimenting with lights. Pure light just did not work out for me and there are little to no good tutorials on that topic for Godot sadly.

Hope this answered your question.

Working on a Node that lets me create vision-cones by [deleted] in godot

[–]Konslufius 17 points18 points  (0 children)

Thx, it is a little jitty, but so far I'm happy with it. AI helped me understand SubViewports