#Hum, maybe you could do a feature
1 messages · Page 1 of 1 (latest)
Thank you very much, that's exactly what I was looking for! :)
My understanding from reading the documentation is it should be possible to use the DrawRenderersCustomPass to target a layer for a material override and then write just the depth buffer of the overriding material. It looks like you can not target any transparent materials though, even though the custom pass interface really make it look like that by giving you all kinds of transparent options for the filter queue, including low resolution transparent.
The pass will simply not override any transparent materials though, even those that are on the default rendering pass. It's not like there is something wrong with the filtering, I can override an opaque material with a transparent one. But that is no good because you're stuck with the opaque color buffer then.
Thank you very much, that's exactly what I was looking for! :)
My understanding from reading the documentation is it should be possible to use the DrawRenderersCustomPass to target a layer for a material override and then write just the depth buffer of the overriding material. It looks like you can not target any transparent materials though, even though the custom pass interface really make it look like that by giving you all kinds of transparent options for the filter queue, including low resolution transparency.
The custom pass will simply not override any transparent materials though, even those that are on the default rendering pass. It's not like it does not work at all, I can override an opaque material with a transparent one. But that is no good because you're stuck with the opaque color buffer then.
Hum, the setup in the first screenshot should work. Maybe try to force depth write and test in the "override depth" section.
One thing I wasn't 100% sure about is the injection point, as maybe the lowres transparent relies on the deph pyramid buffer ...
You could try the "before prerefraction", or even "after opaque"
I actually tried all the depth write options, but they didn't change anything. Turns out they do if you change the injection point to anything other than Before Transparency, for some reason that is the only one that won't show the overriding material at all.
The override will work for the forward pass at Before Pre Refraction, but it will still not write just the depth even with override depth and write depth turned on. I tried setting the pass to DepthOnly and also leaving it at Forward and setting just the color depth buffer target to none, but both configurations don't actually write to the depth buffer. It's not like nothing is happening though, without override depth enabled not even the forward pass will show up at Before Pre Refraction.
Looks like this really would need to be implemented at the shader level for the low resolution pass, too bad that is probably not happening if even you say it's too niche. :c
It would be amazing to actually be able to ship with large scale transparency, low resolution might look crap on smooth materials, but it looks just as good as the default pass with just a bit of roughness while having a fraction of the frametime cost, and that is even without a depth prepass which should be even more efficient in theory.
I don't want to keep taking up your time though, thank you very much for talking to me anyways! :)
Did you also try "after opaque and sky" ?
The "Transparent Depth Prepass" hapens between this and "Before Refraction", so realy "forcing" the depth before that prepass should be safe I guess.
Yes I did, I wanted this to work so badly I actually spent the last two hours trying every single combination of injection point, depth override, write depth, render pass name, and using the DepthOnly or TransparentDepthPrepass versus the full Forward pass with no target color buffer.
The only difference between Before Pre Refraction and After Opaque And Sky is that the cloud layer and water are no longer visible through the material, but the overlap is still there.
It looks to me like the custom pass is writing depth data which affects some parts of the scene, but that depth data is somehow gone by the time it gets to rendering the transparent mesh.
I checked the frame debugger, and sure enough I found a depth buffer including my mesh coming from the custom pass. It's still there in the next step which is water lighting, then there is color pyramid which doesn't have depth, and then we get to LowResTransparent where the mesh is missing from the depth buffer.
I'm not sure what to make of that, I suppose that means that either the low resolution pass completely discards and rewrites the depth buffer since you can't just erase something from it, or it uses a separate depth buffer that you can't influence through a custom pass.
Yeah, ok, I think I understand now, I did some tests quickly.
The custom pass will work for lowres transparents if you use "after depth and normal" injection, because it's just after this pass that the depth pyramid is computed, and that's where the lower res depth comes from for the low res transparents.
But this will also block the sky.
And that's probably why depth prepass is not an option for low res transparency, because the depth pyramid happens way sooner in the pipeline.
The only way I could think of to fix your issue would be to do a scripted custom pass that would also update the depth pyramid, but that's not as easy as a draw renderers ...