seblague / marching-cubes Goto Github PK
View Code? Open in Web Editor NEWCoding Adventure
Home Page: https://www.youtube.com/watch?v=M3iI2l0ltbE
License: MIT License
Coding Adventure
Home Page: https://www.youtube.com/watch?v=M3iI2l0ltbE
License: MIT License
Hello, I am interested in the terrain system and I wanted to implement a placement of objects (for example trees) these consist of frequency (how much probability that trees appear), size and prefab, all in arrays to edit each prefab , I tried to find the coordinates of each chunk to place the objects but it didn't work for me.
Error is in MeshGenerator at line 201:
"Triangle[] tris = new Triangle[numTris];"
whenever any scene is run, get the error OutOfMemoryException - Out of Memory
I am thinking of to apply this Project on DICOM Files. Do you think this would be possible?
I am learning the marching cubes currently, thats why I can not really understands, where in code (e.g. MeshGenerator) the algorithm takes place.
Have anyone an advice for me?
Noob question: how can I make the terrain shader work in hdrp?
sorry I am quite new to unity and I don't know how to change the seed in play
how to get the same effect as in 4:28 because you came out the planet in the movie and I have a circle
Hi I was wondering if you could shed some light on how to edit single voxels in realtime similar to 7 days to die or minecraft, I have created a voxel engine in the past but could not get marching cubes working and I have no experience with compute shaders. I cannot figure out how to edit the "voxel array" and update the chunk. I believe that the pointsBuffer holds the information I need however I don't know where it is safe to edit it and also what type of "Array" it is. I have tried
float[] voxels = new float[meshGen.pointsBuffer.count]; meshGen.pointsBuffer.GetData(voxels);
however it returns system.single[] and i do not know how to fix this. I tried making a 2d array but i threw a memory exception error. Any help would be greatly appreciated thank you for your time.
Hey, at first: great work.
problem: if i generate colliders automatically in terrain mode and use a non fixed map, the collider isn't active. if I disable and enable the chunk or the meshcollider component of the cunk in playmode, the collider works.
how to fix this?
there a no problems in fixed map mode.
I've been trying to speed this thing up on my fork and render out further. Increasing the chunk size helps, but I noticed something in the performance window:
The main reason larger chunks take longer is because they take longer on the GPU. But the CPU and GPU are different devices, so they can operate concurrently. Unity has a function called AsyncGPUReadback that solves this, though it adds some latency. I think adding that to UpdateChunkMesh would work.
There is a build in triangle object in HLSL.
Would it be faster than using the created struct? it look like the triangle object is just a array of 3 float3 and could save the need of this loop :
for (int i = 0; i < numTris; i++) {
for (int j = 0; j < 3; j++) {
meshTriangles[i * 3 + j] = i * 3 + j;
vertices[i * 3 + j] = tris[i][j];
}
}
I'm not 100% sure of the loop removal opportunity but might be worth investigating
Hi
When I check out the project I get the following error:
-------- GLSL link error: Compute info
------------
0(53) : error C5041: cannot locate suitable resource to bind variable "TempArray0". Possibly large array.
0(14) : error C5041: cannot locate suitable resource to bind variable "ImmCB_0_0_1". Possibly large array.
I'm on Ubuntu 18.04 and Unity 2018.3.0f2. My graphics API is OpenGLCore
.
In your video you showed a simple terrain editor. Could you upload that script?
Running it with Unity 2019.1.0f2 - Linux, I've got this error message :
Kernel at index (0) is invalid
UnityEngine.ComputeShader:Dispatch(Int32, Int32, Int32, Int32)
MeshGenerator:UpdateChunkMesh(Chunk) (at Assets/Scripts/MeshGenerator.cs:199)
MeshGenerator:InitVisibleChunks() (at Assets/Scripts/MeshGenerator.cs:166)
MeshGenerator:Run() (at Assets/Scripts/MeshGenerator.cs:85)
MeshGenerator:Update() (at Assets/Scripts/MeshGenerator.cs:67)
I just checked out the project, and I run into some problems:
First I had to convert the project from 2018.3.2f1to 2018.3.8f1
After this was done, I was greeted by the following error message:
Compute Shader: The destination buffer in CopyComputeBufferCount is not of type Raw or IndirectArguments. DX11 only supports CopyComputeBufferCount to these types.
While trying to execute the scenes, or just looking around the scene, I got often this message:
OutOfMemoryException: Out of memory
MeshGenerator.UpdateChunkMesh (Chunk chunk) (at Assets/Scripts/MeshGenerator.cs:201)
And when inspecting the components in the scenes, I saw 2 components that had a "missing script" warning. The "Main Camera" in the submarine scene, and the "Chunk holder" in the terrain scene.
What could this be hapenning?
This is not perhaps the correct way to ask such a question, I'm trying to use your engine for some research in immersive analytics. I've been trying to use the existing unity implementation of FastNoiseSIMD as a source of noise, as it offers multi-layered 3D cellular noise (I'm not making a minecraft clone, but I do need interconnected caves).
I've managed to use the noise library to deform the "density sphere" mesh by deforming the mesh filter on the chunk. What I would like to do is actually get it to define the initial coordinates of the vertices. What I gather is that I need a custom density generator with the specific noise source.
Do I need to use a Compute Shader similar to noisedensity and do it within that, or is there a way of determining pointbuffer id coordinates in the C# script and use a more basic density compute shader?!? I would prefere the second option, as I'm not familiar with compute shader syntax...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.