Skip to content
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

Rendering Fluids in fabulous graphics mode GUI doesn't work #23

Open
shartte opened this issue Jul 21, 2020 · 5 comments
Open

Rendering Fluids in fabulous graphics mode GUI doesn't work #23

shartte opened this issue Jul 21, 2020 · 5 comments
Labels
type:bug Something isn't working

Comments

@shartte
Copy link
Contributor

shartte commented Jul 21, 2020

I am using the following code to render a Fluid slot (s) in my GUI, which works perfectly in fancy or fast graphics, but is invisible in fabulous graphics.

                List<FluidRenderFace> faces = new ArrayList<>();
                faces.add(FluidRenderFace.createFlatFaceZ(0, 0, 0, 16, 16, 0, 1 / 16., false, false));

                matrices.push();
                matrices.translate(s.x, s.y, 0);

                FluidVolume fluidStack = fs.getFluidStack();
                fluidStack.render(faces, FluidVolumeRenderer.VCPS, matrices);
                FluidVolumeRenderer.VCPS.draw();
                matrices.pop();
@shartte
Copy link
Contributor Author

shartte commented Jul 21, 2020

I tracked it down to the following:
Translucent layers are rendered into a separate framebuffer, which is never blitted back to screen after the world itself has already been drawn (which is under the GUI).

Workaround: RenderSystem.runAsFancy(FluidVolumeRenderer.VCPS::draw);

That is deprecated though.

@AlexIIL AlexIIL added the type:bug Something isn't working label Jul 21, 2020
@AlexIIL
Copy link
Owner

AlexIIL commented Jul 21, 2020

That's annoying. I'll change ExpandingVcp.draw to go through RenderSystem.runAsFancy.

@shartte
Copy link
Contributor Author

shartte commented Jul 21, 2020

I am also not sure how to solve this going forward.
This should also affect item renderers in theory, I guess, or the fluid rendering should not actually render to the "transparent" layer for the UI.

@AlexIIL
Copy link
Owner

AlexIIL commented Jul 21, 2020

Do item renders have their own VCP? I know this isn't a problem for blocks, as they use the main one.

(For simplicities sake I'll expose a draw method that doesn't use runAsFancy - that way if they don't they can use that).

Drawing translucent fluids in GUIs should be fine so I'm hesitant to try to change fluid rendering just for this.

@shartte
Copy link
Contributor Author

shartte commented Jul 21, 2020

As long as they render into the transparent layer they will have this problem.
Root cause here is net.minecraft.client.render.RenderPhase#TRANSLUCENT_TARGET, because that will switch the render target.

Thinking about this some more: RenderLayers should really not be used when rendering for the UI I think...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants