umasteeringgroup / UMA

Unity Multipurpose Avatar
MIT License
739 stars 168 forks source link

[UMA 2.10] Changing a recipe sometimes causes a strange pixelization on characters #308

Closed pedropla closed 4 years ago

pedropla commented 4 years ago

Using UMA 2.10 on MacOS with Unity 2019.3.12f1.

When changing the recipe of a character a strange pixelization happens sometimes. Sometimes it goes away when a new recipe is loaded sometimes more pixelization occurs.

This happens in demo scenes as well as when changing in code in my own scenes. Not sure if it's a known bug. See screenshot below.

It might be a memory leak of some sort because when I tried changing back and forth between wardrobe items in code repeatedly (to see if there was a pattern of when this happened and when it didn't) I managed to crash unity itself.

Screen Shot 2020-05-05 at 5 57 28 PM
kenamis commented 4 years ago

Did you have this issue on previous versions of UMA? Is this built-in rendering pipeline or one of the SRPs? Are your video drivers up to date?

pedropla commented 4 years ago

This is with built-in rendering. All video drivers (for MacOS) are up to date and Unity/UMA are the latest version. I haven't tried it on previous versions of UMA or Unity as I've just started testing UMA recently.

Is there any way I can provide further information which might help with debugging the issue? I'm not at all familiar with the UMA platform so I'm not sure where to look.

Thanks

pedropla commented 4 years ago

Just to update, I've tried this with URP and I'm still getting the same issues.

kenamis commented 4 years ago

Try this, search for the "TextureMerge" scriptableObject and replace the "Normal Shader" with "AtlasShaderNormal32". [image: image.png]

On Wed, May 13, 2020 at 11:39 PM Pedro notifications@github.com wrote:

Just to update, I've tried this with URP and I'm still getting the same issues.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/umasteeringgroup/UMA/issues/308#issuecomment-628422035, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA46NG6M6KTTNHQR3WSQLK3RROGYLANCNFSM4MZN5MIQ .

pedropla commented 4 years ago

I've given it a try and I'm still seeing that pixelation.

To see if it could be an issue with all the UMA shaders I even replaced the Normal Shader with the URP/Lit and Unlit shaders and the pixelation was still occurring after certain recipe changes.

So perhaps it isn't a shader issue but something to do with regenerating the mesh after adding/removing clothing?

kenamis commented 4 years ago

If you inspect the textures that are built and on the renderer at runtime, do you see those artifacts?

On Thu, May 14, 2020 at 8:10 AM Pedro notifications@github.com wrote:

I've given it a try and I'm still seeing that pixelation.

To see if it could be an issue with all the UMA shaders I even replaced the Normal Shader with the URP/Lit and Unlit shaders and the pixelation was still occurring after certain recipe changes.

So perhaps it isn't a shader issue but something to do with regenerating the mesh after adding/removing clothing?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/umasteeringgroup/UMA/issues/308#issuecomment-628698812, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA46NG3XATIRRAWXS6ZYYMLRRQCWBANCNFSM4MZN5MIQ .

pedropla commented 4 years ago

Ok, that seems to have narrowed it down. It seems to be something in the generation of the Metallic Map.

When I remove the Metallic Map it removes those artefacts. See screenshots below.

kenamis commented 4 years ago

if you examine the generated metallic textures do they have those square artifacts?

pedropla commented 4 years ago

It's hard for me to see as the preview is very small (screenshot attached).

I'm trying to export the bitmaps but the documentation I find online to do that is very old and doesn't work in the latest unity. Is there a way I can export the full generated texture to see it?

Jaimi commented 4 years ago

@pedropla - What model mac do you have, and what type of graphics? I had a problem very similar to this on my imac (2013) that turned out to be a driver issue. I don't know the state of Mac Development right now (my imac fusion drive croaked), but can you switch between Metal and OpenGL to see if it's still a problem?

pedropla commented 4 years ago

@Jaimi I'm using the MacBook Pro 13-inch, 2016. Graphics card: Intel Iris Graphics 550.

I've tried switching as you suggest and yes, the problem seems to be with the Metal graphic system. When I switch to OpenGL it works. However, it's not feasible to switch permanently as Metal is now the default graphic system and much less is supported in OpenGL than Metal.

I also haven't experienced any similar issues with any other Unity Assets with the Metal graphic system.

Jaimi commented 4 years ago

@pedropla - with that system, it shares RAM with the machine, so you may be low on what it considers "video memory". As a test, if you can set the generator to scale to 4, and lower the Atlas size to 1024, do you still get the issue?

pedropla commented 4 years ago

@Jaimi Sorry I'm pretty new to UMA and I'm not sure exactly how to do this. I didn't see these options in the UMA menu or in the UMA Character object.

What I did see in the UMA DCA script options on the character was the following Atlas resolution scale. When I reduced it to about half of the standard 1, I no longer saw this issue occurring. Screenshot below.

Does that mean that this issue is due to too little video card memory? If so, how will that affect a game that's used on for example a mobile device that also has very little video memory?

Is it considered a bug or just something to be aware of? If it's something to be aware of, what is the correct way to detect and adapt Atlas resolution accordingly?

Thanks!

pedropla commented 4 years ago

I spoke too soon.. Even with the Atlas Resolution Scale reduced it still happens. Just less often.

pedropla commented 4 years ago

@Jaimi I found the settings you mentioned and I had to lower the Atlas size to 512 before the problem stopped showing up frequently.

Jaimi commented 4 years ago

I think this is a problem with Unity and the driver. I'm sorry, but not much we can do with this. You can use the option to "Convert Render Texture" to move all of the textures to system memory. Warning: it is slower. Or you can switch to OpenGL. We have a feature coming in 2.11 to delay moving the textures to system ram, which should help significantly with the stalling.

pedropla commented 4 years ago

Thanks for having looked into it!