From 5184abc23cb740e800a9afe7df59b10c54b37f43 Mon Sep 17 00:00:00 2001 From: Chicken Bones Date: Fri, 2 Aug 2013 02:04:19 +1000 Subject: [PATCH] Made alpha a power function of density for gases to produce better visuals for low densities. --- codechicken/lib/render/RenderUtils.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/codechicken/lib/render/RenderUtils.java b/codechicken/lib/render/RenderUtils.java index 6021334..581ccc3 100644 --- a/codechicken/lib/render/RenderUtils.java +++ b/codechicken/lib/render/RenderUtils.java @@ -277,6 +277,11 @@ public class RenderUtils { renderFluidCuboid(stack, bound, density, res); } + + public static double fluidDensityToAlpha(double density) + { + return Math.pow(density, 0.4); + } /** * Renders a fluid within a bounding box. @@ -295,7 +300,7 @@ public class RenderUtils int alpha = 255; if(stack.getFluid().isGaseous()) - alpha = (int) (density*255); + alpha = (int) (fluidDensityToAlpha(density)*255); else bound.max.y = bound.min.y+(bound.max.y-bound.min.y)*density; @@ -313,7 +318,7 @@ public class RenderUtils int alpha = 255; if(stack.getFluid().isGaseous()) - alpha = (int) (density*255); + alpha = (int) (fluidDensityToAlpha(density)*255); else { int height = (int) (rect.h*density);