22
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
this post was submitted on 09 May 2026
22 points (100.0% liked)
Godot
7635 readers
8 users here now
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
- !inat@programming.dev
- !play_my_game@programming.dev
- !destroy_my_game@programming.dev
- !voxel_dev@programming.dev
- !roguelikedev@programming.dev
- !game_design@programming.dev
- !gamedev@programming.dev
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
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
founded 3 years ago
MODERATORS
A hint i found on Reddit (yikes, i know) from someone who made a nice github with their solution.
Their idea is to pass the player position to the objects shaders, and then to get 2 differents normals : from object to player, and from object to camera. Once you have those, you can make a dot product to tell if they are in the same direction or not (>0.0 if their angle is less than 90°, <0.0 if it's greater, 0.0 would correspond to a 90° angle). Beware, i believe it's best to normalize both your vector to a length of 1, before using dot product if you want to get accurate results.
So once you have a negative dot product, you know both direction are opposite, so the object is between the camera and the player, and should be hidden.
On top of that, they limit that effect to a small circle around the player, to avoid making objects transparent all over the screen. You'd have to find out how to limit that effect to the field of view of the player, and i sadly have no real idea about that.
The player's view is just another normal. If you set an angle range for how large their field of view is, and then check that the player's normal and the vector from object to player are parallel enough, it shouldn't be too hard.
Oh, yes quite smart and maybe also computing the distance between the player and the object, to avoid making transparent objects that are in player's sight but very far away