FNA-XNA/FNA

Problem with 3d graphics rendering

theranix opened this issue · 6 comments

Hi, I was trying to port my big game project from xna to fna according to instruction. As a test I copied all the content xnb's and didn't do any code changes. Everything is ok - game is loading, ui and input is working etc. but 3d graphics is not displayed excepting the sky.

It seems like everything was discarded. All parameteres coming to effect are correct. Most of shaders are ps_3_0 and vs_3_0.

Are there any ideas what could go wrong and what to do with it?

A common thing I run into is struct packing - be sure any IVertexType structs have a Pack attribute in addition to StructLayout.Sequential. (It usually wants Pack = 1)

Aside from that, RenderDoc is good for capturing D3D11/Vulkan/GL frames, it should be possible to step through each draw to see what isn't working.

Thanks for answer! I checked RenderDoc - It's turned out that behavior of cleaning rendertraget is a bit different.
I used to clean most of targets by ClearOptions.DepthBuffer. But it leads to have no data after rendering in my case

If you have a test case we can look at we can try to fix it - I would expect OpenGL to be correct (pass /gldevice:OpenGL as an arg) but maybe D3D11/Vulkan need adjustments.

It's D3D11, I will collect more information and return back

Solution was easy - depth value coming to Clear should not be more than Viewport.MaxDepth. Xna allowed to do this so I haven't changed anything. But It leads to problem only when multiplie render target is used.

Other problems I faced with:

  • VFACE need to be inverted
  • "StructureMembers" doesn't work for Vector2 field. Shader has zero value. But for array of structures it works
  • Sampler_state parameter AddressU / AddressW setted to wrap in some cases can behave like "clamp" when I use different Effect's and apply pixel shader pass earlier then vertex shader pass. It's seems to be not right to apply passes in such order but it's strange why sometimes it works and sometimes it doesn't
  • Window can change size without any reason and behavior of border mode is not stable. I will collect more information about what's going on
  • Rendering is slowly than in XNA with lots of draw calls and instancing. I also will collect more information according to my test case https://youtu.be/zwIQKy66iDU (xna - 55fps, here - 10fps)