Unlit shader that receives shadow and fog

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

Hey everyone,

I would like to have an unlit constant color material that receives and casts shadows and also reacts to depth fog.

i gotta admit that i am kind of overwhelmed by shaders and i usually just copy paste stuff i find from the web.

For Unity i used a shader from this thread:

By copy pasting some fog lines i managed to make it work with fog too.

Unfortunately im not sure how to do this in godot. Would like to use the WorldEnvironent depth fog but it only seems to work with shaded materials.

If anyone can point me into the right direction it would be much appreciated!


:bust_in_silhouette: Reply From: AlphinAlbukhari

Does unlit means unshaded? Then all you need is to fake the “unshaded”
In this case, light shader is your friend
Basically, just multiply the albedo with attenuation, without any light calculation so it wont receive light

enter image description here

Anyway, you can make it even more unshaded by disabling the ambient light, but you might need to tweak the attenuation

enter image description here

For depth fog, not sure but maybe related to how Godot calculate it