effekseer / EffekseerForWebGL

MIT License
116 stars 17 forks source link

Results of blending are different in browser vs in editor #112

Open tshadowknight opened 1 day ago

tshadowknight commented 1 day ago

I've been trying some blend mode tricks recently and have run into the issue that they tend to not render the same way in the browser compared to in the editor.

A recent example:

image

VS.

image

The swirls in particular are of note here. They are rendered in front of the core beam but the additive layers of the beam "overcome" the swirls in the editor but not in the browser.

I did some poking around and I suspect this is because the blend operations in webgl are using int and are clamped to 0-255 after each step and that this is likely not the case in the editor.

I don't know a whole lot about webgl's internal workings so I am wondering if this would be fixable at all?

durswd commented 1 day ago

Do you use EmissivePower?

tshadowknight commented 1 day ago

The initial example was with Emissive Scaling set to 1, but there are two additive layers of white in the beam.

I tried setting Emissive Scaling to 20 on one of the beam layers as a test and it behaves similarly inconsistent:

In the editor, this seems to be as expected:

image

In the browser, this seems to not be working:

image

How is emissive scaling implemented? Does it use RGB values greater than 255(or 1)? It could also be getting clamped during blending.