slipster216 / VertexPaint

Unity 5.3 Vertex Painter
Other
904 stars 153 forks source link

VertexInstanceStream Decals causing artifacts on Linear+Deferred+HDR+VR Single/Multi Pass rendering #21

Open NeatWolf opened 7 years ago

NeatWolf commented 7 years ago

Hi,

I was building up a scene with some complex PostFX and was banging my head to understand the reason some of the splat decals on the floor of a well known Unity3D AAA asset disappeared in game.

I then realized that all the VertexInstanced entities were affected.

but ONLY AT BUILD time! In the editor they work just fine, but when you try to build, all the vertexes are messed up and cause all kind of issues.

I also removed all PostFX from the scene, updated the VertexPaint libraries to the latest version, but I keep getting the issue. even not plugging the VR headset seems to create such issues.

Again it all works perfectly in the editor and in play mode.

I'm using Unity5.5.3f1 on an Asus ROG 32GB RAM, 8GB VRAM (1070)

schmid commented 6 years ago

For reference, I had a similar problem with vertices of all objects with a VertexInstanceStream on them being completely messed up in Unity 2017.2.0f3 Windows builds after alt-tabbing away from the window or switching between fullscreen and windowed. The following change in VertexInstanceStream.cs line 502 has fixed it for me - change the line:

stream.UploadMeshData(markNoLongerReadable);

to this:

#if UNITY_STANDALONE_WIN
            stream.UploadMeshData(false);
#else
            stream.UploadMeshData(markNoLongerReadable);
#endif

I'm not completely sure if this affects performance, but our builds seem to work fine for now.