klepto2 Posted March 15 Share Posted March 15 This is a wierd one (at least it looks like a weird one) i have a simple scene with a terrain and a sphere. the sphere is set to a red color. In release: The result is always a white sphere but whith a correct looking terrain. In debug: sometimes the same result as in release, but sometimes the sphere gets its color (and can be changed at runtime) but then the terrain is pure black as long as the sphere is in view. #include "UltraEngine.h" #include "ComponentSystem.h" //#include "Steamworks/Steamworks.h" using namespace UltraEngine; 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); //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); camera->AddComponent<CameraControls>(); //Create light auto light = CreateDirectionalLight(world); light->SetRotation(45, 35, 0); light->SetColor(2); world->RecordStats(true); auto main_instance = CreateTerrain(world, 512, 512); auto sphere = CreateSphere(world, 2.0, 32); sphere->SetColor(1.0, 0.0, 0.0); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { if(window->KeyHit(KEY_F1)) sphere->SetColor(1.0, 0.0, 0.0); if (window->KeyHit(KEY_F2)) sphere->SetColor(0.0, 1.0, 0.0); world->Update(); world->Render(framebuffer); #ifdef STEAM_API_H Steamworks::Update(); #endif } #ifdef STEAM_API_H Steamworks::Shutdown(); #endif return 0; } Above is release (everytime) /debug(not everytime) ( color can't be changed with F1/F2) the same with debug build, sometimes the color works. (then the color can be changed with F1/F2) 1 Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
Josh Posted March 15 Share Posted March 15 This is a strange one. Has this every happened without the terrain present? Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Josh Posted March 15 Share Posted March 15 At this point I suspect a nasty memory overwrite in the terrain system. I am seeing behavior that does not otherwise make sense... Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Solution Josh Posted March 15 Solution Share Posted March 15 I found the cause. In the visibility list, meshes are grouped by pipeline settings. This is all the different rendering settings, plus the shader in use. The pipeline settings has a < operator for sorting. This is how the grouping is done. I added a setting in the shader family to force bindless textures off, but did not add any sorting for this in the < operator in the pipeline settings class. As a result, your sphere was probably getting rendered using the terrain shader. Once I added the needed fix the problem went away. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.