How to hide the water plane inside a boat

:bust_in_silhouette: Reply From: SIsilicon

I figured it out!!

The water plane will have to be considered transparent for this to work though.

  • First you must have two versions of the boat mesh. The original one, and the other being a hull of the other.
  • Make the hull a child of the original mesh.
  • Then give the hull mesh a ShaderMaterial with the following shader code.
    shader_type spatial;
    render_mode unshaded;
    
    void fragment() {
        ALBEDO = texture(SCREEN_TEXTURE, SCREEN_UV).rgb;
    }
  • Set the refraction to enabled, and set the refraction scale to 0.
  • ???
  • Profit!!

How can I set the refraction enabled in the ShaderMaterial? It’s only available on SpatialMaterial.

cucaido | 2020-06-13 16:26