wave-harmonic / crest

A class-leading water system implemented in Unity
MIT License
3.48k stars 480 forks source link

[LWRP/UniversalRP] Crest breaks completely on Vulkan #359

Closed SeruK closed 4 years ago

SeruK commented 4 years ago

Describe the bug Crest completely breaks when switching the project to Vulkan. The generated textures are are completely wrong and water stretches and seems generally broken. There are no error messages. Please refer to the attached videos.

We're using the LWRP version of Crest downloaded from the asset store, but simply replaced the "lightweight" part in shader includes with "universal" (since the LWRP includes just redirects to Universal nowadays).

Crest works as expected on the same Unity/UniversalRP version when using DX11 as API.

Screenshots / video Two short videos showing the issue in the whirlpool example (all examples have the same issue), one recorded with the editor set to DX11 and on with the editor set to Vulkan. Crest_Whirlpool.zip

Log When not include LWRP the log complains about a missing script - we double checked and it's the PostProcess Layer. Issue is unrelated since the water works fine on DX11 in the same scene and project, and also in a completely new example project.

Versions Unity 2019.3.0b7 (Same issue on 2019.3.0a12) Universal Render Pipeline 7.1.2 Crest 3.0 (according to Read Me - version was downloaded 2019-10-29)

To Reproduce

  1. Create an empty project with Unity 2019.3.0b7 (or 2019.3.0a12).
  2. Install LWRP (or UniversalRP and fix shader includes referencing LWRP).
  3. Import Crest.
  4. Go to ProjectSettings/Graphics. Change SRP Settings asset to CrestExampleLWRP Asset.
  5. Open the Whirlpool sample scene.
  6. Confirm that it works on DX11.
  7. Go to ProjectSettings/Player. Uncheck "Auto Graphics API for Windows". Change active rendering API to Vulkan.
  8. Confirm that the sample scene breaks on Vulkan.

Platform Windows Editor with Vulkan as Rendering API

Hardware GPU: NVIDIA GeForce RTX 2060 CPU: Intel Core i5-9400F

huwb commented 4 years ago

Wow that sucked to fix.

The problem appears to be a constant buffer name conflict. The fix is to open this shader:

Crest\Shaders\OceanInputs\Resources\AnimWavesGerstnerBatch.shader

And change

CBUFFER_START(CrestPerObject)

To

CBUFFER_START(GerstnerUniforms)

This will be deployed with the next release, I'll close this issue when that happens.

huwb commented 4 years ago

Oops forgot to close this. It was fixed in 3.2.