Announcement

Collapse
No announcement yet.

Seamless Portals

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #61
    How can I make this work with a CanvasRenderTarget2D?

    Comment


      #62
      Originally posted by ElMax View Post
      How can I make this work with a CanvasRenderTarget2D?
      Just feed the CanvasRenderTarget2D directly to the SceneCapture ("TextureTarget" variable). To create the CanvasRenderTarget2D at runtime use CreateCanvasRenderTarget2D().
      - [Marketplace] Sci-fi and Glitch Post-process
      - [Tutorial] Anamorphic Bloom
      - [Tutorial] True First Person Camera
      - [Tutorial] Realtime Distance Field textures
      - [Tutorial] Seamless Portals

      Twitter - Portfolio

      Comment


        #63
        Originally posted by Froyok View Post
        Just feed the CanvasRenderTarget2D directly to the SceneCapture ("TextureTarget" variable). To create the CanvasRenderTarget2D at runtime use CreateCanvasRenderTarget2D().
        But how do i replace the missing functions like GetTexture(), SetFilterMode(), AttachToComponent() and other stuff like Gamma, WrapModeX, WrapModeY, etc?

        Comment


          #64
          Originally posted by ElMax View Post
          But how do i replace the missing functions like GetTexture(), SetFilterMode(), AttachToComponent() and other stuff like Gamma, WrapModeX, WrapModeY, etc?
          You should take the time to understand how a SceneCapture and a RenderTarget work, because your questions here would be already answered. See for example: https://docs.unrealengine.com/en-US/...t2D/index.html
          - [Marketplace] Sci-fi and Glitch Post-process
          - [Tutorial] Anamorphic Bloom
          - [Tutorial] True First Person Camera
          - [Tutorial] Realtime Distance Field textures
          - [Tutorial] Seamless Portals

          Twitter - Portfolio

          Comment


            #65
            Would you consider releasing the portal mesh? I can grasp the concept but im no modeler.

            Also im getting an error in ExedrePortal.cpp in the TeleportActor function telling me that EC is an undefined pointer when the definition AExedreCharacter* EC is clearly defined. Im using Visual Studio 2019 if that means anything.

            When I try to implement the BlueprintNativeFunctions in the .Cpp file it tells me that the _Implememtation is not a defined function.

            Comment


              #66
              Originally posted by dirtydanisreal View Post
              Would you consider releasing the portal mesh? I can grasp the concept but im no modeler.
              I will see if I can add an little obj mesh to the article, but no guarantee on that.

              Originally posted by dirtydanisreal View Post
              Also im getting an error in ExedrePortal.cpp in the TeleportActor function telling me that EC is an undefined pointer when the definition AExedreCharacter* EC is clearly defined. Im using Visual Studio 2019 if that means anything.
              You don't provide enough information for me to help your here. Note that AExedreCharacter is my own Character class, you may want to replace it with yours.

              Originally posted by dirtydanisreal View Post
              When I try to implement the BlueprintNativeFunctions in the .Cpp file it tells me that the _Implememtation is not a defined function.
              You likely made a mistake in how you declare the function in the header. The "_Implemention" function is something the compiler will look for if you added the right tag in the UFUNCTION() macro. See this article for more details : https://www.tomlooman.com/ue4-ufunct...rds-explained/
              - [Marketplace] Sci-fi and Glitch Post-process
              - [Tutorial] Anamorphic Bloom
              - [Tutorial] True First Person Camera
              - [Tutorial] Realtime Distance Field textures
              - [Tutorial] Seamless Portals

              Twitter - Portfolio

              Comment


                #67
                so it crashes when i press play and here is the log i get



                Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x00000648

                UE4Editor_Exedre_0013!AExedreCharacter::TickActor() [D:\Unreal Projects\Exedre\Source\Exedre\ExedreCharacter.cpp:97]
                UE4Editor_Engine!FActorTickFunction::ExecuteTick() [D:\Github\UnrealEngine-RTX\Engine\Source\Runtime\Engine\Private\Actor.cpp:171]
                UE4Editor_Engine!FTickFunctionTask:oTask() [D:\Github\UnrealEngine-RTX\Engine\Source\Runtime\Engine\Private\TickTaskManager.cpp:283]
                UE4Editor_Engine!TGraphTask<FTickFunctionTask>::ExecuteTask() [D:\Github\UnrealEngine-RTX\Engine\Source\Runtime\Core\Public\Async\TaskGraphInterfaces.h:849]
                UE4Editor_Core!FNamedTaskThread::ProcessTasksNamedThread() [D:\Github\UnrealEngine-RTX\Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp:692]
                UE4Editor_Core!FNamedTaskThread::ProcessTasksUntilQuit() [D:\Github\UnrealEngine-RTX\Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp:587]
                UE4Editor_Core!FTaskGraphImplementation::WaitUntilTasksComplete() [D:\Github\UnrealEngine-RTX\Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp:1478]
                UE4Editor_Engine!FTickTaskSequencer::ReleaseTickGroup() [D:\Github\UnrealEngine-RTX\Engine\Source\Runtime\Engine\Private\TickTaskManager.cpp:558]
                UE4Editor_Engine!FTickTaskManager::RunTickGroup() [D:\Github\UnrealEngine-RTX\Engine\Source\Runtime\Engine\Private\TickTaskManager.cpp:1523]
                UE4Editor_Engine!UWorld::RunTickGroup() [D:\Github\UnrealEngine-RTX\Engine\Source\Runtime\Engine\Private\LevelTick.cpp:783]
                UE4Editor_Engine!UWorld::Tick() [D:\Github\UnrealEngine-RTX\Engine\Source\Runtime\Engine\Private\LevelTick.cpp:1558]
                UE4Editor_UnrealEd!UEditorEngine::Tick() [D:\Github\UnrealEngine-RTX\Engine\Source\Editor\UnrealEd\Private\EditorEngine.cpp:1693]
                UE4Editor_UnrealEd!UUnrealEdEngine::Tick() [D:\Github\UnrealEngine-RTX\Engine\Source\Editor\UnrealEd\Private\UnrealEdEngine.cpp:414]
                UE4Editor!FEngineLoop::Tick() [D:\Github\UnrealEngine-RTX\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:4850]
                UE4Editor!GuardedMain() [D:\Github\UnrealEngine-RTX\Engine\Source\Runtime\Launch\Private\Launch.cpp:169]
                UE4Editor!GuardedMainWrapper() [D:\Github\UnrealEngine-RTX\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:137]
                UE4Editor!WinMain() [D:\Github\UnrealEngine-RTX\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:268]
                UE4Editor!__scrt_common_main_seh() [d:\agent\_work\4\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
                kernel32
                ntdll

                the line of code is in the TickActor function and here is my tick actor function



                void AExedreCharacter::TickActor(float DeltaTime, ELevelTick TickType, FActorTickFunction& ThisTickFunction)
                {

                Super::TickActor(DeltaTime, TickType, ThisTickFunction);
                if( UGameplayStatics::GetPlayerController(GetWorld(), 0) != nullptr )
                {
                AExedrePlayerController* EController = Cast<AExedrePlayerController>( UGameplayStatics::GetPlayerController(GetWorld(), 0) );
                -> (THIS IS THE LINE) EController->PortalManager->Update( DeltaTime );
                }

                }

                EDIT:

                I changed EController to EPC which i have store in my character class as "class AExedrePlayerController* EPC;"

                So it is

                EPC = Cast<AExedrePlayerController>( UGameplayStatics::GetPlayerController(GetWorld(), 0) );
                EPC->PortalManager->Update( DeltaTime );

                then i get this crash log

                LoginId:7cad57a24f7b1ce912ff3298e4150829
                EpicAccountId:70d466d0e6ec4926a420f91025f5ee5d

                Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x00000140

                UE4Editor_Exedre_0014!AExedrePortalManager::UpdatePortalsInWorld() [D:\Unreal Projects\Exedre\Source\Exedre\ExedrePortalManager.cpp:171]
                UE4Editor_Exedre_0014!AExedrePortalManager::Update() [D:\Unreal Projects\Exedre\Source\Exedre\ExedrePortalManager.cpp:152]
                UE4Editor_Exedre_0014!AExedreCharacter::TickActor() [D:\Unreal Projects\Exedre\Source\Exedre\ExedreCharacter.cpp:97]
                UE4Editor_Engine!FActorTickFunction::ExecuteTick() [D:\Github\UnrealEngine-RTX\Engine\Source\Runtime\Engine\Private\Actor.cpp:171]
                UE4Editor_Engine!FTickFunctionTask:oTask() [D:\Github\UnrealEngine-RTX\Engine\Source\Runtime\Engine\Private\TickTaskManager.cpp:283]
                UE4Editor_Engine!TGraphTask<FTickFunctionTask>::ExecuteTask() [D:\Github\UnrealEngine-RTX\Engine\Source\Runtime\Core\Public\Async\TaskGraphInterfaces.h:849]
                UE4Editor_Core!FNamedTaskThread::ProcessTasksNamedThread() [D:\Github\UnrealEngine-RTX\Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp:692]
                UE4Editor_Core!FNamedTaskThread::ProcessTasksUntilQuit() [D:\Github\UnrealEngine-RTX\Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp:587]
                UE4Editor_Core!FTaskGraphImplementation::WaitUntilTasksComplete() [D:\Github\UnrealEngine-RTX\Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp:1478]
                UE4Editor_Engine!FTickTaskSequencer::ReleaseTickGroup() [D:\Github\UnrealEngine-RTX\Engine\Source\Runtime\Engine\Private\TickTaskManager.cpp:558]
                UE4Editor_Engine!FTickTaskManager::RunTickGroup() [D:\Github\UnrealEngine-RTX\Engine\Source\Runtime\Engine\Private\TickTaskManager.cpp:1523]
                UE4Editor_Engine!UWorld::RunTickGroup() [D:\Github\UnrealEngine-RTX\Engine\Source\Runtime\Engine\Private\LevelTick.cpp:783]
                UE4Editor_Engine!UWorld::Tick() [D:\Github\UnrealEngine-RTX\Engine\Source\Runtime\Engine\Private\LevelTick.cpp:1558]
                UE4Editor_UnrealEd!UEditorEngine::Tick() [D:\Github\UnrealEngine-RTX\Engine\Source\Editor\UnrealEd\Private\EditorEngine.cpp:1693]
                UE4Editor_UnrealEd!UUnrealEdEngine::Tick() [D:\Github\UnrealEngine-RTX\Engine\Source\Editor\UnrealEd\Private\UnrealEdEngine.cpp:414]
                UE4Editor!FEngineLoop::Tick() [D:\Github\UnrealEngine-RTX\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:4850]
                UE4Editor!GuardedMain() [D:\Github\UnrealEngine-RTX\Engine\Source\Runtime\Launch\Private\Launch.cpp:169]
                UE4Editor!GuardedMainWrapper() [D:\Github\UnrealEngine-RTX\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:137]
                UE4Editor!WinMain() [D:\Github\UnrealEngine-RTX\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:268]
                UE4Editor!__scrt_common_main_seh() [d:\agent\_work\4\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
                kernel32
                ntdll

                here is the line in updateportalsin world


                FVector PlayerLocation = Character->GetActorLocation();

                and update


                ---> if( Portal != nullptr )
                { UpdateCapture( Portal ); }

                and tickactor


                EPC->PortalManager->Update( DeltaTime );

                I think its possible having trouble getting the Character and PlayerController. What does your custom GetCharacter() and GetPlayerController() look like?
                Last edited by dirtydanisreal; 11-07-2020, 09:14 PM.

                Comment


                  #68
                  Learn how to debug code to solve your crash. You probably have a nullptr.
                  - [Marketplace] Sci-fi and Glitch Post-process
                  - [Tutorial] Anamorphic Bloom
                  - [Tutorial] True First Person Camera
                  - [Tutorial] Realtime Distance Field textures
                  - [Tutorial] Seamless Portals

                  Twitter - Portfolio

                  Comment


                    #69
                    also question regarding your fast render target rendering, since i want to use that to render the portals

                    these two functions


                    // Setup the Slate window with the widget
                    void UExedreScriptedTexture::UpdateSlateWindow() {
                    SlateWindow->SetContent( RenderingWidget->TakeWidget() );
                    SlateWindow->Resize( 256, 256 );
                    SlateGeometry = FGeometry::MakeRoot(Settings.Size, FSlateLayoutTransform(1.0f)); } // Render/Draw the texture

                    void UExedreScriptedTexture::Render( float DeltaTime ) { // Use the FWidgetRenderer to Draw the // Slate window and its widget into the texture

                    Renderer->DrawWindow( ScriptedTexture->GameThread_GetRenderTargetResource(), // FRenderTarget* RenderTarget SlateGrid.ToSharedRef(), // TSharedRef<FHittestGrid> HitTestGrid SlateWindow.ToSharedRef(), // TSharedRef<SWindow> Window SlateGeometry, // FGeometry WindowGeometry SlateGeometry.GetLayoutBoundingRect(), // FSlateRect WindowClipRect DeltaTime, // float DeltaTime false // bool bDeferRenderTargetUpdate ); }

                    what is Settings.Size and i keep getting an error when trying to use DrawWindow. Its like it isnt recognized as being valid.

                    Comment


                      #70
                      Originally posted by dirtydanisreal View Post
                      what is Settings.Size and i keep getting an error when trying to use DrawWindow.
                      It's a typo, bad copy paste from my code when I wrote the article. It's a FVector2D that should be the same size as the SlateWindow resize call on the line just above. I will fix my article, thanks for catching that !

                      Some advice:
                      - Take the time to read and understand the code, otherwise you are in for a lot of pain and troubles if you just copy/paste. Read the engine code to understand how the functions I use work.
                      - Don't bother with my RenderTarget article if you only plan to use it for rendering your portals, you won't gain any performance with it. A SceneCapture doesn't use Slate/Canvas to render into a texture, the rendering system writes directly into it.

                      - [Marketplace] Sci-fi and Glitch Post-process
                      - [Tutorial] Anamorphic Bloom
                      - [Tutorial] True First Person Camera
                      - [Tutorial] Realtime Distance Field textures
                      - [Tutorial] Seamless Portals

                      Twitter - Portfolio

                      Comment

                      Working...
                      X