This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
you know in a 3D game where you see an item with a nice white border around it to "highlight" it?
That's what I'm attempting to implement.
There are three ways
- adding geometry "shell" in blender (must be done for every mesh, oof)
- doing it with a shader (cuts into geometry in weird ways and doesn't look great)
- doing it with a viewport, which only shows the true outline of the shape without additional geometry
we're going with method 3.
found this project:
https://www.reddit.com/r/godot/comments/jzqnxe/godot_3d_outline_using_viewport/
this project uses 1 stationary camera and achieves the desired effect.
However, The issue is, this is a game, so Camera1 is usually the players, i.e. never stationary, and it's going to move. Therefore Camera2 must exist to be the viewport camera, and therefore Camera2 must move with Camera1 to achieve the desired effect.
Ideally, Camera2 appears in the same position/rotation of Camera1 at all times. Whenever Camera1 is moved or translated, so is Camera2.
So, how do I accomplish this?
[edit]
Eventually found a solution
Initially, I tried multiple tweaks to "match" the camera, but the cameras would never align entirely.
Eventually,
I put these two lines in my _process(delta) function:
Camera2.global_rotation= Camera1.global_rotation
Camera2.global_position = Camera1.global_position
which just sets the global_position of Camera2 to be Camera1's
This seems to work. I made the lines purple, but could make it any colour dependent on item rarity. the weird artifact on the bottom with the inner line is caused by it thinking the object ends, due to a directional light. so I simply disabled the directional light from rendering on the Viewport layer (20)
Post Details
- Posted
- 9 months ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/godot/comme...