VertexPaint icon indicating copy to clipboard operation
VertexPaint copied to clipboard

Baking GI is giving artifacts for any mesh with VertexInstanceStream.cs

Open ikay70 opened this issue 7 years ago • 5 comments

@slipster216 Amazing tool, thank you very much.

Using Unity 5.4.0 - 5.4.2, Actively using VertexPaint (VP) with 3 layers + specular, Accidentally clicking on meshes with Standard Shader material while VP is active. VP is adding VertexInstanceStream.cs to these meshes, Baking GI with any texel units from 0.001 to 1, Every mesh with VertexInstaceStream.cs script on it is baked with artifacts like old colored tv

Rebaking meshes using Standard Shader material without VertexInstanceStream.cs gives expected results without artifacts.

Have you ever encounter this kind of behavior?

ikay70 avatar Dec 27 '16 12:12 ikay70

I haven't - any chance you can send me a small repro project so I can take a look? The shaders themselves are surface shaders, so should support any lighting mode which the unity shaders do. That said, for certain types of baking (static lightmaps/batching) you actually need to burn the Vertex Instance Stream data into the mesh using the Utility panel's baking tools, so this is one thing worth trying. (I'm also wondering if your using Flow mapping, because I think those shaders might use UV2 for flow, which Unity might try to store some GI baking information in? Been a while since i've looked at those shaders since I'm mostly focused on MegaSplat now).

slipster216 avatar Dec 27 '16 13:12 slipster216

I'm not sure if this is related to that, but I'm having some issues regarding real time GI with static meshes.

Whenever I try using both real time and static lightmaps at the same time, any static mesh with the vertex instance stream gets artifacts while baking. this doesn't happen if I only use static lights or use realtime lights with realtime lightmaps turned off.

For the sake of clarity, since this can be a little bit confusing to understand, here's a scene using realtime lights on a dynamic/non-static mesh using realtime lightmaps only.

Inspector Realtime Lights, Dynamic mesh, Realtime Lightmap

On static meshes using only static lights with the new progressive lightmapper (results are very similar with Enlighten):

Inspector Static Lights, Static mesh, Mixed Lightmap - Progressive

Problems start to appear when I start adding static meshes with the realtime lightmapper, though.

Inspector Realtime Lights, Static Mesh, Real time Lightmaps

I believe this is not a UV issue since the lightmap bakes fine if all lights are static as well.

Do you have any idea what could be causing this? I don't think I'm painting anything related to the flow map issue mentioned above.

dorodo95 avatar May 20 '17 21:05 dorodo95

You might try baking out the mesh so you don't need the VertexInstanceStream. I haven't played with the new lightmapper yet, but it may require the mesh to be static/readonly.

Sent from my iPhone

On May 20, 2017, at 5:12 PM, dorodo95 [email protected] wrote:

I'm not sure if this is related to that, but I'm having some issues regarding real time GI with static meshes.

Whenever I try using both real time and static lightmaps at the same time, any static mesh with the vertex instance stream gets artifacts while baking. this doesn't happen if I only use static lights or use realtime lights with realtime lightmaps turned off.

For the sake of clarity, since this can be a little bit confusing to understand, here's a scene using realtime lights on a dynamic/non-static mesh using realtime lightmaps only.

On static meshes using only static lights with the new progressive lightmapper (results are very similar with Enlighten):

Problems start to appear when I start adding static meshes with the realtime lightmapper, though.

I believe this is not a UV issue since the lightmap bakes fine if all lights are static as well.

Do you have any idea what could be causing this? I don't think I'm painting anything related to the flow map issue mentioned above.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

slipster216 avatar May 21 '17 16:05 slipster216

I think I figured out what is going on with the artifacts; the precomputed realtime GI system uses the same additionVertexStream api, putting data into the uv3 channel. The VertexInstanceStream code from this tool assumes there's no data in there to begin with so wipes it all out, removing the GI lightmaps and causing the artifacts.

teacup42729 avatar Jun 29 '18 20:06 teacup42729

I have the same problem as well. How do we solve this? Can we make the tool to use UV4 if possible?

Pixellore avatar Dec 27 '18 15:12 Pixellore