Chisel

Chisel

150M Downloads

Models Don't work properly work with Forge Blockstates

Drullkus opened this issue · 14 comments

commented

I need absolute concrete evidence because I refuse believe in a different way, that some how forge block states are screwing up our models.

Launch this fork of Immersive Engineering after downloading CraftTweaker (Place it into your libs folder), and place the second Aluminum Scaffold Block that has the grate on top of it. The whole block will appear invisible in the world.

2016-10-20_03 37 12

commented

Something is horribly horribly broken.

For some reason, Immersive Engineering's Aluminum Scaffolding doesn't render. AT ALL. Uses the "ctm":{} option but it simply does not render. Other BlockStates in its group are working fine since they don't contain "ctm":{}.

2016-10-20_10 53 49

I've pasted the same model onto Immersive Engineering's Copper Block. It doesn't render as well if the .cf textures use CUTOUT, but if I just remove "layer", it comes with a different problem. For some reason, the model DOES render but is does not obey the "overrides":{} at all.

2016-10-20_10 59 00

2016-10-20_10 59 03

commented

What drives me even crazier is that somehow @BluSunrize somehow got them working just fine without a hitch.

commented

Loaded in our resourcepack. I've made is so that the Copper Block uses the vanilla Glass block model, which has CTM. It appears it is not rendering at all. In the back you can see the real vanilla Glass which DOES work.

2016-10-20_11 40 52

If I remove the "layer": tag, this happens.

2016-10-20_11 45 43

The glass itself disappeared. OH COME ON!

commented

10% alpha'd black border

Ah, I did not notice that. Keep using TRANSLUCENT then :)

commented
commented

I also found out that even when chisel specify's stuff to render on a specific pass, said stuff will only render if the block is allowed to render on that pass.

@tterrag1098, he's actually right. Also in a very interesting way.

If I add this line of code to ChiselHelper.java

IEContent.blockMetalDecoration1.setBlockLayer(BlockRenderLayer.CUTOUT,BlockRenderLayer.CUTOUT);

It appears the top side is now working. But not the sides. The sides are still vanilla textures without .ctx files, so I am assuming they are being assigned the value SOLID for RenderLayer.

2016-10-22_11 03 18

commented

Issue located.

As posted by @tterrag1098:

Just make sure to call super for canRenderInLayer.

commented

Compat label added due to fault being in other mod, it will be a super easy fix for the other mod.

commented

NOW I have an answer. I thank @BluSunrize for pushing to his IE repo. I replaced the model for Light Engineering Block with the Glass Model and I now got progress in isolating the problem. There is something wrong with the files I'm writing, as Blu's files are working fine and somehow mine are not.

Considering all above observations, I now have made progress in tracking down the issue. This is what happens if I replace the Light Engineering Block's model with Glass's.

2016-10-21_21 12 24

commented

And I believe I lost all progress.

2016-10-21_21 27 17

Left is IE's Blocks of Copper, and Right is Minecraft's Glass. (not rendering at all) This is what happens if I make the glass model use file immersiveengineering:ctm/metalDecoration0_lightEngineering.cf. (Copper blocks are using the glass model)

These mother fucking cheeky bastards are working just fine.

2016-10-21_21 31 06

This bug is made of quantum mechanics, able to bend itself and spin in extra dimensional parameters that are of no coherence to me.

commented

Glass now uses its own model again. Reverts back to normal. Copper blocks continue to use the Glass model, which is it's proper model again. Does not render, expected as given the past behavior it has performed thus far.

This test now has modified file immersiveengineering:ctm/metalDecoration0_lightEngineering.cf, which is the Chisel-Face file for the light engineering blocks. Its format as follows:

{
    "textures":[
        "immersiveengineering:ctm/metalDecoration0_lightEngineering.ctx",
        "minecraft:glass.ctx"
    ]
}

Here, we observe that the Minecraft Glass is rendering perfectly, fine, while the Block of Copper remains to be broken, as observed before in its same conditions, and is not touched by the Light Engineering Block's .cf file. However, the glass does not render at all on the Light Engineering Block? The glass fails to render on the Engineering Block.

2016-10-21_21 39 26

I can now treat this as progress, it appears there is no problem with the model itself at all, but rather the faces of it.

commented

I think I've got the issue almost pinned.

It appears @BluSunrize used TRANSLUCENT instead of CUTOUT for layer in the .ctx file, which would have been appropriate for the immersiveengineering:ctm/metalDecoration0_lightFrame.ctx file. It appears changing layer's value to CUTOUT causes it to not render at all!

{
    "type":"CTM",
    "textures":[
        "./metalDecoration0_lightFrame",
        "./metalDecoration0_lightFrame_ctm"
    ],
    "layer":"CUTOUT"
}

The issue is somewhere with rendering layers. Models are 100% OK, Faces are 100% OK, Issue is pin-pointed in CTX.

With TRANSLUCENT:

2016-10-21_21 59 22

With CUTOUT:

2016-10-21_22 00 53

commented

I used "TRANSLUCENT" because the frame applies a 10% alpha'd black border to the layer below it. Cutout doesn't allow semi-transparency, hence why the transparent layer exists for coloured glass, ice and stuff. I added said black border to give a depth effect.
I also found out that even when chisel specify's stuff to render on a specific pass, said stuff will only render if the block is allowed to render on that pass. Hence why I do this:
https://github.com/BluSunrize/ImmersiveEngineering/blob/master/src/main/java/blusunrize/immersiveengineering/common/util/compat/ChiselHelper.java#L13
That activates the translucent layer for my engineering blocks only when chisel is installed. For performance optimization.
Technically I could even use my meta-based call to make it only use the layer for RS, light and heavy engineering blocks, since radiator and generator don't need it.

commented

@BluSunrize That all shouldn't be necessary. Just make sure to call super for canRenderInLayer.