Facepunch / sbox-issues

175 stars 12 forks source link

Image formats other than RGBA8888 and D24S8 for Render.DrawScene #963

Open rileyzzz opened 3 years ago

rileyzzz commented 3 years ago

What can't you do? Unable to use image formats like RGBA16161616 or RGBA32323232F for the color target of Render.DrawScene, or different depth formats for the depth target

How would you like it to work? Support rendering to a number of additional image formats beyond RGBA8888, which would allow for overbright or HDR color data to be properly handled in post processing passes. Additionally, support for alternate depth formats like D32 or D16 would allow for more flexible control over depth precision

What have you tried? Currently, rendering to a target with any formats other than RGBA8888 for color and D24S8 for depth throws an exception.

Additional context

rileyzzz commented 3 years ago

Seems like RGBA16161616F and RGBA32323232F support was added in a recent commit could we get the option to disable the post processing of the drawn scene and just use the unmodified color data (while still using a high precision RT)? i.e. if we're rendering it onto a mesh in the world or using a func_monitor, the post processing ends up happening twice

aylaylay commented 3 years ago

This shouldn't be affecting func_monitor at all

rileyzzz commented 3 years ago

Aight, didn’t know if func_monitor had an underlying C# implementation that relied on DrawScene In my current project I’m using the RT texture in the world which does end up post-processing it a second time and makes everything super bright

samzanemesis commented 3 years ago

Which uses would you have for another depth format?

rileyzzz commented 3 years ago

I don't have a specific use case but it feels like something you should be able to do if you want it (and you aren't making use of the stencil bits of D24S8) D32 might come in handy if you've got a really gigantic scene and want to render it all to a render target while minimizing precision issues - this would definitely be a rare situation though, and D32 over D24S8 probably wouldn't make that much of a difference adding onto that, it might also be useful to be able to run DrawScene with just a depth target and no color target, if you're using the texture later in a shader or something (shadow maps etc) - this is something you more than likely wouldn't need stencil bits for, and could probably get away with D16

samzanemesis commented 3 years ago

I've moved the main game rendering to D32 when not in VR, I will revisit this soon if you don't need stencils