Wendelin
Wendelin
Explore posts from servers
DHDistant Horizons
Created by Wendelin on 7/1/2024 in #help-me
Unexpected DhApiRenderParam#dhProjectionMatrix content with Iris enabled
I'm grabbing the projection matrix from the DhApiAfterRenderEvent and use it to perform a depth test in one of my shaders. And this works fine as long as no Iris shaders are active. Usually the projection matrix contains "normal" values, e.g.:
4,702E-1 0,000E+0 0,000E+0 -0,000E+0
0,000E+0 8,541E-1 0,000E+0 -0,000E+0
-0,000E+0 -0,000E+0 -1,014E+0 -4,908E+1
-0,000E+0 -0,000E+0 -1,000E+0 -0,000E+0
4,702E-1 0,000E+0 0,000E+0 -0,000E+0
0,000E+0 8,541E-1 0,000E+0 -0,000E+0
-0,000E+0 -0,000E+0 -1,014E+0 -4,908E+1
-0,000E+0 -0,000E+0 -1,000E+0 -0,000E+0
But when an Iris shader is active (in this case BSL but I don't think it matters) the values seem wrong:
1,000E+0 0,000E+0 0,000E+0 0,000E+0
0,000E+0 1,000E+0 0,000E+0 0,000E+0
0,000E+0 0,000E+0 -1,014E+0 -4,908E+1
0,000E+0 0,000E+0 0,000E+0 1,000E+0
1,000E+0 0,000E+0 0,000E+0 0,000E+0
0,000E+0 1,000E+0 0,000E+0 0,000E+0
0,000E+0 0,000E+0 -1,014E+0 -4,908E+1
0,000E+0 0,000E+0 0,000E+0 1,000E+0
In earlier version of DH and Iris (1.x on 1.20.1 for example) this wasn't an issue. It seems to me that DH is not providing the correct projection matrix, which is causing the depth test in my shader to produce wrong results. I'm using: - DH 2.1.2-a - Iris 1.7.2 - Indium 1.0.33 - Sodium 0.5.9 and trying to update the DH compatibility of my mod "Better Clouds"
6 replies
TIPThe Iris Project
Created by Wendelin on 6/27/2024 in #iris-issues
duplicate field net/irisshaders/iris/mixin/vertices/MixinBufferBuilder/vertexCount;;I in inputs
This issue was already asked about here: https://discord.com/channels/774352792659820594/1253346239425150997/1253346239425150997 Since yarn mappings are very common in the fabric ecosystem, should I open an issue on github to request a rename of the vertexCount field to avoid the name conflict?
4 replies
DHDistant Horizons
Created by Wendelin on 2/25/2024 in #bug-report
DH API does not notify of texture change
Binding textures returned by the DH API as usual* results in broken code. (usual* = how you'ld usually do it in MC modding)
DhApiResult<Integer> depthId = DhApi.Delayed.renderProxy.getDhDepthTextureId();
if(depthId.success) {
RenderSystem.activeTexture(GL_TEXTURE6);
RenderSystem.bindTexture(depthId.payload);
}
DhApiResult<Integer> depthId = DhApi.Delayed.renderProxy.getDhDepthTextureId();
if(depthId.success) {
RenderSystem.activeTexture(GL_TEXTURE6);
RenderSystem.bindTexture(depthId.payload);
}
The issue here is that DH doesn't use Minecraft's built-in GL State manager RenderSystem (yarn mappings). The problem only becomes apparent when DH reinitializes the LODRenderer. This action will: 1. glDeleteTextures the old texture 2. glGenTextures a new texture 3. On some systems the old and new texture will have the same id (valid by OpenGL Spec) 4. Call RenderSystem.bindTexture with the same texture id. 5. RenderSystemwill not call glBindTexture because it thinks the same old texture is still bound. 6. A deleted texture is now bound to GL_TEXTURE6 I hope my description was clear enough. The DH API does not provide a way to notice this texture change. Probably the only way to circumvent this issue is on my side is to do this:
RenderSystem.bindTexture(depthId.payload);
GL11.glBindTexture(GL_TEXTURE6, depthId.payload);
RenderSystem.bindTexture(depthId.payload);
GL11.glBindTexture(GL_TEXTURE6, depthId.payload);
This will keep MC's state management and the "real" state "in sync", but results in wasted performance and is generally not a nice solution,
13 replies
DHDistant Horizons
Created by Wendelin on 2/18/2024 in #help-me
Loading the DH Api
The example repo the DH Api is simply added through a implementation directive in the build.grade file. However, I am facing the issue that the game will obviously crash when my mod is loaded, but not DH, and the class loaded can't find DH's classes. For example: java.lang.NoClassDefFoundError: com/seibel/distanthorizons/api/methods/events/interfaces/IDhApiEvent Now I am not sure I am supposed to include the DH Api jar or what? I'm also confused because the API version on Modrinth seems really old. Is it assured to be stable?
9 replies