IBakedModel Rendering issues in another mod when LT is installed
Fureniku opened this issue ยท 8 comments
Hello,
A user has highlighted the below issue in a beta release for an update in my mod (Fureniku's Roads).
In this update I'm creating custom shapes to create slanted roads, but when LT is installed, the rendering gets broken:
(Left is with LT, right is without)
It looks like faces are all still there but rendering in the wrong place, or potentially upside down (Looking directly down you can see the "top" at the bottom for example). There are no LT blocks in the world at all, but the issue stops when LT is removed.
I'm hoping it's something I can just fix on my end but I assume it's happening due to some sort of change to Minecraft's rendering engine that LT makes? Is there a way for me to work around it, or is it something that must be fixed on LTs side?
Thanks
Hey there,
very weird. LT does change a lot, but not really the rendering itself. It hooks in before minecraft uploads it's render data to the graphic card. No idea how something like this can happen. Maybe LT messes around with the baked quad data? Does this happen every time in the same way? What happens if no LT blocks have been loaded/ rendered yet?
Messing with the baked quad data is my best guess. What seems to be happening is the order of the individual quads rendering is being changed. It's happening on brand new worlds with no LT stuff placed at all, here's a video (which shows the effect much better anyway) of a world created with LT, then removing LT to "fix". You can see that on both sides the grass renders after the tarmac and the bottom face is rendering after the top, it's almost like the rendering order is entirely reversed?
This is the first time I've worked with the rendering on 1.12 so it's entirely possible it is something I'm doing wrong, but it's odd that it only happens with LT installed
Now I get it ... yes LT changes that because it works better in most situations. But this is only important for the translucent layer, for half transparent blocks. Maybe you are rendering in the wrong layer? You probably want to use cutout_mipped. Or am I getting something wrong here?
Changing to cutout_mipped does technically fix the problem. However, if people try and use things like coloured glass or water, they now of course don't work quite right because of the lost translucency. Don't suppose you know of any way around that?
Okay, change it to cutout_mipped by default, because that makes a lot more sense. If translucent blocks are used (I can also link you a message to detect that) you should use the translucent layer. I will add a config option to disable the LT stuff, so people have a work around if necessary.
Thanks for the help, very much apprecaited! Detecting the translucent stuff would be very useful if you don't mind showing me; I assume that's happening somewhere in the actual rendering, as I can't see any way for me to make those detections within my block class as the cutout function has no parameters and my blocks are entirely based on their surroundings (no tile entity)
There is another method in Block.java
:
public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer)
{
return getBlockLayer() == layer;
}
If the state is not enough there are other things you can do. I think this uses the getExtendedState state if i'm not mistaken.