Custom Fog

Custom Fog

343k Downloads

Cross-Compatibility

Sollace opened this issue ยท 5 comments

commented

Hi! I'm interested in getting some compatibility between this mod and my own ( Sollace/Void-Fog#3 ) and I'm wondering if you could make one small change.

Just take all the code from your Mixin (

if (fogType == BackgroundRenderer.FogType.FOG_SKY) {
) and stick it into a separate class with static methods. Then I'll be able to call it from my own code in the place of:

        RenderSystem.fogMode(GlStateManager.FogMode.LINEAR);
        RenderSystem.fogStart(getFogStart(distance, type, world, thickFog));
        RenderSystem.fogEnd(getFogEnd(distance, type, world, thickFog));
        RenderSystem.setupNvFogDistance();
commented

I think making the mods compatible will be a little trickier than that - it'd be pretty easy to do if it just jumps immediately to void fog at a certain depth, but that'd be a pretty noticeable and sharp cut. The tricky part is interpolating between them (which might be desired when near a light source near the void, and would definitely be desired when at the transition boundary between void fog and normal fog) - interpolating between two Linear fogs is easy, but if the player has the custom fog fog mode set to Exponential or Exponential^2 it becomes much harder.

commented

Indeed. That's why I was suggesting the move to a method I can call. If possible I'd like to have Void Fog use the same type of fog your mod is configured for, but adjusted to a different distance/colour to fit into the void.

commented

Sure, I suppose I can do that, though I would have preferred the requested solution to avoid having to update my own code any time you add (or change) the fog formula.

commented

oh yeah, that is true - I'll probably make a proper API soon that will provide the output fog values directly, instead of the config object.

commented

in the current version the dimension config can be gotten from Utils.getDimensionConfigFor(dimensionId); - you can then read this and apply the fog in your mod. I think this will work for this use case, as effectively as the proposed solution - if not, tell me and I can make the change you requested.