Posted October 24, 20195 yr I have problem with lighting when I rotate model in TER. When it is rendered without rotation, lighting for up/down is correct, but all sides are bright. When I rotate it a bit, dark side (from bottom) is rendered on top. See picture where model is rotated ~90° TES: public void render(WaterWheelTile tile, double x, double y, double z, float partialTicks, int destroyStage) { if (model == null) { model = Minecraft.getInstance().getModelManager().getModel(new ModelResourceLocation("toomanyores:waterwheel")); } Direction direction = tile.getBlockState().get(WaterWheelBlock.HORIZONTAL_FACING); GlStateManager.pushMatrix(); GlStateManager.enableLighting(); GlStateManager.translated(x, y, z); GlStateManager.scaled(1/16.0, 1/16.0, 1/16.0); GlStateManager.translated(8, 16, 8); switch (direction) { case NORTH: GlStateManager.rotated(90, 0, 1, 0); break; case SOUTH: GlStateManager.rotated(270, 0, 1, 0); break; case EAST: GlStateManager.rotated(180, 0, 1, 0); break; case WEST: GlStateManager.rotated(0, 0, 1, 0); break; } GlStateManager.translated(0, -8, 0); GlStateManager.rotated(90, 1, 0, 0); GlStateManager.translated(0, 8, 0); if (Minecraft.isAmbientOcclusionEnabled()) { GlStateManager.shadeModel(GL11.GL_SMOOTH); } else { GlStateManager.shadeModel(GL11.GL_FLAT); } int i = tile.getWorld().getCombinedLight(tile.getPos(), 0); int j = i % 65536; int k = i / 65536; float brightness = Math.max(j / 255f, k / 255f); bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE); Minecraft.getInstance().getBlockRendererDispatcher().getBlockModelRenderer().renderModelBrightness(model, tile.getBlockState(), brightness, true); GlStateManager.disableLighting(); GlStateManager.popMatrix(); }
October 24, 20195 yr Author Seems that GlStateManager.enableNormalize(); GlStateManager.enableRescaleNormal(); helped, but still there is visible effect that light is comming down in small angle not directly from obove.
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.