Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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°

904420478_Snmkaobrazovkyz2019-10-2410-19-20.png.65fef5b0773f4154bdabf370a178e281.png

 

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();
    }

 

  • 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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.