Improved space sky rendering when using lower chunk range settings

Reminder: sky won't render below 4 chunks.
This commit is contained in:
Unknown 2020-05-04 21:29:18 +02:00 committed by unknown
parent 7cf069fc64
commit c244857117

View file

@ -322,16 +322,16 @@ public class RenderSpaceSky extends IRenderHandler {
final double planetY = planetY_far * transitionApproaching;
// render range is only used for Z-ordering
double renderRange = 90.0D + 5.0D * (distanceToCenter / Math.max(borderRadiusX, borderRadiusZ));
double renderRange = 9.0D + 0.5D * (distanceToCenter / Math.max(borderRadiusX, borderRadiusZ));
// render size is 1 at space border range
// render size is 10 at approaching range
// render size is 90 at orbit range
// render size is min(1000, celestialObject border) at orbit range
final double renderSize = 50.0D / 1000.0D * Math.min(1000.0D, Math.max(borderRadiusX, borderRadiusZ)) * (1.0D - transitionOrbit)
+ 25.0D * (transitionOrbit < 1.0D ? transitionOrbit : (1.0D - transitionApproaching))
+ 2.5D * (transitionApproaching < 1.0D ? transitionApproaching : (1.0D - transitionFar))
+ 1.0D * transitionFar;
final double renderSize = 5.00D / 1000.0D * Math.min(1000.0D, Math.max(borderRadiusX, borderRadiusZ)) * (1.0D - transitionOrbit)
+ 2.50D * (transitionOrbit < 1.0D ? transitionOrbit : (1.0D - transitionApproaching))
+ 0.25D * (transitionApproaching < 1.0D ? transitionApproaching : (1.0D - transitionFar))
+ 0.10D * transitionFar;
// angles
final double angleH = Math.atan2(distanceToCenterX, distanceToCenterZ);
@ -399,7 +399,7 @@ public class RenderSpaceSky extends IRenderHandler {
tessellator.draw();
// slight offset to get volumetric illusion
renderRange -= 2.5D;
renderRange -= 0.25D;
}
// restore settings
@ -415,7 +415,7 @@ public class RenderSpaceSky extends IRenderHandler {
final Tessellator tessellator = Tessellator.getInstance();
final BufferBuilder vertexBuffer = tessellator.getBuffer();
final double renderRangeMax = 100.0D;
final double renderRangeMax = 10.0D;
for (int indexStars = 0; indexStars < (hasMoreStars ? 20000 : 2000); indexStars++) {
double randomX;
double randomY;
@ -428,7 +428,7 @@ public class RenderSpaceSky extends IRenderHandler {
randomLength = randomX * randomX + randomY * randomY + randomZ * randomZ;
} while (randomLength >= 1.0D || randomLength <= 0.90D);
final double renderSize = 0.2F + 0.025F * Math.log(1.1D - rand.nextDouble());
final double renderSize = 0.020F + 0.0025F * Math.log(1.1D - rand.nextDouble());
// forcing Z-order
randomLength = 1.0D / Math.sqrt(randomLength);