3dreamengine / 3DreamEngine

3DreamEngine is an *awesome* 3d engine for LÖVE.
MIT License
393 stars 17 forks source link

fxaa/msaa does not work any more #32

Closed thisnickwasfree closed 4 years ago

thisnickwasfree commented 4 years ago

Looks like fxaa/msaa doesnt work in last version.

Luke100000 commented 4 years ago

Both msaa and fxaa work for me. I assume you have another graphical glitch because anti aliasing can not cause or fix wide spaces. I try to reconstruct your scene to find and fix the error.

thisnickwasfree commented 4 years ago

https://ibb.co/tZ4TdSJ https://ibb.co/7vS4zX5

Look at the edges of trees (texture with alpha). One — old engine, another — new one. Both: msaa = 0, fxaa = true. At first screenshot edges are affected by AA, but not at second one. And the settings are the same, only the version of 3DreamEngine differs.

Luke100000 commented 4 years ago

I forgot to tell: I readded alpha tag of materials. Why? The engine needs to know how to render a material. In previous version I just rendered both variants, which is a massive waste of performance. I updated the readme. Section alpha. In your case you have default 0, which only renders solid parts. Semi transparent color is disabled. So your leave/foliage materials need alpha = 1, which uses both passes. While setting this manually is surely annoying, its necessary.

thisnickwasfree commented 4 years ago

And what is the default alpha, if it is not set in mat? The main problem in in tress (both variants are good), but in spaces between tiles. So, I can add alpha to them, bat can it help? Looks like alpha should be 0 for their materials, and if this is default value… Looks like this issue duplicates #22. But it's harder in new version. The spaces are connected somehow with alpha blend mode: the only mode works fine with them is «dither» one. But it has problems with textures which have alpha-channel. And in old version of the engine it was possible to use «average» or «alpha», and no spaces. Looks like AA means nothing for these spaces…

Luke100000 commented 4 years ago

Default is 0 (no alpha at all, fastest), 1 would restore the look of the old version. Or at least it should. But 0 should be fine since there is no semi transparent pixels. By just looking at the screenshots I can not explain the results, nor I was able to reconstruct it myself. It would be far easier for me if I had (read) access to your project.

thisnickwasfree commented 4 years ago

By just looking at the screenshots I can not explain the results

https://github.com/thisnickwasfree/3dreamengine_tests

2 demos. demo1 — old version of 3DreamEngine, demo2 — new one. Code, models, textures — everything is the same, except 3DreamEngine's directory. And the picture differs…

Luke100000 commented 4 years ago

By just looking at the screenshots I can not explain the results

https://github.com/thisnickwasfree/3dreamengine_tests

2 demos. demo1 — old version of 3DreamEngine, demo2 — new one. Code, models, textures — everything is the same, except 3DreamEngine's directory. And the picture differs…

Thanks, I found the problem. Your PKM file contains a few pixel on the top left which are not alpha 255 (slightly transparent). You can fix this yourself (its not a big deal but technically wrong), but I will increase the threshold of the 3D engine anyways, so the next commit will fix this too.

EDIT: no, threshold is correct, see next post

thisnickwasfree commented 4 years ago

Thanks, I found the problem.

True. Was confused by different results of renderer and haven't noticed this texture's bag.

Luke100000 commented 4 years ago

When using disabled (you use disable, typo!) as blend mode it ignores alpha. Works fine for your project if you never use semi transparent pixels. When using alpha you need to tell the engine that the material of the road contains transparency (but I suggest removing those pixels instead)