Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.8] Ambient occlusion and sloping faces
The update for 1.13 is being worked on - please be patient. (Updated 02/19/19)
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 1
gcewing

[1.8] Ambient occlusion and sloping faces

Started by gcewing, March 7, 2015

4 posts in this topic

gcewing    40

gcewing

gcewing    40

  • Creeper Killer
  • gcewing
  • Forge Modder
  • 40
  • 145 posts
  • Report post
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.

 

AmbientOcclusionErrors.png

 

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?

Share this post


Link to post
Share on other sites

TheGreyGhost    710

TheGreyGhost

TheGreyGhost    710

  • Reality Controller
  • TheGreyGhost
  • Members
  • 710
  • 2805 posts
  • Report post
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

Share this post


Link to post
Share on other sites

gcewing    40

gcewing

gcewing    40

  • Creeper Killer
  • gcewing
  • Forge Modder
  • 40
  • 145 posts
  • Report post
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.

Share this post


Link to post
Share on other sites

TheGreyGhost    710

TheGreyGhost

TheGreyGhost    710

  • Reality Controller
  • TheGreyGhost
  • Members
  • 710
  • 2805 posts
  • Report post
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 1
Go To Topic Listing Modder Support

  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • fieldbox
      Mods on Minecraft windows 10 edition

      By fieldbox · Posted 1 minute ago

      AFAIK, Forge doesn't work with Windows 10 edition. It's a different game engine. Don't take my word for it, though; Forge might have added support for Minecraft versions using the Bedrock engine.
    • fieldbox
      Could not reserve enough space for 3145728KB object heap

      By fieldbox · Posted 2 minutes ago

      When I run .\gradlew setupDecompWorkspace in PowerShell, this error appears. I am using the latest 64-bit JDK. If this changes anything, I have added the Forgelin stuff into build.gradle:   repositories { jcenter() maven { url "http://maven.shadowfacts.net/" } } dependencies { compile group: "net.shadowfacts", name: "Forgelin", version: "LATEST_VERSION" }  
    • Davyboy2346
      Mods on Minecraft windows 10 edition

      By Davyboy2346 · Posted 4 minutes ago

      I'm sorry if this has already been asked and discussed, but couldn't find anything.  I have the minecraft edition that was on my laptop when I bought it and paid for an activation code. My daughter wants to start using mods so I downloaded forge, think I've found the appdata folder (took a bit of work to find that!), downloaded a mod and put it into the same folder, but nothing seems to have changed. Am I doing something wrong or will it not work at all? Any help would be much appreciated 
    • DaemonUmbra
      Having trouble launching the client test through eclipse

      By DaemonUmbra · Posted 21 minutes ago

      We will not support the development of hacked clients.
    • Kost
      Server is not working, need help

      By Kost · Posted 23 minutes ago

      A problem occurred running the Server launcher.[22:05:18] [main/INFO] [STDERR]: [net.minecraftforge.fml.relauncher.ServerLaunchWrapper:main:34]: java.lang.reflect.InvocationTargetException
      This is the output i've got after running server with mods
      Here's debug file
      debug.rar
  • Topics

    • Davyboy2346
      1
      Mods on Minecraft windows 10 edition

      By Davyboy2346
      Started 3 minutes ago

    • fieldbox
      0
      Could not reserve enough space for 3145728KB object heap

      By fieldbox
      Started 2 minutes ago

    • oridos
      1
      Having trouble launching the client test through eclipse

      By oridos
      Started 1 hour ago

    • Kost
      0
      Server is not working, need help

      By Kost
      Started 23 minutes ago

    • vintin_ls
      3
      Forge não carrega com o java 8

      By vintin_ls
      Started 2 hours ago

  • Who's Online (See full list)

    • fieldbox
    • Davyboy2346
    • johnpalladiniyt
    • DaemonUmbra
    • Floydman
    • V0idWa1k3r
    • Drachenbauer
    • BRanger723
    • loordgek
    • jaf04
    • crackedEgg
    • nov4e
    • ahaupt8
    • Kost
    • LexManos
    • Nuchaz
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.8] Ambient occlusion and sloping faces
  • Theme
  • Contact Us

Copyright © 2017 ForgeDevelopment LLC Powered by Invision Community