Jump to content

SpiderPig

Members
  • Posts

    2,411
  • Joined

  • Last visited

Posts posted by SpiderPig

  1. Okay I may have drastically underestimated the distance based on forgetting how fast I actually made my camera move!  You will see some wiggling at 10,000 and the pixilation at 100,000.  This is the point where it needs double precision yes?

     camera->SetPosition(100000, 0, 0);

     

    Also confirming the shader reload has been fixed. ^_^

  2. I think what I might do here is keep trees as an instance.  But for small plants and shrubs which might cluster in large quantities is build a mesh grid of them, say 16x16 meshes joined togeather in a single mesh and then instance that throughout a single volume.  Then the vertex or geometry shaders can hide / show, rotate and move certain parts of the mesh around based on a data found in a texture stretched across a single volume.  I image the geometry shader not being to bad if its not pushing out extra vertices.  Might tackle this in the new year - after the voxel terrain.

  3. With the client app can you make it so we can change the install path?  I also wonder if it's possible to add the current download size and transfer rate?  Just because it's cool.  ^_^

    With the benchmarks - how did you get ultra to print the max fps?  All I can get is 60 regardless of the frequency I set in world->Update().

    There's also an issue with updating the text on a label.  every time it changes it reloads a shader which causes a bit of a slow down.  Both issues are in the example.

    ConsoleReloadingShader.thumb.png.f8295f11b24c3485eeaf1c07978c7d03.png

    #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();
        world->RecordStats();
    
        auto framebuffer = CreateFramebuffer(window);
    
        auto camera = CreateCamera(world);
        camera->SetClearColor(0.125);
        camera->SetFov(70);
        camera->SetPosition(0, 2, -3);
    
        auto font = LoadFont("Fonts/arial.ttf");
        auto ui = CreateInterface(world, font, framebuffer->size);
        ui->SetRenderLayers(RENDERLAYER_1);
        ui->root->SetColor(0, 0, 0, 0);
    
        auto fps = CreateLabel("FPS : 0", 10, 10, 150, 30, ui->root);
        auto i_change_a_lot = CreateLabel("", 10, 25, 150, 30, ui->root);
    
        auto ui_cam = CreateCamera(world, PROJECTION_ORTHOGRAPHIC);
        ui_cam->SetPosition(framebuffer->size.x / 2, framebuffer->size.y / 2, 0);
        ui_cam->SetRenderLayers(RENDERLAYER_1);
        ui_cam->SetClearMode(CLEAR_DEPTH);
    
        auto light = CreateDirectionalLight(world);
        light->SetRotation(35, 45, 0);
        light->SetRange(-10, 10);
    
        auto floor = CreateBox(world, 1000.0f, 0.1f, 1000.0f);
    
    
    
        int i = 0;
        while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false)
        {
            fps->SetText("FPS : " + String(world->renderstats.framerate));
            i_change_a_lot->SetText(String(i));
            i++;
    
            world->Update(120);
            world->Render(framebuffer);
        }
        return 0;
    }

     

  4. 2 hours ago, Josh said:

    3.  There is a feature partially implemented that would perform a raycast on the physics collider instead of the visual geometry. It's not accessible so I should fix the docs.

    I would like to choose between the two if possible.

    2 hours ago, Josh said:

    It would be possible for me to add a callback function to handle the filtering yourself. That might be a better approach for Ultra. It would be something like this:

    bool PickFilter(shared_ptr<Entity> entity, shared_ptr<Object> extra)
    {
       //This makes it so only a terrain can be picked
       if (entity->As<Terrain>()) return true; else return false;
    }

    I think this is a good idea.

  5. Not sure if I fully understand this or something is amiss.

    Is World::Pick() using the collision system?  If so an object with a null collider still gets picked.

    Is the collisiontype argument to pick only objects exclusively with that type or is this type omitted from the pick?

    There is a usecollider argument in the docs but it's not there to use.

    The use of collisiontype gives me mixed results, I've commented in the code what it does.

     

    #include "UltraEngine.h"
    #include "ComponentSystem.h"
    
    using namespace UltraEngine;
    
    int main(int argc, const char* argv[])
    {
        //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->SetFov(70);
        camera->SetPosition(0, 1, -3);
    
        //Create a light
        auto light = CreateDirectionalLight(world);
        light->SetRotation(35, 45, 0);
    
        auto floor = CreateBox(world, 100.0f, 0.1f, 100.0f);
        floor->SetCollisionType(COLLISION_SCENE);
    
        //Create a box
        auto box = CreateBox(world);
        box->SetCollisionType(COLLISION_PROP);
        box->SetColor(0,0,1);
    
        auto box2 = CreateBox(world, 0.25f);
        box2->SetCollider(nullptr);//Setting just this dosnt stop detection
        box2->SetCollisionType(-1);//This will
        box2->SetPosition(0, 2, 0);
    
        auto sphere = CreateSphere(world, 0.1f);
        sphere->SetCollider(nullptr);
        sphere->SetCollisionType(-1);
        sphere->SetColor(1, 0, 0);
    
        //Main loop
        auto stage = 0;
        while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false)
        {
            auto box_pos = box2->GetPosition(true);
            switch (stage) {
            case 0:
                if (box_pos.x > -2 && stage == 0) { box2->Move(-.01, 0, 0); }
                else { stage = 1; }
                break;
            case 1:
                if (box_pos.x < 2 && stage == 1) { box2->Move(.01, 0, 0); }
                else { stage = 0; }
                break;
            }
    
            Vec3 start_pos = box2->GetPosition(true);
            Vec3 end_pos = start_pos - Vec3(0.0f, 10.0f, 0.0f);
    
            auto pick_info = world->Pick(start_pos, end_pos, 0.0f, true, COLLISION_PROP);//Detects both floor and box - should only be box?
           // auto pick_info = world->Pick(start_pos, end_pos, 0.0f, true, COLLISION_SCENE);//Detects only box - should only be floor?
            if (pick_info.success) {
                sphere->SetPosition(pick_info.position);
            }
            sphere->SetHidden(!pick_info.success);
    
            world->Update();
            world->Render(framebuffer);
        }
        return 0;
    }

     

  6. 7 hours ago, Josh said:

    Whoa, that is really slow. Is this in debug mode?

    Yeah it is.  Release is much faster but still noticable if the camera moves fast.  I can put an example togeather with that pine tree I sent you if you like.

  7. 19 minutes ago, Josh said:

    Instancing will be very fast and culling will not slow down the renderer at all. One of the benchmark tests shows 64,000 instanced objects. Ultra might not need any special vegetation techniques at all because it already is so fast. For very large scale stuff I have some ideas in mind, but we are talking tens of millions of objects.

    Wow, okay.  That's awesome.  I'll give that article a browse I didn't know it had to sync with the CPU.  Does this mean Ultra won't support Geometry shaders at all because of this?

    Right now I'm seeing a considerably delay in the entities popping into the cameras view.  The more objects there are the longer it takes.  I should count how many objects I have on screen but it's not 64,000.  This is debug mode however.  Haven't tested release yet.

  8. Hey guys, I'm working on a procedural foliage volume and am now wondering on the best approach on rendering lots of foliage.  Many of you probably have a better idea than me.

    • Instancing (what I'm using at the moment)
      • Easy to implement but is slow considering the amount of entities that will need culling.  Ultra is faster than Leadwerks but I'd prefer not to push it with heaps of foliage.
    • Geometry Shader
      • Limited amount of vertices per input triangle can be output but perhaps the best option.  Pass in a texture with a position for each instance and duplicate each face in the shader.  I've done this before for grass.
    • Compute shader
      • Not sure how these work - can they run once to generate a large mesh and leave it in GPU memory without further transfer with the CPU?  Or do they run every frame like a geometry shader?
    • Something else? <_<

    ProceduralFoliage.thumb.png.c93bbb9ce8e226df612259c976fc84b6.png

  9. Have a small issue with my tree after setting the environment maps...

     

    TreeIssue.thumb.png.c21ad91ac06272d36c9446ccab793696.png

     

    #include "UltraEngine.h"
    #include "ComponentSystem.h"
    
    using namespace UltraEngine;
    
    int main(int argc, const char* argv[])
    {
        //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();
        world->RecordStats();
    
        //Create a framebuffer
        auto framebuffer = CreateFramebuffer(window);
    
        //Create a camera
        auto camera = CreateCamera(world);
        camera->SetClearColor(0.125);
        camera->SetFov(70);
        camera->SetPosition(0, 2, -3);
    
        auto font = LoadFont("Fonts/arial.ttf");
        auto ui = CreateInterface(world, font, framebuffer->size);
        ui->SetRenderLayers(RENDERLAYER_1);
        ui->root->SetColor(0, 0, 0, 0);
    
        auto fps = CreateLabel("FPS : 0", 10, 10, 150, 30, ui->root);
    
        auto ui_cam = CreateCamera(world, PROJECTION_ORTHOGRAPHIC);
        ui_cam->SetPosition(framebuffer->size.x / 2, framebuffer->size.y / 2, 0);
        ui_cam->SetRenderLayers(RENDERLAYER_1);
        ui_cam->SetClearMode(CLEAR_DEPTH);
    
        auto d = LoadTexture("Materials\\Environment\\Storm\\diffuse.dds");
        auto s= LoadTexture("Materials\\Environment\\Storm\\specular.dds");
        world->SetEnvironmentMap(s, ENVIRONMENTMAP_BACKGROUND);
        world->SetEnvironmentMap(s, ENVIRONMENTMAP_SPECULAR);
        world->SetEnvironmentMap(d, ENVIRONMENTMAP_DIFFUSE);
    
        auto light = CreateDirectionalLight(world);
        light->SetRotation(35, 45, 0);
        light->SetRange(-10, 10);
    
        //Create a box
        auto box = CreateBox(world, 1000.0f, 0.1f, 1000.0f);
    
        auto tree = LoadModel(world, "Foliage\\PineLarge_001.gltf");
    
        Vec3 mousepos;
        float lookspeed = 0.1f;
        float looksmoothing = 0.5f;
    
        //Main loop
        while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false)
        {
            auto _displaySize = window->GetSize();
            float cx = Round((float)_displaySize.x / 2.0f);
            float cy = Round((float)_displaySize.y / 2.0f);
    
            auto mouse_position = Vec3(window->GetMousePosition().x, window->GetMousePosition().y, window->GetMousePosition().z);
            window->SetMousePosition(cx, cy);
            mouse_position = mouse_position * looksmoothing + mousepos * (1 - looksmoothing);
            auto dx = (mouse_position.x - cx) * lookspeed;
            auto dy = (mouse_position.y - cy) * lookspeed;
    
            auto camrot = camera->GetRotation();
            camrot.x += dy;
            camrot.y += dx;
            camera->SetRotation(camrot);
            mousepos = mouse_position;
    
            if (window->KeyDown(KEY_W)) { camera->Move(0.0f, 0.0f, 1.0f); }
            if (window->KeyDown(KEY_S)) { camera->Move(0.0f, 0.0f, -1.0f); }
            if (window->KeyDown(KEY_A)) { camera->Move(-1.0f, 0.0f, 0.0f); }
            if (window->KeyDown(KEY_D)) { camera->Move(1.0f, 0.0f, 0.0f); }
    
            fps->SetText("FPS : " + String(world->renderstats.framerate));
    
            world->Update();
            world->Render(framebuffer);
        }
        return 0;
    }

     

    PineTree.zip

  10. Looking forward to the official release!

     

    I'm taking a look at the LOD system - it all works well - just wanted to ask if instead of having several GLTF files for each LOD stage and letting the application compile it into one model at run-time, can I export one GLTF file with the LOD's as different meshes?  If yes - will it still work if I have 2 meshes at each LOD?  Like a tree - one mesh for the trunk and another for the leaves?

×
×
  • Create New...