klepto2 Posted October 31, 2022 Share Posted October 31, 2022 Reworked Volumetric Lighting: #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { auto plg = LoadPlugin("Plugins/KTX2TextureLoader"); auto plg2 = LoadPlugin("Plugins/FITextureLoader"); //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); //Create a world auto world = CreateWorld(); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Create a camera auto camera = CreateCamera(world); camera->SetClearColor(0.125); camera->SetRotation(45, 0, 0); camera->SetFOV(70); camera->AddPostEffect(LoadPostEffect("Shaders/PostEffects/SSR.json")); camera->AddPostEffect(LoadPostEffect("Shaders/PostEffects/FXAA.json")); camera->AddPostEffect(LoadPostEffect("Shaders/PostEffects/SSAO.json")); camera->AddPostEffect(LoadPostEffect("Shaders/PostEffects/Bloom.json")); camera->AddPostEffect(LoadPostEffect("Shaders/PostEffects/VolumetricLighting.json")); world->SetEnvironmentMap(LoadTexture("Materials/Environment/Storm/Diffuse.dds"), ENVIRONMENTMAP_DIFFUSE); world->SetEnvironmentMap(LoadTexture("Materials/Environment/Storm/Specular.dds"), ENVIRONMENTMAP_SPECULAR); world->SetEnvironmentMap(LoadTexture("Materials/Environment/Storm/Specular.dds"), ENVIRONMENTMAP_BACKGROUND); world->SetAmbientLight(0.0); auto sponza = LoadModel(world, "https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/Sponza/glTF/Sponza.gltf"); camera->Move(sponza->GetBounds(BOUNDS_RECURSIVE).center); auto pointlight = CreatePointLight(world); pointlight->SetPosition(sponza->GetBounds(BOUNDS_RECURSIVE).center); pointlight->SetColor(0.0,2.0,0.0,10.0); pointlight->SetRange(0.1, 25.0); pointlight->SetShadowMapSize(1024); auto spotlight = CreateSpotLight(world); spotlight->SetPosition(sponza->GetBounds(BOUNDS_RECURSIVE).center + Vec3(0.0,2.0,0.0)); spotlight->SetColor(2.0, 0.0, 0.0, 100.0); spotlight->SetRange(0.1, 25.0); spotlight->SetShadowMapSize(1024); auto light = CreateDirectionalLight(world); light->SetRotation(45, -45, 0); light->SetColor(1.0,1.0,1.0,5.0); light->SetShadowMapSize(2048); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { auto center = sponza->GetBounds(BOUNDS_RECURSIVE).center + Vec3(0.0, sin(world->GetTime() * 0.0005) * (sponza->GetBounds(BOUNDS_RECURSIVE).size.height * 0.25), 0.0); pointlight->SetPosition(center); spotlight->Turn(0.0, 1.0, 0.0); camera->UpdateControls(window); world->Update(); world->Render(framebuffer); } return 0; } The Volumetric Strength can be controlled with the alpha value of the lightcolor. You can experiment as well by changeing the #define G_SCATTERING 0.25 in VolumetricLighting.frag. Higher Values will make the Volumetric effect more localized, lower values will make it more uniform. Maybe when the SetVolumetricStrength is passed to the LightInfo, this can be used for the strength and G_SCATTERING can be provided with the alpha value. Volumetric_Lighting.zip Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
Josh Posted October 31, 2022 Author Share Posted October 31, 2022 It looks like you are stepping through the cells and only calculating lighting when a light volume is encountered? I was thinking about an approach like this, I bet it is far more efficient and allow much better resolution of the effect. 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...
klepto2 Posted October 31, 2022 Share Posted October 31, 2022 To be honest, I just corrected the shadow map lookups in the Lighting.glsl and replaced the Lighting lookup with the one from PBRLighting. Otherwise i just added some MieScattering and i actually reworked the raymarching you used to a fixed step to always get the full raymarching. Everything else should be more or less the same as your experiment. Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
Josh Posted October 31, 2022 Author Share Posted October 31, 2022 I'm picturing something where you get the closest cell, check if it contains any lights, then skip to the next cell, until a non-empty cell is detected. Instead of hundreds of little tests along the ray, here you would only do the high-resolution tests in the two cells that we know contain a light. Even then, we can do a line / sphere intersection to find where to stop and end the shadow tests. 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...
Vida Marcell Posted November 1, 2022 Share Posted November 1, 2022 Will the Ultra level editor panels resize? Link to comment Share on other sites More sharing options...
Josh Posted November 2, 2022 Author Share Posted November 2, 2022 17 hours ago, Vida Marcell said: Will the Ultra level editor panels resize? Which panels? 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 November 2, 2022 Author Share Posted November 2, 2022 I'm looking into Newton Dynamics 4 now. The performance improvements are really impressive and the API isn't much different from Newton 3. It's so fast it feels like GPU physics but it's still running on the CPU. The shot below shows 64,000 particles. 4 1 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...
reepblue Posted November 2, 2022 Share Posted November 2, 2022 Hopefully it's more accurate with smaller objects. 2 Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Josh Posted November 3, 2022 Author Share Posted November 3, 2022 I don't know any details about collision in the new version, but if there are any issues it makes sense to be on the branch that is actively being developed. 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...
Yue Posted November 3, 2022 Share Posted November 3, 2022 Wishing that the ragdoll physics can be implemented smoothl Link to comment Share on other sites More sharing options...
Josh Posted November 3, 2022 Author Share Posted November 3, 2022 It's very fast: 5 1 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...
klepto2 Posted November 7, 2022 Share Posted November 7, 2022 A small Feature-request: Currently there are 2 available Hooks in the rendering pipeline: HOOK_RENDER and HOOK_TRANSFER I can think of at least 2 more additional hooks which might be useful: HOOK_XXXX_BEGIN and HOOK_END. This might be used to create performance queries. Additional but not so important would be to have Hooks which are called when textures are created or the rendering thread is initialized (when the device, etc is available) this would help to integrate 3rd party libraries much easier. Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
klepto2 Posted November 8, 2022 Share Posted November 8, 2022 Another small feature Request: Currently you can config the Validation_Layers the Vulkan layer uses through the json file. How about the same for enabled features? Background: For some things like collecting rendering stats additional features are required, which needs to be enabled on creation time of the Device. eg: pipelineStatisticsQuery Also it would be nice to have these Settings available from code: So you could add and remove features in code before starting the actual rendering. Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
Josh Posted November 9, 2022 Author Share Posted November 9, 2022 Okay, I am updating the player controller physics to use Newton 4 now. Everything else went pretty smoothly... 4 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 November 12, 2022 Author Share Posted November 12, 2022 Alright, I got pretty far but I think it's better to release Ultra Engine with Newton 3, which is very reliable, and then gradually introduce Newton 4 as an option when the world is created. The new version is very impressive but I think it will take time to implement properly, and I don't think it's worth delaying the engine's release. So that is what I will do now. 4 1 1 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 November 14, 2022 Author Share Posted November 14, 2022 Player physics: 5 1 1 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...
reepblue Posted November 14, 2022 Share Posted November 14, 2022 One thing I'd like to see improved is player velocity. I did a lot of hacks to get wall pushing to work correctly in Cyclone and it would be a blessing it it just worked with the set velocity command. Also, if crouching works without an additional raycast, that'll be a step up. 2 Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Josh Posted November 14, 2022 Author Share Posted November 14, 2022 15 minutes ago, reepblue said: One thing I'd like to see improved is player velocity. I did a lot of hacks to get wall pushing to work correctly in Cyclone and it would be a blessing it it just worked with the set velocity command. Also, if crouching works without an additional raycast, that'll be a step up. What is wall pushing? How would crouching work without an additional raycast? It uses a collision test to test if the player can stand up. 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 November 15, 2022 Author Share Posted November 15, 2022 I think I know what you mean. When you collide with a wall, the wall pushes you away from it, so the player tends to slow down when sliding against a wall. A "sliding" response would redirect the player's velocity along the collided surface so you maintain the same velocity. I will try some things... 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 November 15, 2022 Author Share Posted November 15, 2022 Okay, this seems to work well: 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...
reepblue Posted November 15, 2022 Share Posted November 15, 2022 15 hours ago, Josh said: What is wall pushing? How would crouching work without an additional raycast? It uses a collision test to test if the player can stand up. Actually, I ment when you try to add velocity directly to the player. If you do something like entity->SetVelocity(0,100,100), the controller will shoot up in that vector, and then drop straight down. I expected the player to make a graceful arch and it took manipulating SetInput, and other checks for me to get the behavior I want when it's defacto behavior in other engines. With crouching, I was asking if we needed to do the raycast on our end or that's now automatic. My player has crouching working perfectly although it's never really used. Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Josh Posted November 15, 2022 Author Share Posted November 15, 2022 Entity::AddForce() and SetVelocity() should both work as expected in Ultra on player physics. For crouching, there is a Entity::GetPlayerCrouched() method you can use to detect the current state. You should use this to adjust the camera height if you use crouching at all. Nothing will ever stop you from crouching, but you may be stopped from standing back up if an object is in the way. 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...
reepblue Posted November 15, 2022 Share Posted November 15, 2022 2 hours ago, Josh said: Entity::AddForce() and SetVelocity() should both work as expected in Ultra on player physics. I guess I'll try it when you release a new build. 2 hours ago, Josh said: For crouching, there is a Entity::GetPlayerCrouched() method you can use to detect the current state. You should use this to adjust the camera height if you use crouching at all. Nothing will ever stop you from crouching, but you may be stopped from standing back up if an object is in the way. Yeah, I expect curving the camera's position to still be on us but hopefully the prevention of the character controller standing up inside a wall is now something we don't need to worry about. I'm just asking if crouch support is more complete than the Leadwerks implementation. 🙂 Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Josh Posted November 15, 2022 Author Share Posted November 15, 2022 Here is an example. Update is coming soon: https://www.ultraengine.com/learn/Entity_GetCrouched 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 November 15, 2022 Author Share Posted November 15, 2022 Update is available now: Some rendering code was moved into the culling thread, making the rendering thread faster, so higher FPS under extreme stress tests Physics joints finished Lots of cool stuff with the player physics including crouching (see example above) Some adjustments to SSAO and bloom posteffects 1 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