AgriCraft

AgriCraft

30M Downloads

Rendering issues with various Agricraft blocks

tntblockman opened this issue ยท 18 comments

commented

Minecraft version: 1.7.10
Forge: 10.13.4.1492
AgriCraft: 1.4.0-beta-3-hotfix-2-1.7.10

Hi,
Just sharing this rendering issue I've been experiencing with AgriCraft. Tested with having only the above mods installed.
Placing various blocks i.e fences, gates, tanks, seed storage. All have a weird darken random sides texture. As you walk around the blocks looking at them from different sides, the darken sides will alter/change sides or just revert back to their intended texture colour.

Pics taken showing rendering issue(pictures do show some other mods installed. But further testing with only the above mods installed had the same result):
http://imgur.com/a/m54LF

Last picture one showing chunk boundaries.

commented

Thanks for reporting, I'll have a look at it.

commented

What are your video settings?

commented

Hi,
Thanks for taking a look, my following video settings are:
Graphics Fancy, Smooth Lighting Maximum, 3D Anaglyph off, GUI Scale Normal, Brightness bright, Particles all, Use VSync on, Anisotropic Filtering off, Render Distance 10 chunks, Max Framerate 60fps, view Bobbing on, Advanced OpenGL off, Clouds off, fullscreen off, Mipmap levels 4.

commented

Ambient Occlusion?

commented

But after looking within my graphic card Global settings, Ambient Occlusion is off. And under applications you cannot even set Ambient Occlusion for Java. Just says "Not supported for this application"

commented

Nevermind the AO, what happens if you remove those grass blocks?

commented

No change same render problem. Example here is from generating a flat desert world http://imgur.com/ibY7Gqc
If i remove the grass blocks from under, render issue still persist.

commented

yeah there is no Ambient Occlusion option under video settings. Unless your talking about this setting been part of the graphics card settings?

commented

Its weird, it doesn't happen for me.

commented

I've noticed lighting issues before in testing... They go back as far as I can remember...

I think the lighting code isn't as optimal as it should be, yet I haven't the faintest idea of how to fix it...
Depending on the 1.8 schedule, this may be something to push off to the JSON rendering...

commented

Yeah I've seen slight lighting issue on previous versions with the tanks. In a multi-tank setup(any size), there was at least one tank block that had a very slight darker colour compared to other tank blocks within the same multi-block structure. I suppose with the introduction to new blocks, this lighting bug is more apparent. As for recreating the lighting issue, I had to place (in this case "seed storage") randomly in a wide area to replicate this issue. Once the lighting issue occurred on one block, placing any block adjacent to it, would cause the lighting bug to spread. Not sure if that helps narrow it down any further, but was worth a mention.

Thanks for taken your time looking at this issue, and thanks again for great mod. <3

commented

I've noted rendering issues with fences on FTB Infinity 2.0.0
image

All those fences are the same SpruceWood type.
During night, this part of this specific chunk will be much darker than around.

It looks like the light values aren't read properly from the world itself, maybe shifted over block coordinates or something like that.

commented

I had a quick look into your rendering code (because I suspected it was bleeding some opengl flags), and noticed you are not calling tessellator.setBrightness() for each and every block. You need to do that or you will inherit the brightness of the last block that was rendered before your block.

Just pin a tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z)) at the top of your renderWorldBlock() and all those lighting issues should be gone. (For solid blocks (which are dark inside) do it per face and use the brightness of the adjacent block.)

Another thing is the darkening of sides Minecraft does to increase the 3D effect. Do a Tessellator.instance.setColorOpaque_F(a, a, a); for each face you are rendering manually. a should be 1 for up, 0.5 for down, 0.6 for east and west and 0.8 for north and south. Doing this will also automatically prevent color bleeding (e.g. from grass).

commented

Thanks for the help, I'll definatly implement that, but I'm wondering then, why doesn't it happen every time?
I've seen it happen on screenshots and videos, but I've never seen it myself.

commented

Btw, I was already doing that different coloring for different sides: https://github.com/InfinityRaider/AgriCraft/blob/master/src/main/java/com/InfinityRaider/AgriCraft/renderers/blocks/RenderBlockBase.java#L376-L379 (and any other render face method)

commented

Because you usually inherit the brightness of the previous block. And most blocks leave you with some good brightness, just not your one. But if you're at a position in the chunk where you are the first block to render, or the previous block restarted the tesselator, you are dark. However, if no block in the same tesselator batch sets a brightness, you're too bright (the lightmap only darkens).

BTW: The tesselator is a bit dumb. It remembers if there is a texture, a color, normals or a brightness. But it remembers it for the whole batch, not for the vertex. So you can have a million quads without brightness that could render ok, but just at the end there's one quad with brightness---the tesselator will render all quads with the brightness that was active when they were queued (and that's 0 of none was set). That's one reason you always want to set all of the above. The other is that values that were set before you will stick around.

(side colors: ok, for this one I didn't look that hard. It came to me while writing the comment.)

commented

^^ Thank you for your explanation, I mostly looked at vanilla code to do my rendering, but I didn't look good enough apparently.

commented

or maybe vanilla code is just horrible ;)