PopcornFX / O3DEPopcornFXPlugin

PopcornFX plugin for O3DE
https://www.popcornfx.com/
Other
12 stars 12 forks source link

Particle issues on Vulkan renderer (O3DE Atom) #36

Closed SelfishOlex closed 1 year ago

SelfishOlex commented 1 year ago

A ribbon trail particle looks fine with DX12 Atom: image

However, the same level and the same particle effect looks wrong with a Vulkan renderer: image

For reference the effect is "Straight_Shot_Effect.pkfx" and I'm attacking a zip of the PopcornFX project. PopcornFX.zip

'-rhi=vulkan -rhi-device-validation=enable': Game_vulkan.log

'-rhi=dx12 -rhi-device-validation=enable': Game_dx12.log

SelfishOlex commented 1 year ago

Note, the switch can be done from a command line: -rhi=vulkan or -rhi=dx12

moudgils commented 1 year ago

Can you attach output log after enabling device validation? It may provide further leads as to where the issue maybe.

SelfishOlex commented 1 year ago

Can you attach output log after enabling device validation? It may provide further leads as to where the issue maybe.

@moudgils Done.

ValPKFX commented 1 year ago

Thank you, I will try to reproduce it and see if we can do something.

moudgils commented 1 year ago

image (7) Took a quick look at the particle effect issue. The problem is with the vertex data for the particle effect in questions. For Vulkan it looks messed up. Vk is to the left and dx12 is to the right. If I had to take a guess its the maybe the sim code didnt update the gpu memory correctly.

lmbr-pip commented 1 year ago

@ValPKFX Any updates here?

lmbr-pip commented 1 year ago

FYI We just made o3de-multiplayer-sample, and o3de-multiplayersample-assets all public. If you build latest MPS (would recommend using the stabilization/2305 branches), you can see this just in the Editor viewport without needing to run actual game. Impacts several VFXs in this project.

Can provide videos, logs etc if that will help.

HugoPKFX commented 1 year ago

Hi, thanks for reporting the issue. Val is out this week unfortunately, I'll try to take a look. GPU Buffers fill logic isn't API dependent in the plugin / PopcornFX runtime, things that come to mind to double check:

HugoPKFX commented 1 year ago

Resolved on development branch, commit id 92ea37adb2ad0ee94d4bfd3d4ea2dbbd0220094f Also fixed in upcoming PopcornFX v2.15.5 Thanks for reporting the issue

Issue came from Atom RHI difference between D3D12 and Vulkan. For Ribbon particles, we were incorrectly doing the vertex input positions setup (via AZ::RHI::InputStreamLayoutBuilder):

// Before:
layoutBuilder.AddBuffer()->Channel("POSITION", AZ::RHI::Format::R32G32B32_FLOAT);
// After:
layoutBuilder.AddBuffer()->Channel("POSITION", AZ::RHI::Format::R32G32B32A32_FLOAT);

This second parameter is ignored in D3D12 Atom/RHI, as vertex buffer stride is specifed when IASetVertexBuffers is called. In Vulkan byte stride is specified when the graphics pipeline is created, ignoring the RHI::StreamBufferView infos.

Additional debug asserts in Atom or errors could help quickly identify such issues

moudgils commented 1 year ago

Was there a PR for this issue?

ValPKFX commented 1 year ago

There was no PR, it's the commit 92ea37adb2ad0ee94d4bfd3d4ea2dbbd0220094f