Rendering one object differently on two separate viewports

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By pixelsnpings

Hi, I’m in the research phase for a game I want to write. This game will have an interactive mini-map of the game world. This will be a 3d map though. So my question: Is there an easy way to configure the primary viewport to use one shader for rendering a game object and configure another viewport for the mini-map to use a different shader to render the same object? The second would be a low-res version that looks like a computer display in the hud. Alternatively, design a shader that knows which viewport it is currently being used with that, alters the rendering procedure for the mini-map. This is all conceptual. Thanks for your input!

Have you looked into rendering a Viewport onto a texture?

Ertain | 2021-02-04 05:09

:bust_in_silhouette: Reply From: yrtv

You can make material local to scene. So if minimap and main game reside in separate scenes it should be possible to use two different shaders for the same mesh, while keeping the rest of material parameters synchronized. I do not know if it actually works.

I was wrong above. While Viewport can use it’s own World no Resources registered by Spatial nodes affects rendering(Local Materials will not work). Without extending engine in c++ only way to render same world differently from second camera is Custom post-processing — Godot Engine (stable) documentation in English