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

Hello,

 

I am trying to finish the model for a basic tank block, however despite my best efforts the tanks have very odd shadows being cast. I have tried everything I can think of to get this gone however nothing is working. Any advice for any way I might be able to overcome the strange shading?

 

	private static final VoxelShape SHAPE = Stream.of(Block.makeCuboidShape(0, 0, 0, 16, 1, 16),
			Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16),
			Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(15, 1, 0, 16, 15, 1),
			Block.makeCuboidShape(0, 15, 0, 16, 16, 16), Block.makeCuboidShape(1, 1, 0, 15, 15, 1),
			Block.makeCuboidShape(1, 1, 15, 15, 15, 16), Block.makeCuboidShape(1, 1, 1, 15, 15, 15),
			Block.makeCuboidShape(0, 1, 1, 1, 15, 15), Block.makeCuboidShape(15, 1, 1, 16, 15, 15)).reduce((v1, v2) -> {
				return VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR);
			}).get();

	private static final DecimalFormat FORMAT = new DecimalFormat("###,###,###");

	private final int _capacity;
	private final TemperatureResistance _tempres;

	public BlockFluidTank(int capacity, TemperatureResistance resist) {
		super(Block.Properties.create(Material.GLASS).notSolid().hardnessAndResistance(4f, 15f).harvestLevel(0)
				.harvestTool(ToolType.PICKAXE).sound(SoundType.GLASS).variableOpacity());
		_capacity = capacity;
		_tempres = resist;

		this.setDefaultState(this.stateContainer.getBaseState().with(StateProperties.FLUID, DisplayFluids.NONE));
	}

	@Override
	public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) {
		if (state.getBlock() != newState.getBlock()) {
			if (worldIn.getTileEntity(pos) instanceof TEFluidTank) {
				worldIn.removeTileEntity(pos);
			}
		}
	}
	
	@Override
	public boolean isNormalCube(BlockState state, IBlockReader worldIn, BlockPos pos) {
		return false;
	}
RenderTypeLookup.setRenderLayer(getBlock("steel_fluid_tank"), RenderType.getCutout());
RenderTypeLookup.setRenderLayer(getBlock("wooden_fluid_tank"), RenderType.getCutout());
{
	"parent": "block/cube",
	"textures": {
		"0": "block/oak_log",
		"1": "block/oak_log",
		"2": "block/glass",
		"particle": "block/oak_log"
	},
	"elements": [
		"elements": [
		{
			"from": [0, 0, 0],
			"to": [16, 1, 16],
			"faces": {
				"north": {"uv": [0, 0, 16, 1], "texture": "#1"},
				"east": {"uv": [0, 0, 16, 1], "texture": "#1"},
				"south": {"uv": [0, 0, 16, 1], "texture": "#1"},
				"west": {"uv": [0, 0, 16, 1], "texture": "#1"},
				"up": {"uv": [0, 0, 16, 16], "texture": "#1"},
				"down": {"uv": [0, 0, 16, 16], "texture": "#1"}
			}
		},
		
		{
			"from": [0, 15, 0],
			"to": [16, 16, 16],
			"rotation": {"angle": 0, "axis": "y", "origin": [8, 23, 8]},
			"faces": {
				"north": {"uv": [0, 0, 16, 1], "texture": "#1"},
				"east": {"uv": [0, 0, 16, 1], "texture": "#1"},
				"south": {"uv": [0, 0, 16, 1], "texture": "#1"},
				"west": {"uv": [0, 0, 16, 1], "texture": "#1"},
				"up": {"uv": [0, 0, 16, 16], "texture": "#1"},
				"down": {"uv": [0, 0, 16, 16], "texture": "#1"}
			}
		},
		
		{
			"from": [0, 1, 15],
			"to": [1, 15, 16],
			"rotation": {"angle": 0, "axis": "y", "origin": [8, 9, 23]},
			"faces": {
				"north": {"uv": [0, 0, 1, 15], "texture": "#0"},
				"east": {"uv": [0, 0, 1, 15], "texture": "#0"},
				"south": {"uv": [0, 0, 1, 15], "texture": "#0"},
				"west": {"uv": [0, 0, 1, 15], "texture": "#0"},
				"up": {"uv": [0, 0, 1, 15], "texture": "#0"},
				"down": {"uv": [0, 0, 1, 15], "texture": "#0"}
			}
		},
		{
			"from": [15, 1, 15],
			"to": [16, 15, 16],
			"rotation": {"angle": 0, "axis": "y", "origin": [23, 9, 23]},
			"faces": {
				"north": {"uv": [0, 0, 1, 15], "texture": "#0"},
				"east": {"uv": [0, 0, 1, 15], "texture": "#0"},
				"south": {"uv": [0, 0, 1, 15], "texture": "#0"},
				"west": {"uv": [0, 0, 1, 15], "texture": "#0"},
				"up": {"uv": [0, 0, 1, 15], "texture": "#0"},
				"down": {"uv": [0, 0, 1, 15], "texture": "#0"}
			}
		},
		{
			"from": [0, 1, 0],
			"to": [1, 15, 1],
			"rotation": {"angle": 0, "axis": "y", "origin": [9, 9, 8]},
			"faces": {
				"north": {"uv": [0, 0, 1, 15], "texture": "#0"},
				"east": {"uv": [0, 0, 1, 15], "texture": "#0"},
				"south": {"uv": [0, 0, 1, 15], "texture": "#0"},
				"west": {"uv": [0, 0, 1, 15], "texture": "#0"},
				"up": {"uv": [0, 0, 1, 15], "texture": "#0"},
				"down": {"uv": [0, 0, 1, 15], "texture": "#0"}
			}
		},
		{
			"from": [15, 1, 0],
			"to": [16, 15, 1],
			"rotation": {"angle": 0, "axis": "y", "origin": [23, 9, 8]},
			"faces": {
				"north": {"uv": [0, 0, 1, 15], "texture": "#0"},
				"east": {"uv": [0, 0, 1, 15], "texture": "#0"},
				"south": {"uv": [0, 0, 1, 15], "texture": "#0"},
				"west": {"uv": [0, 0, 1, 15], "texture": "#0"},
				"up": {"uv": [0, 0, 1, 15], "texture": "#0"},
				"down": {"uv": [0, 0, 1, 15], "texture": "#0"}
			}
		},
		{
			"from": [1, 1, 0],
			"to": [15, 15, 1],
			"rotation": {"angle": 0, "axis": "y", "origin": [9, 9, 8]},
			"faces": {
				"north": {"uv": [0, 0, 16, 16], "texture": "#2"},
				"east": {"uv": [0, 0, 16, 16], "texture": "#2"},
				"south": {"uv": [0, 0, 16, 16], "texture": "#2"},
				"west": {"uv": [0, 0, 16, 16], "texture": "#2"},
				"up": {"uv": [0, 0, 16, 16], "texture": "#2"},
				"down": {"uv": [0, 0, 16, 16], "texture": "#2"}
			}
		},
		{
			"from": [1, 1, 15],
			"to": [15, 15, 16],
			"rotation": {"angle": 0, "axis": "y", "origin": [9, 9, 23]},
			"faces": {
				"north": {"uv": [0, 0, 16, 16], "texture": "#2"},
				"east": {"uv": [0, 0, 16, 16], "texture": "#2"},
				"south": {"uv": [0, 0, 16, 16], "texture": "#2"},
				"west": {"uv": [0, 0, 16, 16], "texture": "#2"},
				"up": {"uv": [0, 0, 16, 16], "texture": "#2"},
				"down": {"uv": [0, 0, 16, 16], "texture": "#2"}
			}
		},
		{
			"from": [0, 1, 1],
			"to": [1, 15, 15],
			"rotation": {"angle": 0, "axis": "y", "origin": [8, 9, 9]},
			"faces": {
				"north": {"uv": [0, 0, 14, 14], "texture": "#2"},
				"east": {"uv": [0, 0, 16, 16], "texture": "#2"},
				"south": {"uv": [0, 0, 14, 14], "texture": "#2"},
				"west": {"uv": [0, 0, 16, 16], "texture": "#2"},
				"up": {"uv": [0, 0, 14, 14], "texture": "#2"},
				"down": {"uv": [0, 0, 14, 14], "texture": "#2"}
			}
		},
		{
			"from": [15, 1, 1],
			"to": [16, 15, 15],
			"rotation": {"angle": 0, "axis": "y", "origin": [23, 9, 18]},
			"faces": {
				"north": {"uv": [0, 0, 16, 16], "texture": "#2"},
				"east": {"uv": [0, 0, 16, 16], "texture": "#2"},
				"south": {"uv": [0, 0, 16, 16], "texture": "#2"},
				"west": {"uv": [0, 0, 16, 16], "texture": "#2"},
				"up": {"uv": [0, 0, 16, 16], "texture": "#2"},
				"down": {"uv": [0, 0, 16, 16], "texture": "#2"}
			}
		}
	],
	"groups": [
		{
			"name": "VoxelShapes",
			"origin": [8, 8, 8],
			"children": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
		}
	]
}

 

2020-06-18_19.39.14.png

...

Howdy

 

You seem to have already tried the things I'd normally suggest. Odd that some of the internal faces are fine, but others aren't.

 

Some thoughts on how you could progress further:

1) See if the problem persists when you turn ambient occlusion rendering off in the settings

2) Put a breakpoint into IForgeBakedModel.getQuads with a conditional trigger for your blockstate.  Then trace out into renderModelFlat and watch carefully the values that it uses for brightness (the lightmap)

 

This will narrow things down to which part of your block, model, or quads is not right - eg whether the block's light is correct or not (and why not), or whether there's a setting wrong in your model or your block).  Simplifying your model to just one component might also be helpful.

 

I've managed to solve a number of weird lighting problems that way.

 

-TGG

  • Author

I've tried fiddling with filtering through each quad, and no luck sadly with anything. I ended up just simplifying the model significantly. Thank you for the advice.

...

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.