Closed KarolDebiec closed 3 years ago
i'm glad you used my project. The problem with the height of the surface can be solved with the change of variable inthe "NoiseManager" gameobject, it have a component "NoiseManager" with a variable called "Surface Level". That varible indicate the desire height of the surface for all biomes. You can increase to the max height - 45 for adapt it to the actual biomes. You will need delete the actual data of the world for see the changes in the edited terrain (saved in the Application.persistentDataPath).
For the second problem of the lighting, I try to update the project to the HDRP but i archive no illumination on the terrain, so I can't investigate the problem of your light. However I recommend you the use of the LWRP, because the terrain is generated in real-time you can't bake lightmaps so it's a better option for a voxel-game with realtime-lighting.
Thanks for the reply. So I found the problem with the lights. You forgot to include :
meshGenerated.RecalculateNormals();
meshGenerated.RecalculateTangents();
in MeshBuilder.cs it should be something like this I think.
public Mesh BuildChunk(byte[] b)
{
BuildChunkJob buildChunkJob = new BuildChunkJob
{
chunkData = new NativeArray<byte>(b, Allocator.TempJob),
isoLevel = this.isoLevel,
interpolate = this.interpolate,
vertex = new NativeList<float3>(500, Allocator.TempJob),
uv = new NativeList<float2>(100, Allocator.TempJob),
};
JobHandle jobHandle = buildChunkJob.Schedule();
jobHandle.Complete();
//Get all the data from the jobs and use to generate a Mesh
Mesh meshGenerated = new Mesh();
Vector3[] meshVert = new Vector3[buildChunkJob.vertex.Length];
int[] meshTriangles = new int[buildChunkJob.vertex.Length];
for (int i = 0; i < buildChunkJob.vertex.Length; i++)
{
meshVert[i] = buildChunkJob.vertex[i];
meshTriangles[i] = i;
}
meshGenerated.vertices = meshVert;
Vector2[] meshUV = new Vector2[buildChunkJob.vertex.Length];
for (int i = 0; i < buildChunkJob.vertex.Length; i++)
{
meshUV[i] = buildChunkJob.uv[i];
}
meshGenerated.uv = meshUV;
meshGenerated.triangles = meshTriangles;
//Dispose (Clear the jobs NativeLists)
meshGenerated.RecalculateNormals();
meshGenerated.RecalculateTangents();
buildChunkJob.vertex.Dispose();
buildChunkJob.uv.Dispose();
buildChunkJob.chunkData.Dispose();
return meshGenerated;
}
Thanks for the fix, I will add to the actual repository. Good luck with your project.
Hi, thanks for your project! Ater changing to HDRP and using the lit texture on terrain I have this weird problem where I can only light up in one direction. Something like this. Do you have any clue what happened there?