Maintenance - We're currently working on things and you might experience some issues. Should be wrapped up soon!

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.

2
Make Second Camera Mimic Camera 1.
Post Body

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

  1. adding geometry "shell" in blender (must be done for every mesh, oof)
  2. doing it with a shader (cuts into geometry in weird ways and doesn't look great)
  3. 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)

https://preview.redd.it/kjwfy8ii2pjc1.png?width=566&format=png&auto=webp&s=bd6867eb3c437e70e441d052250d2567dcce48d4

Author
Account Strength
90%
Account Age
3 years
Verified Email
Yes
Verified Flair
No
Total Karma
6,007
Link Karma
680
Comment Karma
5,317
Profile updated: 3 days ago
Posts updated: 1 month ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
9 months ago