-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3D (depth buffer enabled) support #7
Comments
Right, that's just because I've never tried it with any of 3D stuff. Overall, providing already captured buffer instead of doing a capture stage sounds reasonable, could be useful for some other cases. Will implement it in the next version. Thanks! |
Dynamically activate depth bufffer is possible but would be a lot of pain and not efficient. I agree, enabling depth buffer for all VfxFBO might be overkill and you have to manage buffer clearing options which would over complexify API and implementation. Looking forward to get my hands on the next version :-) Thank you! |
As 49d236c introduces a way to provide an input texture as an alternative to capturing the whole scene, I think this issue might be resolved now. I'm not quite happy about the way it looks currently (scene capturing mechanism alongside the manual texture submission). Scene capturing feels more like a standalone stage that shall be separated from @mgsx-dev, I'd appreciate it if you can try this new |
@metaphore thanks for the update 👍 , i tested it and it works. Unfortunately, it doesn't solve extra rendering issue because setCapturedInput render the texture to a VfxFBO (which was exactly my previous workaround). As you mentioned, every stage input should be a Texture supplied either :
I understand it's a huge change in your implementation (and maybe API) but it would make things more clean, extendable, and above all efficient. There are no crazy features in a 3D context regarding your lib, only the depth buffer attachment (and other attachments) differs. Note that you can also use depth buffer and such for 2D rendering, but that's not so common. As we discussed earlier, it's not the responsibility of your lib to handle that. User code have to handle depth buffer or not, MRT or not and simply provide a texture as input. Capture feature still useful for classic use cases though. If you have further questions, we could discuss about it on discord if you want :-) Thanks for your work ❤️ |
So is it suppose to work with 3D? I followed the example and got the "Current bound OpenGL FBO's handle doesn't match to wrapped one. It seems like begin/end order was violated" error. I use 3D and depth shader to create shadows. |
@dbchan if you're using capture begin/end, you need to use the same workaround i used (see my first comment in this issue): first render your scene in your own FBO and then capture the content of that FBO. If you're using 0.5.0-SNAPSHOT, you can use setCapturedInput(Texture) instead. |
Sorry, do you mind sharing a sample? And do I actually better off implementing my own shader then using this library from an efficiency perspective? |
1- render your 3D scene into your own FBO (which has a depth buffer) assuming fbo variable is your own FBO containing your 3D scene, you can capture it like this: vfxManager.beginCapture();
spriteBatch.getProjectionMatrix().setToOrtho2D(0, 0, 1, 1);
spriteBatch.begin();
spriteBatch.draw(fbo.getColorBufferTexture(), 0, 0, 1, 1, 0, 0, 1, 1);
spriteBatch.end();
vfxManager.endCapture(); @dbchan if you need more help, please ask on discord. |
@metaphore do you think there is a chance to support 3D out of the box by gdx-vfx? We've been discussing about it on Discord and there are people interested in it, but because of the re-rendering process it's kinda uncertain in the prospect of performance. |
I'm not quite sure, to be honest. While preparing |
Because PingPong buffer doesn't use depth buffer, capturing a 3D scene doesn't work.
A workaround is to render 3D scene into another FBO (with depth buffer enabled) and then render this FBO with a sprite batch during capture. This workaround adds an extra full screen rendering.
A solution could be an alternate capture method : user could provide an "input Texture" which be used as the first input texture in the process chain...
I'm not familiar with this library, maybe i missed something?
Great job with this library btw :-)
The text was updated successfully, but these errors were encountered: