Hello everyone, I am searching for a way to let the camera see through obsticles like walls, when these obsticles are between Camera and Player target. Like in many 3rd Person Games, without disapearing completely but becoming half transparent.
Half transparent obsticles Camera Function
You can use the enable Distance Fade property in SpatialMaterial and configure the minimum/maximum distance accordingly. To prevent the object from going through the transparent rendering pipeline (which is slower and causes sorting issues), set the distance fade mode to Object Dither (or Pixel Dither for large objects).
Thanks! But doesn't that make the wall full non visible? I want the opacity to be affected, so you can see through the wall but still can see the wall.
- Edited
Object Dither works with binary values rather than smooth scalar values but it still can achieve that semi transparent look, sort of, by controlling the amount of pixels visible. Look up examples of dithering I guess.
I'm not sure if you can set a limit to how far it can disappear so yes there is a chance it might make the wall completely transparent but I think that would be the case with Distance fade either ways. That is to say it's not specific to object dither.
You could try having 2 materials on your wall though, one that is visible most of the time with the distance fade property making it fade under specific conditions and a 'bottom layer' that gets revealed by the distance fade that is always set to a specific transparency value.
Note that this will mean at least 2 draw calls per each wall section and will have a performance impact to some degree.
Thank you very much for your detailed answer, which gained my motivation to try out possibility of dithering My workaround of camera setting near: 4 makes the wall invisible in my camera/3rd Person setup, but that's not looking very good, even because the wall gets unbuild line by line. That's ok for goat simulator, I guess xD.
The other question I would like to ask, is if I could modify the camera to always see a shadow of the player through any object, like in the Mario Sunshine screenshot. That could be aa alernative solution.
The other question I would like to ask, is if I could modify the camera to always see a shadow of the player through any object, like in the Mario Sunshine screenshot. That could be aa alernative solution.
You can draw a second material pass using the Next Pass property in SpatialMaterial. On this second material, make it black, transparent, unshaded and disable the depth test so that the material is always drawn on top of everything else.
If this doesn't work out, you can also do the opposite. Make the main material the always-on-top one, and use the next pass for the actual character material.
Supporting this properly would require https://github.com/godotengine/godot-proposals/issues/1298 to be implemented, but it's still a while away from being added to Godot.
Thanks! I have to try this :)
- Edited
They should add a transparency option to the SpringArm node.