gcewing Posted March 7, 2015 Posted March 7, 2015 I'm porting my roof blocks from Greg's Blocks to 1.8, and I'm having trouble with ambient occlusion. It doesn't seem to be possible to get it to work correctly for faces that are not axis-aligned. In this screenshot, you can see places where the lower edges of roof blocks are incorrectly shaded, because the rendering system thinks that the cobblestone block below the roof block is casting a shadow on it. This happens because the roof block is not opaque, so it includes the block below in AO calculations rather than the block below and in front. The same thing causes the ridge blocks on top to be shaded too darkly, because they have opaque blocks underneath them. In my 1.7 rendering code, I dealt with this by only using AO for the exterior axis-aligned faces and not the sloping ones. But the 1.8 rendering system only allows AO to be turned on or off for the whole model, not individual faces, and unless I'm missing something, only allows one BakedModel to be rendered per block. Anyone have any suggestions? Quote
TheGreyGhost Posted March 7, 2015 Posted March 7, 2015 Hi Unfortunately I think you're right, there's no easy way. A TileEntitySpecialRenderer would let you render the two parts separately (AO in block, sloped in TESR) but that's pretty inefficient if you have a lot of roof... You might be able to do something in multiple rendering layers using this forge extension - i.e. Render your AO in the CUTOUT and the non-AO in the CUTOUT MIPPED, by returning a different ISmartBlockModel for the two passes. Block:: /** * Queries if this block should render in a given layer. * ISmartBlockModel can use MinecraftForgeClient.getRenderLayer to alter their model based on layer */ public boolean canRenderInLayer(EnumWorldBlockLayer layer) { return getBlockLayer() == layer; } -TGG Quote
gcewing Posted March 8, 2015 Author Posted March 8, 2015 You might be able to do something in multiple rendering layers using this forge extension - i.e. Render your AO in the CUTOUT and the non-AO in the CUTOUT MIPPED, I thought about that, but the layer is ultimately going to be dictated by the base material, e.g. if the block is made from tinted glass, it's going to have to be rendered in the alpha transparency layer. So I'm not really free to (ab)use the layers that way. Quote
TheGreyGhost Posted March 8, 2015 Posted March 8, 2015 I'm pretty sure that alpha layers don't use AO? If that doesn't work for you, I think you are going to need ASM+Reflection to intercept deep into the vanilla rendering code. You gotta ask yourself if its really worth it.... -TGG Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.