Jump to content

SpiderPig

Members
  • Posts

    2,300
  • Joined

  • Last visited

Everything posted by SpiderPig

  1. This is looking really good. I used the Leadwerks editor the other day and realised how much I missed it. Ultra is going to be great!
  2. Not really... because each node has a set amount of vertices and triangles, if you want to have a smooth shape you have to interpolate the vertices down or up the nodes edge toward the surface. There's no visual stepping or anything, it just creates a lot of small triangles where the vertices have been moved really close to a nodes corner. Mostly it is just wasted geometry because they are so small but I've found it does give a more non-uniform look in the geometry compared to the 2D terrain rendering method with set patch sizes. In some cases the vertices could all be on top of one another and therefore the triangle is not visible at all, but it is still there. This is marching cubes without interpolation.
  3. Height mask applied to the generation process. If the mask has values between 0.0 and 1.0 it will form a height gradient.
  4. Through brief trial and error I got this example to work. I want to be able to get the materials index so I can retrieve multiple materials in the shader for my voxel terrain. I can find a way to send the materials indexes I need to the shader, that shouldn't be a problem. (I'll probably use a small texture to hold the index) It's just actually getting the material index. Something like this perhaps? material->GetIndex() My C++ Code: auto material1 = CreateMaterial(); material1->SetColor(0, 1, 0); auto material2 = CreateMaterial(); material2->SetColor(1, 0, 0); ... terrain->SetMaterial("VoxelObject.mat"); My Shader Code: Material m1 = materials[3]; Material m2 = materials[4]; float slope = getSlope(normal); color = mix(m1.diffuseColor, m2.diffuseColor, slope); The Result:
  5. Marching cubes are not the best for displaying geometry. It's fine if you want a blocky look (let the vertex be created at the centre of every node edge) but if you interpolate to better match the object you want to represent, you end up with lots of different sized triangles. Below is flat shading so it's more obvious, but you can see in wireframe the steps where triangles are squashed as it goes up to the next highest node. SurfaceNets and DualContouring should be much better (and faster to generate) but there are aspects about both I don't really like. SurfaceNets, once the vertices are created, needs to be looped over a few times to slowly morph the vertices toward one another to create a smooth shape. This means the object will shrink a little at the edges. DualContouring seems much better but does use some fancy math I can't wrap my head around (yet) to better represent sharp edges. I think I am going to try and make something that is a combination of the two. MarchingCubes: WireFrame:
  6. Slope mask as calculated in the fragment shader.
  7. I've placed a grass and dirt texture in the flow regions. I think that when these maps are combined with height and slope texturing too they'll look quite nice. @Josh is it possible for me to create a shader for my voxel terrain that supports multiple materials like your terrain system does?
  8. I think I've found the maps now. The flow map needs some noise filtering still. I'll work on that later. Wear Map: Flow Map: Deposition Map:
  9. ...not too sure about that one. If your calling PeekEvent and WaitEvent it should work. It may be a bug...
  10. In UESystem.h declare a variable after the class like this: extern UESystem CoreSystem; (I've only ever used raw pointers for this but I assume it will work the same) Then in you main.cpp keep your definition of: UESystem CoreSystem; Then you can include UESystem.h where ever you want and access its public members and methods ike so: CoreSystem.world ...etc.
  11. Are you just wondering how to define the variables? In which case you simply enclose the class name like this: shared_ptr<World> world;
  12. SpiderPig

    Moon

    Wow that looks good.
  13. That'd would be cool. I'm going to try to do something like that. I'll probably generate a separate cave system beneath the surface with 3D simplex noise and then have it erode through the surface into it somehow. I'm a bit closer with the erosion map now. I'd like to separate the data into 3 layers like world machine. Wear map, flow map, and deposition map. I think the flow map could be separated by using the droplets speed perhaps.
  14. And this is 2.5 million iterations. Just curious to see the difference. The heightmap spat the dummy but that's just my exporting skills talking. The erosion map however looks better. Anyway I have a few ideas to try now.
  15. Not quite. But very interesting.
  16. Yeah it does a bit. Actually - it might be because each drop is randomly placed on the terrain with Random(0, terrain_size) and all I'm really drawing to the texture is the positions the drops are falling on... You have given me something to think about...
  17. I've applied the erosion map to the voxel terrain, but I don't feel like it's telling me what I want to know. It looks like gibberish compared to an erosion mask generated in world machine for the same heightmap. World Machine;
  18. The same hills and terrain size but as a voxel terrain. This has the one texture at the moment and currently has flat shading enabled. I will probably need to upload the heightmap to the vertex shader to do smooth shading. I want to try creating vertical cliffs as well as overhangs that can all be part of the erosion process. But we will see. I sample the heightmap like this; float CalculateTerrainSurface(shared_ptr<VoxelObject> voxel_object, shared_ptr<VoxelBrush> brush, VoxelNode* node, Decimal3& position) { auto plane = Plane(Vec3(0,64,0), Vec3(0, 1, 0)); auto x = (int)position.x; auto z = (int)position.z; auto height = terrain_generator->GetHeight(x, z); return plane.DistanceToPoint(position.x, position.y, position.z) - height; }
  19. I thought it may have been a shader thing. I might just use klepto2's idea then.
  20. Green is default, red is sediment deposition and blue is erosion. Longer droplet lifetimes push the sediment further into the valleys and increasing the sediment capacity cuts larger grooves into the terrain. With Textures: I think now I start experimenting with merging different terrain types together and changing textures based on biome as well slope & height.
  21. The above way looks pretty good and it's pretty straight forward to setup. Also, I wonder if bending between materials can be done like this : https://habr.com/en/post/442924/ I don't know much about it but I'm going to try it for my voxel terrain and see what works.
  22. I don't fully understand the code I implemented yet, but at some stage I will compare them and see what works best. Here's a basic erosion map overlay. I just did something quick, I think the dirt is being shown along the deposit positions. I will need to read through the erosion code to build a better erosion map. Ideally I'd like the flow and deposition maps to be separate channels / textures.
  23. I've just realised there's probably no way to blend it seeing as Ultra can use so many different terrain materials. I guess though you could assign a material per channel and do something like what I think I just got working... for (int y = 0; y < 512; y++) { for (int x = 0; x < 512; x++) { auto value = terrain_gen->GetErrosion(x, y); if (value != 0.0f) { terrain->SetMaterial(x, y, rocks, value); } } }
  24. Is it possible to spread a single texture over the entire terrain? I want to draw my erosion texture across the terrain surface...
×
×
  • Create New...