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

Implement BEFORE stages for extra control #1857

Draft
wants to merge 1 commit into
base: 1.21.x
Choose a base branch
from

Conversation

FiniteReality
Copy link
Member

This is a relatively naive modification to the existing RenderLevelStageEvent system to implement an additional set of BEFORE stages. The goal is to give more control over geometry rendering at a per-rendertype level. For example, currently, it is rather difficult to render translucent non-chunk based geometry (e.g. the contents of a multi-block tank which spans multiple chunks) as the current events are fired after the game has already rendered to the appropriate buffers, breaking depth sorting and blending.

Admittedly, it is likely that this would then introduce the reverse issue: geometry rendered by a mod will interfere with vanilla geometry (hence my opening of this PR as a draft) but providing these hooks should in theory provide for more control while fitting into the constraints of the existing system.

I think that going forward we need to completely redesign this interface, instead giving modders access to the FrameGraphBuilder in order to configure their own render passes. However, this will need a lot more thought as the frame graph is intended to be a DAG where resources are only written once.

@neoforged-automation neoforged-automation bot added the 1.21.4 Targeted at Minecraft 1.21.4 label Jan 15, 2025
@neoforged-pr-publishing
Copy link

neoforged-pr-publishing bot commented Jan 15, 2025

  • Publish PR to GitHub Packages

Last commit published: 9a9a4985fd22285b0c011151d6d21ad3977ffc66.

PR Publishing

The artifacts published by this PR:

Repository Declaration

In order to use the artifacts published by the PR, add the following repository to your buildscript:

repositories {
    maven {
        name 'Maven for PR #1857' // https://github.com/neoforged/NeoForge/pull/1857
        url 'https://prmaven.neoforged.net/NeoForge/pr1857'
        content {
            includeModule('net.neoforged', 'neoforge')
            includeModule('net.neoforged', 'testframework')
        }
    }
}

MDK installation

In order to setup a MDK using the latest PR version, run the following commands in a terminal.
The script works on both *nix and Windows as long as you have the JDK bin folder on the path.
The script will clone the MDK in a folder named NeoForge-pr1857.
On Powershell you will need to remove the -L flag from the curl invocation.

mkdir NeoForge-pr1857
cd NeoForge-pr1857
curl -L https://prmaven.neoforged.net/NeoForge/pr1857/net/neoforged/neoforge/21.4.60-beta-pr-1857-feature-additional-render-stages/mdk-pr1857.zip -o mdk.zip
jar xf mdk.zip
rm mdk.zip || del mdk.zip

To test a production environment, you can download the installer from here.

@Technici4n
Copy link
Member

Have you tried using the AFTER_TRANSLUCENT_BLOCKS stage? Or the AFTER_BLOCK_ENTITIES stage? Do they not work?

@FiniteReality
Copy link
Member Author

Have you tried using the AFTER_TRANSLUCENT_BLOCKS stage? Or the AFTER_BLOCK_ENTITIES stage? Do they not work?

The issue is that when you're rendering e.g. fluids in a tank, you only have access to the render type, rather than the relevant stage to draw geometry in. Part of the change here is to make both the before/after stages attached to the render type where relevant.

@Technici4n
Copy link
Member

Is the problem that Sheets.translucentCullBlockSheet() is gone in 1.21.4? Maybe try replacing it with Sheets.translucentItemSheet() or RenderType.translucentMovingBlock(). Creating a render type with a call to RenderType.entityTranslucent with the block atlas might also be fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.21.4 Targeted at Minecraft 1.21.4
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants