GithubHelp home page GithubHelp logo

temaran / unrealengineshaderplugindemo Goto Github PK

View Code? Open in Web Editor NEW
851.0 851.0 235.0 87.39 MB

A tutorial project that shows how to implement HLSL Pixel and Compute shaders in UE4

License: MIT License

C# 5.91% C++ 93.64% C 0.45%

unrealengineshaderplugindemo's People

Contributors

boonto avatar nicoossim avatar temaran avatar tomotaco avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unrealengineshaderplugindemo's Issues

FTexture2DRHIRef texture and vertex shader

Hello, I need a little help about two points.

I'm testing the plugin and I want to create a FTexture2DRHIRef texture to give as input directly to the pixel shader, How Can I do it? I did:

FRHIResourceCreateInfo CreateInfo;
InputTexture = RHICreateTexture2D(960, 540, PF_R32_UINT, 1, 1, TexCreate_ShaderResource | TexCreate_UAV, CreateInfo);

but then how can I fill the data? for example how to obtain a black texture?

Second question is, in the PixelShaderExample I found out the MainVertexShader function.
How can I use it? because if for example I set
OutPosition = InPosition*3;

nothing change! instead I was expecting to see cubes in the example enlarge three time themselves. So how I can use properly the vertex shader?

Iā€™m sorry for the newby question,
Iā€™m very grateful for your help,

Why pixel shader texture input has no transition?

Hi,

I am new to dx12 and I'm studying the topic. I see that the UAV texture written by the compute shader becomes an input in the pixel shader. Why there's no transition from ComputeToGFX before invoking that, like the one right before the compute dispatch that goes GfxToCompute ?

Thanks

Cannot build on unreal 4.25

I am trying this super useful demo on UE 4.25, which seems like it should work from the git history. However it fails.

Merely opening the .uproject file says some sources where build with a different engine version and suggests building from source. Building from source results in the following:

Severity	Code	Description	Project	File	Line	Suppression State
Error		(d41d3d0c-10e7-4b3b-8d0a-289830c9dff8,5): template path is not valid  : invalid Folder : D:\UE_4.25\Engine\Programs\UnrealBuildTool\SndbsTemplates ( 3)	ShaderPluginDemo	C:\Users\ctalero\Documents\code\UE4ShaderPluginDemo-4.25\Intermediate\ProjectFiles\dbsbuild	1	

I was wondering if you could give me any hints as to what could be happenning. I did click on Generate Project FIles btw

4.19.2

Application is not working with 4.19.2 .... can you fix?

[UE4.24.1] Crash with Vulkan

Hi Temaran,

Thanks a lot for your update to 4.24. I have also managed to update it myself but with just not much more than compatibility, then realized you published your change. However, I got a crash as running with Vulkan on my NVidia Geforce GTX 1600, driver version 440.14:

Assertion failed: !bInsideRealRenderPass [File:/home/user/UNREAL/UnrealEngine/Engine/Source/Runtime/VulkanRHI/Private/VulkanRenderTarget.cpp] [Line: 223] 

Signal 11 caught.
Malloc Size=65538 LargeMemoryPoolOffset=65554 
CommonUnixCrashHandler: Signal=11
Malloc Size=65535 LargeMemoryPoolOffset=131119 
Malloc Size=781568 LargeMemoryPoolOffset=912704 
[2019.12.26-17.27.08:824][774]LogCore: === Critical error: ===
Unhandled Exception: SIGSEGV: invalid attempt to write memory at address 0x0000000000000003

[2019.12.26-17.27.08:824][774]LogCore: Assertion failed: !bInsideRealRenderPass [File:/home/user/UNREAL/UnrealEngine/Engine/Source/Runtime/VulkanRHI/Private/VulkanRenderTarget.cpp] [Line: 223] 



0x00007f543e27f956 libUE4Editor-Core.so!FGenericPlatformMisc::RaiseException(unsigned int) [/home/user/UNREAL/UnrealEngine/Engine/Source/Runtime/Core/Private/GenericPlatform/GenericPlatformMisc.cpp:477]
0x00007f543e493aa7 libUE4Editor-Core.so!FOutputDevice::LogfImpl(char16_t const*, ...) [/home/user/UNREAL/UnrealEngine/Engine/Source/Runtime/Core/Private/Misc/OutputDevice.cpp:71]
0x00007f543e41bef6 libUE4Editor-Core.so!AssertFailedImplV(char const*, char const*, int, char16_t const*, __va_list_tag*) [/home/user/UNREAL/UnrealEngine/Engine/Source/Runtime/Core/Private/Misc/AssertionMacros.cpp:105]
0x00007f543e41bd8b libUE4Editor-Core.so!FDebug::CheckVerifyFailedImpl(char const*, char const*, int, char16_t const*, ...) [/home/user/UNREAL/UnrealEngine/Engine/Source/Runtime/Core/Private/Misc/AssertionMacros.cpp:452]
0x00007f53f5da97e5 libUE4Editor-VulkanRHI.so!FTransitionAndLayoutManager::EndEmulatedRenderPass(FVulkanCmdBuffer*) [/home/user/UNREAL/UnrealEngine/Engine/Source/Runtime/VulkanRHI/Private/VulkanRenderTarget.cpp:223]
0x00007f53f5dafb2a libUE4Editor-VulkanRHI.so!FVulkanCommandListContext::TransitionResources(FVulkanCommandListContext::FPendingTransition const&) [/home/user/UNREAL/UnrealEngine/Engine/Source/Runtime/VulkanRHI/Private/VulkanRenderTarget.cpp:1426]
0x00007f53f5da962e libUE4Editor-VulkanRHI.so!FVulkanCommandListContext::RHITransitionResources(EResourceTransitionAccess, FRHITexture**, int) [/home/user/UNREAL/UnrealEngine/Engine/Source/Runtime/VulkanRHI/Private/VulkanRenderTarget.cpp:1248]
0x00007f53f5dab754 libUE4Editor-VulkanRHI.so!FVulkanCommandListContext::RHICopyToResolveTarget(FRHITexture*, FRHITexture*, FResolveParams const&) [/home/user/UNREAL/UnrealEngine/Engine/Source/Runtime/VulkanRHI/Private/VulkanRenderTarget.cpp:670]
0x00007f53fec1f6b6 libUE4Editor-ShaderPlugin.so!FRHICommand<FRHICommandCopyToResolveTarget, FRHICommandCopyToResolveTargetString1430>::ExecuteAndDestruct(FRHICommandListBase&, FRHICommandListDebugContext&) [/home/user/UNREAL/UnrealEngine/Engine/Source/Runtime/RHI/Public/RHICommandList.h:726]
0x00007f543979d3ae libUE4Editor-RHI.so!FRHICommandListExecutor::ExecuteInner_DoExecute(FRHICommandListBase&) [/home/user/UNREAL/UnrealEngine/Engine/Source/Runtime/RHI/Private/RHICommandList.cpp:356]
0x00007f54398096db libUE4Editor-RHI.so!FExecuteRHIThreadTask::DoTask(ENamedThreads::Type, TRefCountPtr<FGraphEvent> const&) [/home/user/UNREAL/UnrealEngine/Engine/Source/Runtime/RHI/Private/RHICommandList.cpp:409]
0x00007f5439808db4 libUE4Editor-RHI.so!TGraphTask<FExecuteRHIThreadTask>::ExecuteTask(TArray<FBaseGraphTask*, TSizedDefaultAllocator<32> >&, ENamedThreads::Type) [/home/user/UNREAL/UnrealEngine/Engine/Source/Runtime/Core/Public/Async/TaskGraphInterfaces.h:847]
0x00007f543e25378b libUE4Editor-Core.so!FNamedTaskThread::ProcessTasksNamedThread(int, bool) [/home/user/UNREAL/UnrealEngine/Engine/Source/Runtime/Core/Private/Async/TaskGraph.cpp:686]
0x00007f543e2524a3 libUE4Editor-Core.so!FNamedTaskThread::ProcessTasksUntilQuit(int) [/home/user/UNREAL/UnrealEngine/Engine/Source/Runtime/Core/Private/Async/TaskGraph.cpp:582]
0x00007f5439954b96 libUE4Editor-RenderCore.so!FRHIThread::Run() [/home/user/UNREAL/UnrealEngine/Engine/Source/Runtime/RenderCore/Private/RenderingThread.cpp:288]
0x00007f543e2e9fa7 libUE4Editor-Core.so!FRunnableThreadPThread::Run() [/home/user/UNREAL/UnrealEngine/Engine/Source/Runtime/Core/Private/HAL/PThreadRunnableThread.cpp:25]
0x00007f543e2b1840 libUE4Editor-Core.so!FRunnableThreadPThread::_ThreadProc(void*) [/home/user/UNREAL/UnrealEngine/Engine/Source/Runtime/Core/Private/HAL/PThreadRunnableThread.h:177]
0x00007f543edaa6db libpthread.so.0!UnknownFunction(0x76da)
0x00007f543594588f libc.so.6!clone(+0x3e)

Thanks a lot for the great demo! You should really ask for a PR to integrate this into UE at least as an example.

Seems to just crash with: Failed to find shader type FComputeShaderDeclaration

I get this when running:

Assertion failed: ShaderRef != NULL && *ShaderRef != NULL [File:Runtime/ShaderCore/Public/Shader.h] [Line: 926]
Failed to find shader type FComputeShaderDeclaration
Ensure condition failed: GetShadowIndex() == 0 [File:Runtime/Core/Public/HAL/IConsoleManager.h] [Line: 782]

Any idea what might be causing the failure?

Maybe the readMe.md is old

Hello,Sir Temaran
words:
"How to use this project: I would recommend checking out the example project supplied in this repository to understand how to best use the project code. "

  1. Is the master branch is the example project?
  2. CopyToEngineShaders/ folder ---->ShaderCopyHelper?

from a greenhand,just for how to add shaders and debug them

Help
SOS
:)

README description of file structure incorrect

The readme doesn't correctly describe the file structure.
README
"Everything under the Plugins/ folder (For declaring the shaders and running rendering code)
Source/ShaderPluginDemo/ShaderPluginDemoCharacter.cpp/.h (This code shows how to consume the plugin code)
Everything under the Content/ShaderPluginDemo/ folder (These are the editor objects that I use to set up the shader use in the scene)
The project settings file (I have created some new input bindings)"

  1. The filepath to a character cpp/h file is actually
    UE4ShaderPluginDemo-4.24\Plugins\TemaranShaderTutorial\Source\ShaderUsageDemo\Private
  2. and it is called ShaderUsageDemoCharacter.cpp/h
  3. There is no Content/ShaderPluginDemo folder

(just wanted to pass it on to help others out) thanks for the good plugin!!

How to pass a texture input to a compute shader?

Thanks for setting this up. The vanilla examples work for me and I've been able to tweak the USFs and that works as well. However I can't see how to pass a texture input to the compute shader. I added a Texture2D input to the usf and added this to the parameter macros:

    SHADER_PARAMETER_TEXTURE(Texture2D, TestTexture)

In the RunComputeShader_RenderThread example, I pass that along:

     PassParameters.TestTexture = DrawParameters.TestTexture->Resource->TextureRHI->GetTexture2D();

However I always hit a check exception:

 Assertion failed: Bindings.StructureLayoutHash == ParametersMetadata->GetLayoutHash() 

Any suggestions on where I should look? The UE documentation is of course entirely nonexistent :(

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.