VisualPinball.Engine icon indicating copy to clipboard operation
VisualPinball.Engine copied to clipboard

BlendMode evaluation needs improvement

Open Roland09 opened this issue 4 years ago • 1 comments

The PbrMaterial.cs class contains these enum values for the BlendMode:

public enum BlendMode
{
  Opaque,
  Cutout,
  Translucent
}

However those don't seem to be enough and a more specific evaluation should be performed and more specific blend modes and hence materials generated. To visualize the problem here's an example of what's not working. Flash Gordon table after an import with the current version:

fg1-apron-top-current

The Apron Top isn't visible. The material settings are this:

fg1-apron-top-current-material

You can see that alpha clipping is active. It shouldn't be or it should be reduced. Here's the Apron Top with the same material, but without alpha clipping, now it's visible:

fg1-apron-top-no-alpha-clipping

In VPX the material looks like this:

fg1-vpx-mat

and the image like this:

fg1-vpx-image

The GetBlendMode() method in PbrMaterial.cs seems to evaluate the transparent pixels of the image and at some point sets the blend mode to Cutout. That algorithm needs to be fine tuned. Especially in combination with other material settings like 0,999 for the Opacity Amount which seems to serve a specific purpose.

mat

Roland09 avatar Jan 12 '21 16:01 Roland09

Awesome issue, thanks! 👍

freezy avatar Jan 12 '21 19:01 freezy