Jump to content

All Activity

This stream auto-updates

  1. Today
  2. These functions don't appear to have any effect on the shadows. I set them to 0 and nothing changes. light->SetShadowCascadeDistance(0); light->SetShadowSamples(0); But I don't know exactly what they should do... I want to reduce the shadow distance / quality somehow as a graphics option in game.
  3. This code won't stop the light from casting shadows. #include "Engine.h" #include "ComponentSystem.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, -5); camera->AddComponent<CameraControls>(); auto light = CreateDirectionalLight(world); light->SetRotation(35, 45, 0); light->SetShadows(false); auto floor = CreatePlane(world, 100, 100); auto cube = CreateBox(world); cube->Move(0, 2, 0); camera->SetPosition(0.0f, 2.0f, -3.0f); while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
  4. Your signature says 16 GB is that correct? This is caused by either not enough memory, or memory fragmentation. There's probably not much I can do about it.
  5. 0.9.6 Improved support for legacy MDL file format exported from Unwrap3D.
  6. Or user name uses non-latin symbols
  7. I have error "vector subscript out of range" now with SetUniform (Steam, beta branch)
  8. Windows 10. GTX 1070 8 Gigas VRAM. CPU I7 2600 24 Ram.
  9. @Yue and I have been discussing on discord about why my game does not load packages on his PC. On my PC and several others who have run my game it works as it should. The game states that it is loading the package then it will crash. This occurs for both password protected and non password protected zip files. Writing an example for this is extremely hard as It's only happening on his PC. The only thing that we can see what is different is that his Windows PC is in Spanish. Could that be effecting something? @Yue Can you please post your system specs here for Josh?
  10. Oh, I see. The fog is turning the sprite color black, and then that gets overlaid on top of the screen, right? I did not have any of these problems in my outline shader because I just used the depth buffer to decide whether the output should be white or black. But you are passing through the color buffer so that is more complicated. Maybe the only way is a per-camera setting to disable the skybox if it has been set.
  11. This means that malloc or realloc are returning NULL. How much RAM do you have?
  12. Yesterday
  13. This script can quickly model materials. Run it with the Scripts > Run menu item. Function is not recursive and the path to load is hard-coded, but that can be easily changed. Retarget Materials.lua
  14. This is my code from my API where it grabs whatever system environment you want. I might look into implementing the above as old Win32 API code can cause AV's to get grumpy but I haven't had problems so far. const std::wstring System::GetSystemEnviormentW(const std::string& env) { #ifdef _WIN32 wchar_t* buf = nullptr; size_t sz = 0; std::wstring wenv = String::ToWString(env); // Use _dupenv_s to get the environment variable if (_wdupenv_s(&buf, &sz, wenv.c_str()) == 0 && buf != nullptr) { std::wstring result(buf); free(buf); // Free the allocated buffer return result; } #else auto s = std::getenv(env.c_str()); if (s == NULL) return String::ToWString(s); #endif return L""; // Environment variable not found or error occurred }
  15. Now it's too dark For comparison without sprite and fog: #include "UltraEngine.h" #include "ComponentSystem.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); //Set environment maps const WString remotepath = "https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets"; auto specmap = LoadTexture(remotepath + "/Materials/Environment/Storm/specular.dds"); auto diffmap = LoadTexture(remotepath + "/Materials/Environment/Storm/diffuse.dds"); world->SetEnvironmentMap(specmap, ENVIRONMENTMAP_BACKGROUND); world->SetEnvironmentMap(specmap, ENVIRONMENTMAP_SPECULAR); world->SetEnvironmentMap(diffmap, ENVIRONMENTMAP_DIFFUSE); auto sz = framebuffer->GetSize(); int MAIN_LAYER = 1, OUTPUT_LAYER = 2, EXTRA_LAYER = 4; auto light = CreateBoxLight(world); light->SetRotation(35, 45, 0); light->SetRange(-10, 10); auto backBox = CreateBox(world, 5); backBox->SetPosition(0, 0, 7); backBox->SetColor(0, 1, 0, 1); auto betweenBox = CreateBox(world); betweenBox->SetRenderLayers(EXTRA_LAYER); betweenBox->SetColor(1, 0, 0, 1); auto unlitShader = LoadShaderFamily("Shaders/Unlit.fam"); auto boxMat = CreateMaterial(); boxMat->SetShaderFamily(unlitShader); betweenBox->SetMaterial(boxMat); auto betweenBox2 = CreateBox(world); betweenBox2->SetPosition(0.5, 0.5, 0); betweenBox2->SetRenderLayers(EXTRA_LAYER); betweenBox2->SetColor(1, 0, 0, 1); betweenBox2->SetMaterial(boxMat); auto frontBox = CreateBox(world, 1); frontBox->SetPosition(-0.5, 0, -0.5); frontBox->SetColor(1, 1, 0, 1); auto mainCameraInput = CreateCamera(world); mainCameraInput->SetPosition(0, 0, -3); mainCameraInput->SetRenderLayers(MAIN_LAYER); auto mainTextureBuffer = CreateTextureBuffer(sz.x, sz.y); mainCameraInput->SetRenderTarget(mainTextureBuffer); auto mainSprite = CreateSprite(world, sz.x, sz.y); mainSprite->SetRenderLayers(OUTPUT_LAYER); auto mainMaterial = CreateMaterial(); mainMaterial->SetShaderFamily(unlitShader); mainMaterial->SetTexture(mainTextureBuffer->GetColorAttachment()); mainSprite->SetMaterial(mainMaterial); auto mainCameraOutput = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); mainCameraOutput->SetPosition(sz.x * 0.5f, sz.y * 0.5f, 0); mainCameraOutput->SetRenderLayers(OUTPUT_LAYER); mainCameraOutput->SetLighting(false); mainCameraOutput->SetClearMode(CLEAR_DEPTH); //red transporent boxes render part auto extraCameraInput = CreateCamera(world); extraCameraInput->SetPosition(0, 0, -3); extraCameraInput->SetRenderLayers(EXTRA_LAYER); extraCameraInput->SetMatrix(mainCameraInput->matrix); extraCameraInput->SetClearMode(CLEAR_COLOR); extraCameraInput->SetLighting(false); extraCameraInput->SetFogColor(0, 0, 0, 1); extraCameraInput->SetFogAngle(90, 91); extraCameraInput->SetFog(true); auto range = extraCameraInput->GetRange().y; extraCameraInput->SetFogRange(range * 0.98, range * 0.99); auto extraTextureBuffer = CreateTextureBuffer(sz.x, sz.y); extraTextureBuffer->SetDepthAttachment(mainTextureBuffer->GetDepthAttachment()); extraCameraInput->SetRenderTarget(extraTextureBuffer); auto extraSprite = CreateSprite(world, sz.x, sz.y); extraSprite->SetPosition(0, 0, -0.00001); extraSprite->SetRenderLayers(OUTPUT_LAYER); extraSprite->SetShadows(false); auto extraMaterial = CreateMaterial(); extraMaterial->SetShaderFamily(unlitShader); extraMaterial->SetTransparent(true); extraMaterial->SetTexture(extraTextureBuffer->GetColorAttachment()); extraMaterial->SetColor(1, 1, 1, 0.5); extraSprite->SetMaterial(extraMaterial); extraSprite->SetHidden(false); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
  16. There are two Windows command that do this. With those you can get anything you want. WCHAR szPath[MAX_PATH]; if (SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_COMMON_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, szPath))) { return WString(szPath).Replace("\\", "/"); } PIDLIST_ABSOLUTE pidlist; wchar_t path[MAX_PATH]; SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidlist); SHGetPathFromIDListW(pidlist, path); return WString(path).Replace("\\", "/");;
  17. You could use camera fog: camera->SetFogColor(0,0,0,1); camera->SetFogAngle(90,91); auto range = camera->GetRange().y; camera->SetFogRange(range * 0.98, range * 0.99);
  18. New problem with skybox: Added just: const WString remotepath = "https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets"; auto specmap = LoadTexture(remotepath + "/Materials/Environment/Storm/specular.dds"); auto diffmap = LoadTexture(remotepath + "/Materials/Environment/Storm/diffuse.dds"); world->SetEnvironmentMap(specmap, ENVIRONMENTMAP_BACKGROUND); world->SetEnvironmentMap(specmap, ENVIRONMENTMAP_SPECULAR); world->SetEnvironmentMap(diffmap, ENVIRONMENTMAP_DIFFUSE); How to disable this effect for display sprite or camera?
  19. Final working example: #include "UltraEngine.h" #include "ComponentSystem.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 sz = framebuffer->GetSize(); int MAIN_LAYER = 1, OUTPUT_LAYER = 2, EXTRA_LAYER = 4, EXTRA_OUTPUT_LAYER = 8; auto light = CreateBoxLight(world); light->SetRotation(35, 45, 0); light->SetRange(-10, 10); auto backBox = CreateBox(world, 5); backBox->SetPosition(0, 0, 7); backBox->SetColor(0, 1, 0, 1); auto betweenBox = CreateBox(world); betweenBox->SetRenderLayers(EXTRA_LAYER); betweenBox->SetColor(1, 0, 0, 1); auto unlitShader = LoadShaderFamily("Shaders/Unlit.fam"); auto boxMat = CreateMaterial(); boxMat->SetShaderFamily(unlitShader); betweenBox->SetMaterial(boxMat); auto betweenBox2 = CreateBox(world); betweenBox2->SetPosition(0.5, 0.5, 0); betweenBox2->SetRenderLayers(EXTRA_LAYER); betweenBox2->SetColor(1, 0, 0, 1); betweenBox2->SetMaterial(boxMat); auto frontBox = CreateBox(world, 1); frontBox->SetPosition(-0.5, 0, -0.5); frontBox->SetColor(1, 1, 0, 1); auto mainCameraInput = CreateCamera(world); mainCameraInput->SetPosition(0, 0, -3); mainCameraInput->SetRenderLayers(MAIN_LAYER); auto mainTextureBuffer = CreateTextureBuffer(sz.x, sz.y); mainCameraInput->SetRenderTarget(mainTextureBuffer); auto mainSprite = CreateSprite(world, sz.x, sz.y); mainSprite->SetRenderLayers(OUTPUT_LAYER); auto mainMaterial = CreateMaterial(); mainMaterial->SetShaderFamily(unlitShader); mainSprite->SetMaterial(mainMaterial); mainMaterial->SetTexture(mainTextureBuffer->GetColorAttachment()); auto mainCameraOutput = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); mainCameraOutput->SetPosition(sz.x * 0.5f, sz.y * 0.5f, 0); mainCameraOutput->SetRenderLayers(OUTPUT_LAYER); mainCameraOutput->SetLighting(false); mainCameraOutput->SetClearMode(CLEAR_DEPTH); //red transporent boxes render part auto extraCameraInput = CreateCamera(world); extraCameraInput->SetPosition(0, 0, -3); extraCameraInput->SetRenderLayers(EXTRA_LAYER); extraCameraInput->SetMatrix(mainCameraInput->matrix); extraCameraInput->SetClearMode(CLEAR_COLOR); extraCameraInput->SetLighting(false); auto extraTextureBuffer = CreateTextureBuffer(sz.x, sz.y); extraTextureBuffer->SetDepthAttachment(mainTextureBuffer->GetDepthAttachment()); extraCameraInput->SetRenderTarget(extraTextureBuffer); auto extraSprite = CreateSprite(world, sz.x, sz.y); extraSprite->SetPosition(0, 0, -0.00001); extraSprite->SetRenderLayers(OUTPUT_LAYER); auto extraMaterial = CreateMaterial(); extraMaterial->SetShaderFamily(unlitShader); extraSprite->SetMaterial(extraMaterial); extraMaterial->SetTransparent(true); extraMaterial->SetTexture(extraTextureBuffer->GetColorAttachment()); extraMaterial->SetColor(1, 1, 1, 0.5); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
  20. this might be rarely usecase, but when you run this code: #include "UltraEngine.h" #include "ComponentSystem.h" //#include "Steamworks/Steamworks.h" using namespace UltraEngine; SIZE_T PrintMemoryInfo() { auto myHandle = GetCurrentProcess(); //to fill in the process' memory usage details PROCESS_MEMORY_COUNTERS pmc; //return the usage (bytes), if I may if (GetProcessMemoryInfo(myHandle, &pmc, sizeof(pmc))) return(pmc.WorkingSetSize); else return 0; } shared_ptr<Entity> main_instance; vector<shared_ptr<Entity>> instances; void UpdateHook(shared_ptr<Object> source, shared_ptr<Object> extra) { auto world = extra->As<World>(); if (world != NULL) { instances.clear(); for (int i = 0; i < 100; i++) { instances.push_back(main_instance->Instantiate(world)); } } } int main(int argc, const char* argv[]) { #ifdef STEAM_API_H if (not Steamworks::Initialize()) { RuntimeError("Steamworks failed to initialize."); return 1; } #endif RegisterComponents(); auto cl = ParseCommandLine(argc, argv); //Load FreeImage plugin (optional) auto fiplugin = LoadPlugin("Plugins/FITextureLoader"); //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 1280 * displays[0]->scale, 720 * displays[0]->scale, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); if (!AttachConsole(ATTACH_PARENT_PROCESS)) { if (AllocConsole()) { freopen("conin$", "r", stdin); freopen("conout$", "w", stdout); freopen("conout$", "w", stderr); } } else { auto consoleHandleOut = GetStdHandle(STD_OUTPUT_HANDLE); auto consoleHandleIn = GetStdHandle(STD_INPUT_HANDLE); auto consoleHandleErr = GetStdHandle(STD_ERROR_HANDLE); if (consoleHandleOut != INVALID_HANDLE_VALUE) { freopen("conout$", "w", stdout); setvbuf(stdout, NULL, _IONBF, 0); } if (consoleHandleIn != INVALID_HANDLE_VALUE) { freopen("conin$", "r", stdin); setvbuf(stdin, NULL, _IONBF, 0); } if (consoleHandleErr != INVALID_HANDLE_VALUE) { freopen("conout$", "w", stderr); setvbuf(stderr, NULL, _IONBF, 0); } } //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Create a world auto world = CreateWorld(); auto camera = CreateCamera(world); camera->SetClearColor(0.125); camera->SetFov(70); camera->Move(0, 2, -8); world->RecordStats(true); main_instance = CreatePlane(world, 10.0, 10.0, 256, 256); world->AddHook(HOOKID_UPDATE, UpdateHook, world); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); #ifdef STEAM_API_H Steamworks::Update(); #endif window->SetText("Instances: " + String(world->renderstats.instances) + " MEM: " + String(PrintMemoryInfo() / 1024) + " kb"); } #ifdef STEAM_API_H Steamworks::Shutdown(); #endif return 0; } You can observe the following: The memory rises a lot without going down. After some seconds, normally when the memory is above 300000kb the app spams Error: Invalid value While the memory has not so much impact, the Invalid value error leads to flickering (not so much in this sample, but in the original source i use the instances gets rendered totally random) and wrong rendering of the instances.
  21. @Josh I'd like to revise this suggestion to be able to use GetPath() to get the APP_DATA_ROAMING path. Looking at Steams cloud save system there is no option to have it navigate to the programdata path. These are the available paths for cloud saving. I would rather use the AppData path than the documents path. Also might be an idea to have get the paths on Mac & Linux - when the time comes.
  22. When using the vegetation system with large terrains it happens very fast that this error occurs: I can reproduce this with these simple steps: Create a terrain with at least 4096 * 4096 Add a foliage layer (u can use the crate.gltf) Fill the terrain with that layer (this should work) Set the density to 1.0 The editor works some time then the error message will appear It looks like a system memory problem, not a gpu problem. From time to time i get this error as well, when using eg: to many probes but with the vegetation system it is the safest way to reproduce it.
  23. currently i can only use 2D textures as a rendertarget as there is no way to specify the current layer. It would be nice to have the ability to directly render to a specific cubeface or 3d layer.
  1. Load more activity
×
×
  • Create New...