delpi Posted May 14, 2014 Share Posted May 14, 2014 I've got a custom sky render working but I've got an odd problem. The color of the sky gets lighter if I'm near a light source. This doesn't seem to happen in a normal dimension. Anybody had this experience? I want it to be a black sky with starts, but when i get near a torch it becomes closer to blue. Quote Long time Bukkit & Forge Programmer Happy to try and help Link to comment Share on other sites More sharing options...
TLHPoE Posted May 14, 2014 Share Posted May 14, 2014 In my dimension, I have it set so that it's dark 24/7. I'm getting the same effect, the closer I get to a light source, the brighter the sky is. Quote Kain Link to comment Share on other sites More sharing options...
Abastro Posted May 14, 2014 Share Posted May 14, 2014 Then please show your code.. Quote I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP) II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium. Link to comment Share on other sites More sharing options...
delpi Posted May 14, 2014 Author Share Posted May 14, 2014 I'll paste it tonight. Not sure it will help though, its something that isn't there, not something that is wrong. Quote Long time Bukkit & Forge Programmer Happy to try and help Link to comment Share on other sites More sharing options...
delpi Posted May 15, 2014 Author Share Posted May 15, 2014 Here is the relevant code. Provider Class public class MyWorldProviderCreep extends MyWorldProvider { public MyWorldProviderCreep() { super(); // Setup parameters hasNoSky = true; } @Override public IChunkProvider createChunkGenerator() { return new MyChunkProviderCreep(worldObj, instance.world_manager().seed(this.dimensionId), true, instance.world_manager().worldtype(dimensionId)); } @Override @SideOnly(Side.CLIENT) public float getStarBrightness(float par1) { return 1.0F; } @SideOnly(Side.CLIENT) public float calculateCelestialAngle(long par1, float par3) { return 0.90F; } @Override protected void generateLightBrightnessTable() { float f = 0.0F; for (int i = 0; i <= 15; ++i) { this.lightBrightnessTable = 1.35F * (float) Math.pow((1.0f - 0.0895f), 15.0f - i) - 0.35f; //this.lightBrightnessTable = 1.25F * (float) Math.pow((1.0f - 0.10f), 15.0f - i) - 0.35f; } } @Override public double getHorizon() { return 0.0D; } @Override @SideOnly(Side.CLIENT) public IRenderHandler getSkyRenderer() { return new CreeperSkyRender(); } @Override @SideOnly(Side.CLIENT) public Vec3 getSkyColor(Entity cameraEntity, float partialTicks) { // Return pitch Black return this.worldObj.getWorldVec3Pool().getVecFromPool(0, 0, 0); } @Override @SideOnly(Side.CLIENT) public float getCloudHeight() { return 256.0f; } } Skyrender Class public class CreeperSkyRender extends IRenderHandler { // Setup Variables private int starGLCallList; private int glSkyList; private int glSkyList2; public CreeperSkyRender() { RenderGlobal renderGlobal = Minecraft.getMinecraft().renderGlobal; //this.glSkyList2 = (this.glSkyList = (this.starGLCallList = ReflectionHelper.getPrivateValue(RenderGlobal.class, renderGlobal, "starGLCallList")) + 1) + 1; this.glSkyList2 = (this.glSkyList = (this.starGLCallList = ObfuscationReflectionHelper.getPrivateValue(RenderGlobal.class, renderGlobal, "starGLCallList", "field_72772_v")) + 1) + 1; } @Override public void render(float partialTicks, WorldClient world, Minecraft mc) { System.out.println("Start Sky Render"); GL11.glDisable(GL11.GL_TEXTURE_2D); Vec3 vec3 = world.getSkyColor(mc.renderViewEntity, partialTicks); float f1 = (float)vec3.xCoord; float f2 = (float)vec3.yCoord; float f3 = (float)vec3.zCoord; float f6; System.out.println(" - color of " + f1 + "/" + f2 + "/" + f3); if (mc.gameSettings.anaglyph) { float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F; float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F; f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F; //f1 = f4; //f2 = f5; //f3 = f6; f1 = 0; f2 = 0; f3 = 0; } GL11.glColor3f(f1, f2, f3); Tessellator tessellator1 = Tessellator.instance; GL11.glDepthMask(false); GL11.glEnable(GL11.GL_FOG); GL11.glColor3f(f1, f2, f3); GL11.glCallList(this.glSkyList); GL11.glDisable(GL11.GL_FOG); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); RenderHelper.disableStandardItemLighting(); float f7; float f8; float f9; float f10; GL11.glEnable(GL11.GL_TEXTURE_2D); OpenGlHelper.glBlendFunc(770, 1, 1, 0); GL11.glPushMatrix(); f6 = 1.0F - world.getRainStrength(partialTicks); f7 = 0.0F; f8 = 0.0F; f9 = 0.0F; GL11.glColor4f(1.0F, 1.0F, 1.0F, f6); GL11.glTranslatef(f7, f8, f9); GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F); System.out.println(" - celestialange of " + world.getCelestialAngle(partialTicks)); f10 = 30.0F; // Deleted moon/sun code GL11.glDisable(GL11.GL_TEXTURE_2D); float f18 = world.getStarBrightness(partialTicks) * f6; if (f18 > 0.0F) { GL11.glColor4f(f18, f18, f18, f18); GL11.glCallList(this.starGLCallList); } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_FOG); GL11.glPopMatrix(); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor3f(0.0F, 0.0F, 0.0F); double d0 = mc.thePlayer.getPosition(partialTicks).yCoord - world.getHorizon(); if (d0 < 0.0D) { GL11.glPushMatrix(); GL11.glTranslatef(0.0F, 12.0F, 0.0F); GL11.glCallList(this.glSkyList2); GL11.glPopMatrix(); f8 = 1.0F; f9 = -((float)(d0 + 65.0D)); f10 = -f8; tessellator1.startDrawingQuads(); tessellator1.setColorRGBA_I(0, 255); tessellator1.addVertex((double)(-f8), (double)f9, (double)f8); tessellator1.addVertex((double)f8, (double)f9, (double)f8); tessellator1.addVertex((double)f8, (double)f10, (double)f8); tessellator1.addVertex((double)(-f8), (double)f10, (double)f8); tessellator1.addVertex((double)(-f8), (double)f10, (double)(-f8)); tessellator1.addVertex((double)f8, (double)f10, (double)(-f8)); tessellator1.addVertex((double)f8, (double)f9, (double)(-f8)); tessellator1.addVertex((double)(-f8), (double)f9, (double)(-f8)); tessellator1.addVertex((double)f8, (double)f10, (double)(-f8)); tessellator1.addVertex((double)f8, (double)f10, (double)f8); tessellator1.addVertex((double)f8, (double)f9, (double)f8); tessellator1.addVertex((double)f8, (double)f9, (double)(-f8)); tessellator1.addVertex((double)(-f8), (double)f9, (double)(-f8)); tessellator1.addVertex((double)(-f8), (double)f9, (double)f8); tessellator1.addVertex((double)(-f8), (double)f10, (double)f8); tessellator1.addVertex((double)(-f8), (double)f10, (double)(-f8)); tessellator1.addVertex((double)(-f8), (double)f10, (double)(-f8)); tessellator1.addVertex((double)(-f8), (double)f10, (double)f8); tessellator1.addVertex((double)f8, (double)f10, (double)f8); tessellator1.addVertex((double)f8, (double)f10, (double)(-f8)); tessellator1.draw(); } if (world.provider.isSkyColored()) { System.out.println(" - sky colored - YES"); GL11.glColor3f(f1 * 0.2F + 0.04F, f2 * 0.2F + 0.04F, f3 * 0.6F + 0.1F); } else { System.out.println(" - sky colored - NO"); GL11.glColor3f(f1, f2, f3); } GL11.glPushMatrix(); GL11.glTranslatef(0.0F, -((float)(d0 - 16.0D)), 0.0F); GL11.glCallList(this.glSkyList2); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(true); } } Quote Long time Bukkit & Forge Programmer Happy to try and help Link to comment Share on other sites More sharing options...
Abastro Posted May 15, 2014 Share Posted May 15, 2014 why are you using the SkyRenderer? Quote I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP) II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium. Link to comment Share on other sites More sharing options...
delpi Posted May 15, 2014 Author Share Posted May 15, 2014 Don't want a moon. Quote Long time Bukkit & Forge Programmer Happy to try and help Link to comment Share on other sites More sharing options...
Abastro Posted May 15, 2014 Share Posted May 15, 2014 So, you just deleted the moon from the Renderer? Quote I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP) II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium. Link to comment Share on other sites More sharing options...
delpi Posted May 15, 2014 Author Share Posted May 15, 2014 For now (also the sun). There are some other reasons I want a custom render later. Are you thinking that is the reason for the sky color oddity? Not sure I follow how those are connected. Quote Long time Bukkit & Forge Programmer Happy to try and help Link to comment Share on other sites More sharing options...
delpi Posted May 15, 2014 Author Share Posted May 15, 2014 Fixed it. Need to set the fog color. That introduced a new problem, now the clouds lit up. So I removed the clouds and now it is the just the starts twinkling large in the sky. Quote Long time Bukkit & Forge Programmer Happy to try and help Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.