mellinoe / veldrid-samples

Sample projects for Veldrid
https://mellinoe.github.io/veldrid-docs/
119 stars 49 forks source link

First sample renders a black screen #22

Open valters-tomsons opened 4 years ago

valters-tomsons commented 4 years ago

Hi! I've went through the "Getting Started" section of Veldrid documentation, but I can't seem to get anything drawn. Only thing I can see is I can change the color of commandList.ClearColorTarget the color gets changed, but the quad is not visible at all.

I also tried building the sample code from repository with same results.

Running .NET Core 3.1 on Arch Linux (5.4.6). I do have Valve's ACO, but using LLVM compiler didn't change the outcome. (Running Vulkan)

I'm new to graphics programming, so I have no clue what's happening. I tried capturing a frame with RenderDoc and all I can see on timeline is a single "Colour Pass #1 (1 Targets)" with nothing more. It also doesn't report any API errors.

valters-tomsons commented 4 years ago

Instead of using VeldridStartup.CreateGraphicsDevice and explicitly calling VeldridStartup.CreateVulkanGraphicsDevice with PreferStandardClipSpaceYDirection = true in options now renders the quad correctly!

valters-tomsons commented 4 years ago

So, the issue was that Y axis on Vulkan actually points down, instead of up, like OpenGL. I think the tutorial should explicitly use OpenGL or Vulkan and define the quads as supported by the API.

bensmooth commented 4 years ago

Same thing happened to me (also on Arch Linux coincidentally). Setting PreferStandardClipSpaceYDirection to true results in the same (more correct?) behavior I get when I run the same tutorial code on the same machine with the OpenGL device instead of Vulkan.

Maybe PreferStandardClipSpaceYDirection should be set to true by default in the library to ensure that the same code running on different 3D APIs produces the same output?

YellowApple commented 4 years ago

Can also confirm that passing in a GraphicsDeviceOptions with PreferStandardClipSpaceYDirection = true fixes the tutorial for me on Slackware and .NET Core 3.0. Didn't need to explicitly specify Vulkan, either; just passed the options as an extra parameter to the existing VeldridStartup.CreateGraphicsDevice(window) call.