Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.15] Strange lighting on interior of block with transparency


Haydenman2
 Share

Recommended Posts

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

...

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.