leezer3 / OpenBVE

OpenBVE- A free train simulator
http://www.openbve-project.net
274 stars 52 forks source link

[Bug] texture error when using sharp transparency mode #748

Closed adfriz closed 2 years ago

adfriz commented 2 years ago

Description

when choosing sharp option the texture will broke, this seems only broke for shinkansen only.

Reproduction

load extension cfg or its csv object and use sharp transparent option

Route

no route

Train

shinkansen E5 by ginga81

Logs

no logs

Related information

leezer3 commented 2 years ago

This is semi-expected. It's not quite a bug, but rather a 'feature' of the sharp transparency quality.

The train uses an alpha channel in it's textures, and the chassis has two stacked alpha channels. Blending between these in a single-pass doesn't work well (for somewhat complicated mathematical reasons), which is what sharp does.

Sharp transparency isn't reccomened unless you're really struggling for FPS.

adfriz commented 2 years ago

Oh ok i understand now why sharp mode behave like that.

Anyway should the option changed to Low, medium and high ? Instead sharp, intermediate and smooth.

leezer3 commented 2 years ago

Descriptively in terms of what it does, sharp is absolutely correct- It's an absolute value from either the front or rear pixel, wheras smooth is blended between the two.

https://learnopengl.com/Advanced-OpenGL/Blending

Low isn't quite right, as if we were for example attempting to replicate exactly a BVE2 experience, sharp is specifically what we want there, as that never supported alpha.

TLDR: It's complex :P

adfriz commented 2 years ago

Yeah, just reading that how blending works make me feel a bit dizzy 😅

Anyway thanks leezer3