Anyone know how to access the depth buffer?

About Monkey 2 Forums Monkey 2 Programming Help Anyone know how to access the depth buffer?

Tagged: ,

This topic contains 3 replies, has 2 voices, and was last updated by  DruggedBunny 2 days, 5 hours ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #16203

    DruggedBunny
    Participant

    I realise the chances are slim, given how quiet the forums are, but does anyone know how to access the depth buffer (texture) in a mojo3d shader? Is it even possible as things stand?

    #16204

    Ethernaut
    Participant

    I’m not entirely sure, but maybe the post processing shaders like the GodRaysEffect can hold some clue to it?
    https://github.com/blitz-foundation/monkey2/blob/develop/modules/mojo3d/assets/shaders/effects/godrays.glsl

    There’s an r_DepthBuffer uniform, and if I’m not mistaken those “r_” variables were all provided by Mojo3D’s renderer?

    Cheers.

    #16205

    DruggedBunny
    Participant

    Oh, good find, thanks, Ethernaut! I thought I’d searched everything trying to find it… that looks good to me.

    #16207

    DruggedBunny
    Participant

    Got it! Or at least, getting it…

    Import PostEffect class into your mojo3d project:

    Added via scene.AddPostEffect (New TestEffect) in OnCreateWindow.

     

    Place shader code below as testeffect.glsl in assets::shaders/

    Not stripped of non-essential stuff, or tweaked, just a quick example that displays the depth buffer.

    Thanks again!

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.