Neos-Metaverse / NeosPublic

A public issue/wiki only repository for the NeosVR project
193 stars 9 forks source link

Materials have a chance to "break" when changing transparency settings #1804

Open AMonsoonofBabies opened 3 years ago

AMonsoonofBabies commented 3 years ago

Describe the bug

When changing parameters in materials relating to transparency, such as blend modes and alpha channels, the material has a chance to fail to make the change and suddenly break, or turn a bright unlit pink color, and become unresponsive to changes thereon.

Relevant issues

No existing issues appear to be related.

To Reproduce

  1. Open a new world.
  2. Spawn a developer tooltip and open the create new window.
  3. Find and spawn out a PBS Displace Metallic material orb.
  4. Within the settings, find the AlphaHandling parameter and cycle it between its three options by pressing either the left or right arrow twice.
  5. Observe that the material stops responding to changes, and the "Waiting for Apply" text at the bottom of the settings panel now indicates True. After a few moments, the material should turn an unlit pink.

Expected behavior

The material should, at most, blink out or flash for a frame, then resume taking changes as normal, including becoming transparent in ways that the material permits.

Screenshots / Video

image

Bug information (please complete the following information):

Additional context

In the reproduction case, duplicating the broken material orb creates a new functioning one, which still can break in the same way as the original. Saving a broken material orb to your inventory then spawning it out appears to fix the material, unless it was an orb duplicated from one that was already broken, in which case it displays as black and grey checkerboard. I'm unsure if this is relevant in any manner.

Reporters:

A Monsoon of Babies#9991 buxLighter#9971 Shifty#7944

Hayden-Fluff commented 3 years ago

I've found this easiest to replicate on Unlit, changing between Alpha and Additive while using the UseBillboardGeometry option. It makes it quite annoying to iterate on materials, as to get the material to work again, the only way I know of is creating a copy, which can get annoying very quickly when working with materials with driven properties.

Frooxius commented 3 years ago

Does this problem still persist for you? Sometimes the variants of a shader can take a bit to generate, as it's done asynchronously on the cloud, but it only ever happens one for each variant, so sometimes you might be the unlucky one to use particular variant and the asset variant system having a bit of a queue.

I tried the material you specified in the repro steps, but it works fine on my end, which would suggest it has been generated in the meanwhile. That means that it's not really broken, it's just waiting for a while for the shader to be generated and loaded from the cloud.

shiftyscales commented 3 years ago

Your suggestion makes sense Froox. In this case, it might well be that PBS_DisplaceMetallic with alpha blending just hasn't ever been used prior. Everyone that replicated the issue did so in a relateively short span (within a half hour or less I believe).

Recreating the material now works properly on my end, so I think this is an issue that will wind up resolving itself over time as more and more shader variants are generated.

Some interesting notes:

Overall, it seems like the actual underlying issue is in the material getting stuck in the 'waiting for apply' state/staying pink after it's detected the variant has been generated in the cloud, because reliably- anytime I saved a version of a material that was in this state, it worked properly when spawned back out from my inventory, or even when pasting the same material orb into a new world.

Frooxius commented 3 years ago

The pink is just result of some other changes to the material while it's still waiting to process. Normally it doesn't wait anywhere that long, so it doesn't come up, but it's not really important detail to focus on.

The material should load though once it's generated, even if it takes a while, it did that in previous cases when I tested it. How long did you wait for it to generate? Do you have any logs from the wait?

shiftyscales commented 3 years ago

Overall from the time the various materials had initially turned pink I had waited around ten or so minutes, but also as noted, if I spawned out a saved copy from the inventory, or pasted the orb into a new world, the variant had already long since been generated it appeared. @Frooxius

From what I saw of it, what appears to happen in order:

It feels as though it enters the pink waiting for apply state after the variant has already been generated and called to load, rather than before.

Following Hayden's instructions above (unlit material set to use bilboard geometry and additive), I've produced the following result numerous times (restarting between each attempt):

https://user-images.githubusercontent.com/54213390/110180662-0f121180-7dbf-11eb-8a3c-b70a2c13b829.mp4

SHIFTYWINDOWS - 2021.3.5.371 - 2021-03-05 14_24_08.log

AlexThorin commented 3 years ago

Not sure if it's relevant, but i did notice that cycling to alphablend first doesn't break it. It's only when you choose alphaclip. But always on alphaclip no matter which way you cycle through to it.

shadowpanther commented 3 years ago

Is this still an issue for you @AMonsoonofBabies @Hayden-da-Serg @AlexThorin ? The shader generation in the cloud had some issues a while ago where any new shader variant would refuse to load and break into the pink state after a timeout. Those issues were hopefully fixed already.

Hayden-Fluff commented 3 years ago

I only really experience this now with shaders I rarely use and flip between shader assets of often, though they seem to load eventually with an indeterminate amount of time.