Top Down See-through/Transparency shader
Asked Answered
O

2

0

Is there anything like this Unity Asset for Godot possible? I am working on a 3D Top down game but there should be also multilevel buildings (up to 5 stores or more) and i dont see any other possibility for this then a shader which removes all elements that are blocking the players view like buildings, trees/vegetation, vehicles (helicopter), ...

The mentioned unity asset:
https://forum.unity.com/threads/released-see-through-shader-make-your-playable-characters-visible-within-buildings-std-urp-hdrp.1182130/
Live demo:
https://www.shadercrew.com/Home/Demo

Oceanus answered 18/8, 2022 at 13:56 Comment(0)
O
0

I have something like this:

render_mode blend_mix,depth_draw_opaque,depth_prepass_alpha,cull_disabled;
void fragment() {
	vec3 worldPos = (inverse(MODEL_MATRIX) * INV_VIEW_MATRIX * vec4(VERTEX, 1.0)).xyz;
	vec3 playerPos = vec3(-0.5f, 0.2f, -1.0f);
	float radius = 2.0f;
	if (worldPos.y > playerPos.y)
		if (abs(worldPos.x - playerPos.x) < radius && abs(worldPos.z - playerPos.z) < radius)
			ALPHA = 0.0f;
}

But how do i apply this to every material? Next pass is not working because it does not change the transparency and the color at the same time. And when i export a model from blender into gltf/glb the material gets overriden again...

Oceanus answered 18/8, 2022 at 15:23 Comment(0)
O
0

So this approach works so far, the only problem is that the shadows get also trough the alpha values, so my sun is shining trough the massive hole im creating which is not intended.

Is there a workaround for this?

Oceanus answered 19/8, 2022 at 7:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.