-
Posts
2,272 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Posts posted by SpiderPig
-
-
Ah okay. I'll try that too.
-
Posted the issue here:
https://www.ultraengine.com/community/topic/62056-shadow-problems/
-
Okay, it's because it's far away from the origin. This test grid is 2048 vertically up, move around and you can see the dark shapes move with the camera. I wouldn't have thought this was far enough for floating point problems, but it may be related?
#include "UltraEngine.h" using namespace UltraEngine; Vec3 mousepos = Vec3(0.0f); float move_adjustment = 0.1f; float move_speed = 1.0f; float lookspeed = 0.1f; float looksmoothing = 0.5f; int main(int argc, const char* argv[]) { auto displays = GetDisplays(); auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); auto world = CreateWorld(); auto framebuffer = CreateFramebuffer(window); auto camera = CreateCamera(world); camera->SetClearColor(0.125); camera->SetFov(70); camera->SetPosition(0, 0, -3); auto light = CreateDirectionalLight(world); light->SetRotation(35, 35, 0); auto box = CreateBox(world); box->SetPosition(10.0f, 2049.0f, 10.0f); auto custom_model = CreateModel(world); auto mesh = custom_model->AddMesh(); int size = 256, index = 0; for (int z = 0; z < size; z++) { for (int x = 0; x < size; x++) { mesh->AddVertex(x, 0.0f, z, 0.0f, 1.0f, 0.0f); if (x != 0 && x != size - 1 && z != 0 && z != size - 1) { mesh->AddPrimitive(index, index - size - 1, index - 1); mesh->AddPrimitive(index, index - size, index - size - 1); } index++; } } custom_model->UpdateBounds(); custom_model->SetPosition(0.0f, 2048.0f, 0.0f); camera->SetPosition(0.0f, 2048.0f, 0.0f); while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { if (window->KeyHit(KEY_F2) == true) { camera->SetWireframe(!camera->GetWireframe()); } auto _displaySize = window->GetSize(); float cx = Round((float)_displaySize.x / 2.0f); float cy = Round((float)_displaySize.y / 2.0f); auto mpos = Vec3(window->GetMousePosition().x, window->GetMousePosition().y, window->GetMousePosition().z); window->SetMousePosition(cx, cy); mpos = mpos * looksmoothing + mousepos * (1 - looksmoothing); auto dx = (mpos.x - cx) * lookspeed; auto dy = (mpos.y - cy) * lookspeed; auto camrot = camera->GetRotation(); camrot.x += dy; camrot.y += dx; camera->SetRotation(camrot); mousepos = mpos; auto speed = 0.1f; if (window->KeyDown(KEY_SHIFT) == true) { speed = speed * 10.0f; } if (window->KeyDown(KEY_W) == true) {camera->Move(0, 0, speed);} else if (window->KeyDown(KEY_S) == true) { camera->Move(0, 0, -speed); } if (window->KeyDown(KEY_A) == true) { camera->Move(-speed, 0, 0); } else if (window->KeyDown(KEY_D) == true) { camera->Move(speed, 0, 0); } world->Update(); world->Render(framebuffer); } return 0; }
-
-
-
-
-
That's what I originally thought but it never has... not for a custom mesh at least. Unless there's something extra I need to setup. Material or entity settings perhaps?
-
Here's something I've never mastered. How to get my large voxel terrain to cast shadows onto itself? At the very least I want nearby mountains to cast shadows. Is this a separate pass done in a specific shader? Or some highly advanced custom code I need to write?
-
-
No subscription system any more. Hopefully released by the end of the year. You can look at the store for pre-order prices.
-
So pretty.
-
Can Ultra track how much VRAM it is using as well as what's available? I was just playing Assassins Creed and it showed the total available and the total used by the game.
-
Oooohhh. It all makes sense now. Thanks!
- 1
-
Should it be converted back before using it?
-
Thanks, but what does that do exactly?
-
-
I can't help but notice areas like this. This is exactly what I wanted and got easily with voxels. This is a strong gravity area right to the edge of the world and will provided a sharp transition between two gravity regions. The player can tie a rope too a tree and jump off then quickly fall / land safely in another world.
- 2
-
Got a little side tracked and generated a gravity map. Red is 0% gravity and green is 100% with all the smooth interprolation between them as you approach the edge of the world. This is going to be used in the erosion calculations as well which should give interesting results. I'll add another element to this too - small pockets of reversed gravity where if you go over those, you'll have to be quick to get back down! I might also make some 0% gravity areas around mountains as well. Just for a bit of fun.
- 1
-
Yes he's focused on Ultra right now. If you can work around it, that might be best for now.
-
You can confirm it's a bug by making a simple application and posting the code in bug reports to see what Josh says about it.
-
I re-call this issue ages ago when my project was in Leadwerks. I reckon it's a bug but you can try this in C++. I can't remember if you can even call this function like this, but give it a go and see what happens.
System::CollectGarbage();
- 1
-
I've been working on the foundation for the terrain. Currently the voxel terrain samples an SDF field to get the basic shape. It only ever samples what it needs to render so it is very fast. But, it posses problems in areas such as procedurally placing foliage, buildings, roads and paths as well as calculating erosion to get nicer looking terrain. While ray-casting the voxel terrain's octree is super fast I can't use that information to place things due to the fact that in the distance lower LOD levels won't give accurate height information. As the player moves the terrain will change, leaving trees and buildings in the air. I could update all these things to match the new terrain heights but that'll involve everything popping and moving around during game which I think won't be nice to look at.
What I really wanted to do is create a 3D grid of floats for the entire voxel volume and just use that as the map for the entire volume. But at a size of 2048^3 that is about 3x10^10 bytes. Which is... something big in gigabytes. I can't math today.
Subdividing the terrain's octree to store this information (even though it doesn't have to be all rendered at once) will still result in massive amounts of RAM and is just unmanageable.
So I think the only way is to cast my SDF function into a small set of heightmaps. From them I can perform erosion, calculate normals maps (pass both of these maps to the shader to get some nice results at lower LOD levels) and use these maps to procedurally populate the world rather than ray-casting the octree all the time.
As far as stopping the terrain from intersecting buildings and trees in the distance, I'll have to make the LOD algorithm to be smarter and reduce the poly count in areas where it won't matter too much to be noticeable.
First attempt at ray-casting the SDF field gave more of a mask result. And it took 10 minutes to calculate!
Got it to work a bit later though. These are top down shots and it took about 40 seconds to ray-cast this 2048x2048 heightmap. I'm pretty sure I can split this into workgroups and give it a compute shader. I will need six heightmaps. Once for each face of the cuboid terrain. This results in a manageable 100MB of RAM / GPU Memory usage.
Now I need to make sure I can cast these heightmaps back into the voxel terrain. Should be easy though.
- 1
-
The Seventh World - WIP
in Showcase
Posted
Breaking out the procedural town generator.