Outline in Godot 4 without viewports

preview_player
Показать описание
Godot 4 very simple (but cool) outline shader without viewports

search on github: anunknowperson/Godot4SimpleOutline/

(i can't insert link because youtube doesn't allow it without many videos on channel)
Рекомендации по теме
Комментарии
Автор

shader_type spatial;
render_mode unshaded, cull_front;

uniform bool enable = true;
uniform float outline_thickness = 0.01;
uniform vec4 color : source_color = vec4(0.0);


void vertex() {
if (enable) {
VERTEX += normalize(VERTEX) * outline_thickness;
}
}

void fragment() {
if (enable) {
ALBEDO = color.rgb;
}
}

CrowGamesDev
Автор

Is there a way for the outline to change contrast/brightness and thickness depending on whether there is a light

ExoCheva
Автор

Questions,
1. Will it look odd if we use texture on the mesh?
2. Will the outline break if the shapes are rectangular or ones with edges?

agriasoaks
Автор

How does this differ from just using the 'grow' parameter on the material itself? You know - the standard procedure: Cull front face, lighting mode unshaded, albedo black, enable grow and set it to some small number. I guess that's what the shader is doing?

vojtastruhar
Автор

Do you know how to access to the shader parameter using code? I tried everything and I can't enable/disabled using code T-T

ElrincondeDave