Jump to content

Slastraf

Developers
  • Posts

    705
  • Joined

  • Last visited

Posts posted by Slastraf

  1. #version 450
    #extension GL_GOOGLE_include_directive : enable
    #extension GL_ARB_separate_shader_objects : enable
    //#extension GL_EXT_shader_realtime_clock : enable // NOT ALLOWED
    #include "../Base/Fragment.glsl"
    #include "../Base/UniformBlocks.glsl"
    #define PI 3.14159
    
    
    float vDrop(vec2 uv,float t)
    {
        uv.x = uv.x*128.0;						// H-Count
        float dx = fract(uv.x);
        uv.x = floor(uv.x);
        uv.y *= 0.05;							// stretch
        float o=sin(uv.x*215.4);				// offset
        float s=cos(uv.x*33.1)*.3 +.7;			// speed
        float trail = mix(95.0,35.0,s);			// trail length
        float yv = fract(uv.y + t*s + o) * trail;
        yv = 1.0/yv;
        yv = smoothstep(0.0,1.0,yv*yv);
        yv = sin(yv*PI)*(s*5.0);
        float d2 = sin(dx*PI);
        return yv*(d2*d2);
    }
    
    
    void main()
    {
        //vec2 p = (vertexWorldPosition.xz - 0.5 * (vertexWorldPosition.xz+500.0)) / (vertexWorldPosition.xz-250.0);
    vec2 p = (vertexWorldPosition.xz);
    float d = length(p)+0.1;
    	p = vec2(atan(p.x, p.y) / PI, 2.5 / d);
        float t =  CurrentTime*0.004;
        vec3 col = vec3(1.55,0.65,.225) * vDrop(p,t);	// red
        col += vec3(0.55,0.75,1.225) * vDrop(p,t+0.33);	// blue
        col += vec3(0.45,1.15,0.425) * vDrop(p,t+0.66);	// green
        outColor[0] = vec4(col*(d*d), 1.0);
    
    
        //Material material = materials[materialID];
        //outColor[0] = material.diffuseColor * color;
        //int textureID = GetMaterialTextureHandle(material, TEXTURE_DIFFUSE);    
        //if (textureID != -1) outColor[0] *= texture(texture2DSampler[textureID], texcoords.xy);
    
        //Camera distance fog
        //if ((entityflags & ENTITYFLAGS_NOFOG) == 0) ApplyDistanceFog(outColor[0].rgb, vertexWorldPosition.xyz, CameraPosition);
        
        //if ((RenderFlags & RENDERFLAGS_TRANSPARENCY) != 0)
        //{
        //    outColor[0].rgb *= outColor[0].a;
        //    //outColor[0].a = 1.0f;
        //} 
    }

    Hyperdrive shader based on Drop Tunnel by Del

    image.thumb.png.3d98244289f00558a2afc30955bba1ca.png

    • Like 2
  2. Hi, I try to program a shader but for my use case I need a time value.
    For this I tried to use the extension
     

    #extension GL_EXT_shader_realtime_clock : enable // NOT ALLOWED

    which is not allowed in the current setup.
    image.thumb.png.225cbe6f8cf1184667c9f102d5af61bc.png
    I dont know much about Vulcan or shaders, but could this be shipped with the next update ? That would make things a lot easier as I also try to make an animated (sprite) material which is not possible without a time value.

    On the other hand , i tried passing it trough c++ directly using a uniform variable

    uniform float u_Time;

    which would lead to the following error.

     'non-opaque uniforms outside a block' : not allowed when using GLSL for Vulkan

    Looking forward for a solution, as I said I am not experienced in shaders so maybe there already is.
     

  3. Hello.
    I tried the tool using the GUI and through command prompt. In the GUI it will crash and using the command prompt it will be stuck at Importing Cubemap.
    image.thumb.png.aba47f206e3f1a4beba210980f63423d.png
     

    The gui will load, but crash on importing either panorama or other import option, or canceling the import.

    I used this cubemap at 1k resolution (.hdr) https://polyhaven.com/a/symmetrical_garden_02
    Windows 11 updated graphics drivers rtx 4090

     

  4. Hi, I want to have a 100% black background. When I set the ambient light to (0,0,0) it will still be a dark grey. I tried to import cubemap from https://docs.unrealengine.com/4.26/en-US/RenderingAndGraphics/Textures/Cubemaps/CreatingCubemaps/
    Uffizi_Cubemapped.thumb.jpg.aa69cfadcda46150aa20cbb0b369c866.jpg

     

    However Ultra Engine will not import these


    image.png.65837d0639f01a13b94b2aa64b1f5628.png

    I tried a .exr cubemap from https://polyhaven.com/hdris with the same issue. These could be easily edited in gimp to be just a black image.
    How would I make an al black environment ?

  5. //radians to degrees
    rot.x = UltraEngine::Degrees(rot.x);
    rot.y = UltraEngine::Degrees(rot.y);
    rot.z = UltraEngine::Degrees(rot.z);
    
    // prevent gimbal lock
    this->model->SetRotation(0, 0, 0);
    this->model->Turn(rot.x, 0.0, 0.0);
    this->model->Turn(0.0, rot.y, 0.0);
    this->model->Turn(0.0, 0.0, rot.z);

    this is example code to prevent gimbal lock. i do no longer use quaternions. but from radians eulers converted instead.

    • Like 1
  6. Update Ultra
    The engine uses a left-handed coordinate system. The X axis points to the right, the Y axis points up, and the Z axis points forward.
                this->client->SetAxisMapping(
                    ViconDataStreamSDK::CPP::Direction::Right,
                    ViconDataStreamSDK::CPP::Direction::Up,            // Y-up
                    ViconDataStreamSDK::CPP::Direction::Forward
                );

    the rotation axis are still wrong.
    I have a reference live view inside vicon tracker, and the rotations are very different

  7. I need more data on how the Ultra Engine works.
    I had great success combining the Vicon SDK headers, dlls ...,  inside Ultra Engine.
    It is used to track real life objects into virtual space.
    The tracking translation works fine, however I have great issues adjusting the details.

    The Vicon SDK Documentation says this about their conventions

    Units
    "Positions are expressed in millimeters. Rotation is expressed in radians."

    When I convert from radians to degrees to be applicable inside Ultra Engine, there are various issues, such as the object flipping at certain angles etc. I convert by multiplying each vector component by (180 / 3.14)
    Instead of Euler XYZ there are also functions to get the Quat , x y z w  . This had no flipping issues but the axis are not aligned.

    "The quaternion is of the form (x, y, z, w) where w is the real component and x, y and z are the imaginary
    components. N.B. This is different from that used in many other applications, which use (w, x, y, z)."
    Ultra Engine uses x,y,z,w as i remember from the documentation. However the axis are still flipped.

    I made a video to show how the tracking currently works:
    https://ody.sh/b85p8I5GK8 (odysee)

    SetAxisMapping() :
    Vicon Data uses a right-handed coordinate system, with +X forward, +Y left, and +Z up


    I am at a loss at how to properly implement this.

  8. Makes no sense that you need to left click and drag to spawn a light/effect/misc item. It used to be left click marker then enter in leadwerks which i thought was better.

     

    • Upvote 2
  9. Unreal Engine VR Template scene + Ndisplay plugin endless headache and set up. Hovering at 10-20 fps (!). I did not bother to build it. In Unreal Engine you can use dynamic resolution and ai upscaling so we got about 20 fps and 30 with weird artifacts in the image.

    I need 2 x  3840 by 2400 , so  a resolution of 7680  * 4800 for a specific stereo 3d beamer, for each eye.

    Unity is what we use here usually but the graphics need to be tuned down for it to work smoothly aswell, and it needs extra plugins.

    I programmed the 3d stereo vision not using two windows but one that renders each eye on the half of the screen using texturebuffer. (no plugin, and im not good at c++ but the documentation had examples that need to be adjusted to my case and that was it.)
    The performance did not drop even at high resolution, and today I tried it out on the beamer.

    The good thing is, Ultra Enginne builds in seconds so developing is very fast when you need to change pixel perfect values.

     

    • Like 2
    • Haha 1
  10. Here an example for stereo vision 3d or 2d VR example:
    You need the UI.zip models
     

    #include "UltraEngine.h"
    #include "Components/Player/CameraControls.hpp"
    
    using namespace UltraEngine;
    
    
    int main(int argc, const char* argv[])
    {
        //Get the displays
        auto displays = GetDisplays();
    
        //Create a window
        auto windowSize = Vec2(1920, 640);
        auto window = CreateWindow("Ultra Engine", 0, 0, windowSize.x, windowSize.y, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR);
    
        //Create a world
        auto world = CreateWorld();
    
        //Create a framebuffer
        auto framebuffer = CreateFramebuffer(window);
    
        //Create light
        auto light = CreateDirectionalLight(world);
        light->SetRenderLayers(2);
        light->SetRange(-10, 10);
        light->SetRotation(0, 0, 90);
        light->SetColor(100);
    
        auto light2 = CreateDirectionalLight(world);
        light->SetRotation(15, 15, 0);
        light->SetColor(5);
    
        //Create camera
        auto camera = CreateCamera(world);
        camera->SetRenderLayers(2);
        camera->SetClearColor(0.125);
        camera->SetPosition(0,0,-60);
        //camera->AddComponent<CameraControls>();
        camera->SetFov(2);
    
        //Create scenery
        auto test = LoadModel(world, "Models/UI/test.glb");
        
        auto scale = Vec3(.1, .1, .1);
    
        auto planeLeft = LoadModel(world, "Models/UI/LeftHalf.glb");
        planeLeft->SetRenderLayers(2);
        //planeLeft->SetPosition(0, 0, 0);
        //planeLeft->SetRotation(0, 0, 0);
        //b2->SetColor(0, 0, 1);
        planeLeft->SetScale(scale);
    
        auto planeRight = LoadModel(world, "Models/UI/RightHalf.glb");
        planeRight->SetRenderLayers(2);
        //planeRight->SetPosition(0, 0, 0);
        //planeRight->SetRotation(0, 0, 0);
        //b1->SetColor(1, 0, 0);
        planeRight->SetScale(scale);
    
        //Create camera and texture buffer
        auto texBufferLeft = CreateTextureBuffer(windowSize.x * 0.5, windowSize.y);
        auto texBufferRight = CreateTextureBuffer(windowSize.x * 0.5, windowSize.y);
        
        auto player = CreatePivot(world);
        player->AddComponent<CameraControls>();
    
        auto eyeDistance = .5;
    
        auto gameCameraLeftEye = CreateCamera(world);
        gameCameraLeftEye->SetClearColor(1, 1, 1);
        gameCameraLeftEye->SetRenderTarget(texBufferLeft);
        gameCameraLeftEye->SetPosition(-eyeDistance * 0.5, 0, 0);
    
        auto gameCameraRightEye = CreateCamera(world);
        gameCameraRightEye->SetClearColor(1, 1, 1);
        gameCameraRightEye->SetRenderTarget(texBufferRight);
        gameCameraRightEye->SetPosition(eyeDistance * 0.5, 0, 0);
        
        gameCameraLeftEye->SetParent(player);
        gameCameraRightEye->SetParent(player);
    
        player->SetPosition(0, 0, -5);
        //cam2->AddComponent<CameraControls>();
    
        //Create material
        auto mtll = CreateMaterial();
        auto mtlr = CreateMaterial();
        auto texl = texBufferLeft->GetColorAttachment();
        auto texr = texBufferRight->GetColorAttachment();
        mtll->SetTexture(texl);
        mtlr->SetTexture(texr);
        planeRight->SetMaterial(mtlr);
        planeLeft->SetMaterial(mtll);
    
        auto calibratedToResolution = false;
      	// at some settings or resolution, taking windowSize will not always work, so using projection of the center
        Vec3 pickPos = camera->Project(planeLeft->GetPosition(),framebuffer);
        // calibrate the canvas plane halfs to the screen size
        if (!calibratedToResolution)
        {
            auto steps = 0.001;
            // pick a pixel until the plane is adjusted to x and y
            while (!camera->Pick(framebuffer, 0, pickPos.y).success)
            {
                scale += Vec3(steps, 0, 0);
                planeLeft->SetScale(scale);
            }
            while (!camera->Pick(framebuffer, pickPos.x, 0).success)
            {
                scale += Vec3(0, steps, 0);
                planeLeft->SetScale(scale);
            }
            planeRight->SetScale(scale);
            calibratedToResolution = true;
        }
    
    	// NEVER SPAWN MODELS BEFORE THIS POINT
    
        while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false)
        {
            //Orient the texturebuffer camera
            test->Turn(0, 1, 0);
    
            world->Update();
            world->Render(framebuffer);
        }
        return 0;
    }

     

    UI.zip

  11. Hello
    I would like to know how to render only half the screen or a specified area for a camera.
    Alternatively, render a camera to a texture and have a plane with that texture perfectly placed in front of the main camera.

    This could be used for stereo vision or for split screen / minimap etc

  12. It works now. <<<headache>>> There was another significant warning I overlooked.
    LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs

    It was a misconfiguration of Visual Studio Installer.

    This was because I had a different MSVC than 14.38, at the same time. Yours was up to date but for my machine the old one was used even when i had all the updates.
     

    14 hours ago, Josh said:

    In the path you posted above, I see a folder called "14.38.33130".

    To fix this you need to go to visual studio installer again , search for individual components, search for "msvc" and make sure only boxes where it says (latest) are picked. Also make sure to go to C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC and delete old versions.

    Also needed to reinstall the engine a bunch of times and set up new project because i had even more errors and warnings throughout this.

    More information that helped  (ai generated)

    Open your project in Visual Studio.

    In the Solution Explorer pane on the right side of the screen, right-click on your project name and select "Properties" from the context menu. This will open the Properties window for your project.

    In the Properties window, expand the "Configuration Properties" node and select "C/C++".

    In the "C/C++" node, select "Code Generation".

    In the "Code Generation" node, you will see an option called "Runtime Library". This option determines which version of the C runtime library your project uses.

    Check the "Runtime Library" option to see which library your project is currently using. If you see multiple different options, this could be the cause of your issue.

    To fix this, you should set all your projects to use the same runtime library. If you have multiple projects in your solution, you will need to repeat these steps for each project.

    After setting the "Runtime Library" option for all your projects, try building your solution again. The warning should no longer appear.

     

    • Like 1
  13. I run this on VS 17.8.3 on Win10 . I will repair my installation once again because all the updates were already installed and try this again in a bit. I will also reinstall Ultra Engine stable.
     

    13 hours ago, Josh said:

    It sounds like perhaps the Ultra lib files did not download correct.ly?

    In the path you posted above, I see a folder called "14.38.33130".

    The very first time i installed Ultra Engine the UltraEngine.h header was not detected or missing. Must be a dwonload issue because i reinstalled it and then it was included.

×
×
  • Create New...