freezy / freezy/VisualPinball.Engine

BlendMode evaluation needs improvement

Open
#280 1 comment 0 reactions 1 assignee Claimed by @Pandelii View on GitHub
rendering
Dominant language
C#
Stars
508
Forks
73
Avg merge
43m
Merged PRs (30d)
3

Description

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](https://user-images.githubusercontent.com/10963432/104343379-2853bb80-54fc-11eb-9d20-be5aaba9723d.png)

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

![fg1-apron-top-current-material](https://user-images.githubusercontent.com/10963432/104343390-2d186f80-54fc-11eb-8021-a8aba6d66e72.png)

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](https://user-images.githubusercontent.com/10963432/104343450-3e617c00-54fc-11eb-9eeb-51cd98bf10c9.png)

In VPX the material looks like this:

![fg1-vpx-mat](https://user-images.githubusercontent.com/10963432/104344403-66051400-54fd-11eb-94f6-95f67a5e5119.png)

and the image like this:

![fg1-vpx-image](https://user-images.githubusercontent.com/10963432/104344424-6bfaf500-54fd-11eb-9ea9-d902c257768f.png)

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](https://user-images.githubusercontent.com/10963432/104344787-e4fa4c80-54fd-11eb-9070-a091b6608f64.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.