Unanswered
How to download depth image, screenshot

let renderScreenshotAndDepth (runtime : IRuntime) (size : V2i) (sg : ISg) = 
    let depth = runtime.CreateTexture(size, TextureFormat.Depth24Stencil8, 1, 1);
    let col = runtime.CreateTexture(size, TextureFormat.Rgba8, 1, 1);
    let signature = 
        runtime.CreateFramebufferSignature [
            DefaultSemantic.Colors, { format = RenderbufferFormat.Rgba8; samples = 1 }
            DefaultSemantic.Depth, { format = RenderbufferFormat.Depth24Stencil8; samples = 1 }
        ]

    let fbo = 
        runtime.CreateFramebuffer(
            signature, 
            Map.ofList [
                DefaultSemantic.Colors, col.GetOutputView()
                DefaultSemantic.Depth, depth.GetOutputView()
            ]
        )

    let taskclear = runtime.CompileClear(signature,Mod.constant C4f.Black,Mod.constant 1.0)
    let task = runtime.CompileRender(signature, sg)

    taskclear.Run(null, fbo |> OutputDescription.ofFramebuffer) |> ignore
    task.Run(null, fbo |> OutputDescription.ofFramebuffer) |> ignore

    let mat = Matrix<float32>(int64 size.X, int64 size.Y)
    runtime.DownloadDepth(depth,0,0,mat)

    let depthImage = PixImage<float32>(mat)
    let colorImage = runtime.Download(col)
  
Posted 26 days ago
Votes Newest

Answers

9 Views
0 Answers
26 days ago
3 days ago
Tags