Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invisible chunks #2

Open
aaron-jencks opened this issue Apr 19, 2019 · 6 comments
Open

Invisible chunks #2

aaron-jencks opened this issue Apr 19, 2019 · 6 comments

Comments

@aaron-jencks
Copy link

Love your tutorial, but I'm struggling to get my voxels to appear, I'm on part 4 right now, my textures seemed to work okay for part 3, but now nothing shows up, I cloned the repository, and it appears this is a bug with the source scripts and I don't know how to fix it. If all of the blocks are the same type it runs fine, but when I fill the materials list with the 12 blocks on the texture sheet, everything disappears, but no errors are thrown.

I have the textures set up as follows

Size: 12
Everything is solid
Stone:
0,0,0,0,0,0
Dirt:
1,1,1,1,1,1
Grass:
2,2,7,1,2,2
Coal:
3,3,3,3,3,3
Planks:
4,4,4,4,4,4
Log:
5,5,6,6,5,5
Cobble:
8,8,8,8,8,8
Bedrock:
9,9,9,9,9,9
Sand:
10,10,10,10,10,10
Brick:
11,11,11,11,11,11
Furnace:
13,12,15,15,13,13
Lit Furnace:
13,14,15,15,13,13

I'm using the source scripts straight from part 4, I went back and swapped my code out for the original and the problem persists.

This is what it looks like when I hit play:
image

@TheDustySheep
Copy link

I was having the same problem, found that it was a problem with the air block, you might need to set its renderfaces to true.

@StarStorms21
Copy link

StarStorms21 commented Nov 18, 2019

Got the same problem! i dont really understand what you mean with the 'air' block...would you mind explaining how you fixed this?...if you did that is

I was having the same problem, found that it was a problem with the air block, you might need to set its renderfaces to true.

@benrusza
Copy link

benrusza commented May 7, 2020

you need a air block in id 0 marked as transparent and not solid, i mean the array of blocks need a value of air in this case was to be 0

@Mycos-ToS
Copy link

Mycos-ToS commented May 18, 2020

Air blocks don't exist as of episode 4 but yours works just fine. Just like iggy12345 up at the top, I cloned the files but the chunks are still invisible. I went through every single line of code but it still is buggy. Any ideas?

Also, I tried putting an air block in slot 0 with solidity off and it still didn't work.

@BuzzyRobo
Copy link

If anyone is still having this problem, you need to change this bit of code to fix it:
`
void PopulateVoxelMap()
{

	for (int y = 0; y < VoxelData.ChunkHeight; y++)
	{
		for (int x = 0; x < VoxelData.ChunkWidth; x++)
		{
			for (int z = 0; z < VoxelData.ChunkWidth; z++)
			{

				if (y < 1)
					voxelMap[x, y, z] = 0;
				else if (y == VoxelData.ChunkHeight - 1)
					voxelMap[x, y, z] = 3;   <---------Change this to 2
				else
					voxelMap[x, y, z] = 1;

			}
		}
	}

}`

@fefedelcid
Copy link

fefedelcid commented Dec 3, 2022

If anyone is still having this problem, you need to change this bit of code to fix it:

...
voxelMap[x, y, z] = 3;   <---------Change this to 2
...

I have the same problem even using this solution.
The only way I can find to show the Chunks is by changing the following line:

bool CheckVoxel(Vector3 pos) {
	...
	if (!IsVoxelInChunk(x, y, z))
		// return world.blocktypes[world.GetVoxel(pos + position)].isSolid;
		return false;
	...
}

But this causes the inner triangles to still be rendered...
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants