-
Posts
2,285 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Posts posted by SpiderPig
-
-
I'm not sure if I'm actually setting the buffer correctly, but the problem here is it fails to save as a DDS image.
#include "UltraEngine.h" using namespace UltraEngine; 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, 10, 0); auto light = CreateDirectionalLight(world); light->SetRotation(35, 35, 0); auto box = CreateBox(world); box->SetPosition(10.0f, 2049.0f, 10.0f); int size = 1024; unsigned short* buffer = new unsigned short[size * size]; for (int y = 0; y < size; y++) { for (int x = 0; x < size; x++) { buffer[(y * size) + x] = (unsigned short)Random(USHRT_MAX); } } auto data = CreateBuffer(size * size * 2); data->Poke(0, (const char*)buffer, size * size * 2); auto map = CreatePixmap(size, size, TEXTURE_R16, data); map->Save("Test.dds"); delete[] buffer; while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
Output:
Saving texture "Test.dds" Error: Unsupported pixel format 76 can't be saved to DDS. Error: Failed to save texture "Test.dds".
-
Also I couldn't save a pixmap with R16 format as DDS. I saw you had it working here though, is this no longer supported?
-
Oh cool, thanks. And that'll still between 0 and 1 yeah?
-
Can I still sample a half float texture like this?
vec4 color = texture(texture2DSampler[textureID], texcoords.xy);
Or is there a different function for this? I don't know what the value of the vec4 would actually be...
-
I want to save my heightmaps as R16 textures an use them for displacement and other things in shaders. Are these textures sampled any different to normal RGBA textures? Does the sample still return a vec4 with values in the range of 0 to 1?
-
-
-
Wow cool stuff! I'm keen to hear the technical stuff on how you got it working. 😉
- 1
-
Before starting the towns I had to fix a lot of core things with the voxel terrain. Now that I've done that I have also fixed a problem in the ray-casting of the SDF causing stepping in the heightmap and thus stepping in the normal map.
Much nicer. I think it'd look better if the normal map was 4x bigger to give more detail, but I'll assess that after erosion maps and better texture placement are in use.
- 3
-
Is it possible in Ultra to draw every entities AABB for debugging purposes? I'm sure I could make it myself but thought it worth checking first.
- 1
-
Downloaded and tested and I do see memory increase when paused. Script memory goes up pretty fast. Confirmed with task manager open too. It's a few MB a minute. I wonder what it could be if @Alienhead did not see it on his machine.
- 1
-
-
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.
R16 Texture Sampling
in Programming
Posted
Posted a bug report for the saving issue.
https://www.ultraengine.com/community/topic/62096-cant-save-r16-pixmap-as-dds/