Postprocessing with depth pass and transparent objects

panicqpanicq Posts: 31Member

Hey

I'm trying to create a custom post process on top of everything (including transparent objects) that requires the depth pass. I've tried using the screen-reading technique (https://docs.godotengine.org/en/3.1/tutorials/shading/advanced_postprocessing.html) but SCREEN_TEXTURE grabs the screen before transparent objects are being drawn :( What would be the best way of doing this without rendering twice the scene ?

Thank you in advance !

Comments

  • MegalomaniakMegalomaniak Posts: 2,027Admin
    edited March 24

    Make sure the transparent objects are using depth draw alpha pre-pass:
    https://docs.godotengine.org/en/stable/tutorials/3d/spatial_material.html#depth-draw-mode

    edit: or maybe it should be always, one of those I think.

  • panicqpanicq Posts: 31Member
    edited March 24

    Hum thanks it's half-resolving my issue as I now see my object, however the Albedo does not show anymore at some point when I'm rotating my camera, this is quite strange. Here is my transparent shader header, and I simply write to the ALPHA and ALBEDO in the frag.

    shader_type spatial;
    render_mode unshaded, depth_draw_alpha_prepass;
    
  • MegalomaniakMegalomaniak Posts: 2,027Admin

    Might some of your models normals be inverted? Might have to adjust the cull mode.

  • panicqpanicq Posts: 31Member
    edited March 25

    My normals and cull are fine... :(

  • SIsilicon28SIsilicon28 Posts: 286Member

    This is simply a limitation of SCREEN_TEXTURE. It will only have opaque objects rendered in it. The reason why it shows as black might be because the depth was generated in a pre-pass, but no color information because transparent objects don't get rendered in it.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file