DaemonEngine / Daemon

The Dæmon game engine. With some bits of ioq3 and XreaL.
https://unvanquished.net
BSD 3-Clause "New" or "Revised" License
305 stars 60 forks source link

partial void effect on station15 tree model #119

Open illwieckz opened 6 years ago

illwieckz commented 6 years ago

See that weird void effect at the tip of the conifer branch:

incorrect

It must look like this:

correct

Note that the bug seems to occur on the collision with the plant leaf model. For information, there is also an alphagen brush in source map at this place:

netradiant

This bug looks somewhat related to that bug noticed in wolf:et map (at least for the tree): https://github.com/Unvanquished/Unvanquished/issues/799#issuecomment-253367127

illwieckz commented 6 years ago

@gimhael the somwhat fix for #118 also somewhat fixes this (the texture is right but lighting is wrong):

incorrect

somewhat correct

It also somewhat fixes Unvanquished/Unvanquished#799 bug at least for the tree part:

incorrect

somewhat correct

But that variant of the bug is still remaining:

incorrect

It was noticed in Unvanquished/Unvanquished#799 (see comment) that the wolf:et bug was introduced in 6cb4dcc but the source tree was buildable starting with commit 97cbb46 (those are translated commit ids in Daemon repository after engine split, see the other thread for commits ids on Unvanquished repository).

illwieckz commented 6 years ago

For testing purpose a snapshot of for-0.51.0 assets (including station15 map) can be fetched this way:

wget -O- http://gg.illwieckz.net/dl/unvanquished/dev/UnvanquishedAssets.get | xargs wget
illwieckz commented 6 years ago

For testing purpose one can load wolf:et's railgun map this way:

pimi.sh etmain
mkdir -p ~/.local/share/unvanquished/pkg/etmain
mkdir -p ~/.local/share/unvanquished/game/layouts/railgun
ln -s ~/.etlegacy/etmain/pak0.pk3 ~/.local/share/unvanquished/pkg/etmain/pak0_0.dpk
ln -s ~/.etlegacy/etmain/pak1.pk3 ~/.local/share/unvanquished/pkg/etmain/pak1_0.dpk
ln -s ~/.etlegacy/etmain/pak2.pk3 ~/.local/share/unvanquished/pkg/etmain/pak2_0.dpk
wget -O ~/.local/share/unvanquished/pkg/etmain/res-etmain_0.dpk http://dl.illwieckz.net/b/unvanquished/extra/foreign-maps/etmain/pkg/etmain/res-etmain_0.pk3
wget -O ~/.local/share/unvanquished/pkg/etmain/map-railgun_0.dpk http://dl.illwieckz.net/b/unvanquished/extra/foreign-maps/etmain/pkg/etmain/map-railgun_0.pk3
wget -O ~/.local/share/unvanquished/game/layouts/railgun/spawn.dat http://dl.illwieckz.net/b/unvanquished/extra/foreign-maps/etmain/game/layouts/railgun/spawn.dat
daemon -pakpath ~/.local/share/unvanquished/pkg/etmain/ +set g_neverend 1 +devmap railgun
daemon -pakpath ~/.local/share/unvanquished/pkg/etmain/ +devmap railgun spawn
illwieckz commented 5 years ago

note that the unattended side-effect "somewhat fix" previously talked about is not there anymore, bug was brought back when lighting was fixed, i.e the complete fix for the other bug left this one unmodified despite some work in progress had some effect on this.

ghost commented 2 years ago

The tree thing seems still true as of 0.52.1:

image deleted to avoid wasting people's bandwidth

illwieckz commented 2 years ago

Your screenshot doesn't depict the bug, it is worked around by r_clear being enabled, well, it is less obvious with r_clear being enabled, and the screenshot is too low resolution to notice the bug precisely, the bug only affects the tip of one branch, you'll need to zoom-in more.

Anyway the bug is still there

ghost commented 2 years ago

Then I'm failing to understand the problem.

illwieckz commented 2 years ago

This may help: https://imgsli.com/ODgwMjI

ghost commented 2 years ago

please upload images instead of linking them, for future reviewers. Also, which side should be the good one?

illwieckz commented 2 years ago

Those are the images in first post, just reuploaded with a slider.

illwieckz commented 2 years ago

/devmap station15 /setviewpos 349 -1031 -143 159 32

This part must not be pitch black, the fact it's renderer pitch black is because it's worked around with r_clear 1, otherwise nothing would be painted at all.

nolightmap bug

If you /set r_clear 0 and move a bit, you'll see the void.

illwieckz commented 2 years ago

This is probably related to the fact those two models are colliding.

slipher commented 1 week ago

I believe this is caused by a mismatch between the depth shader and the main shader stage. The depth shader assumes that the alpha for alphaFunc GE128 should come from the image. But the main shader takes the alpha from the vertex data because the tree is using vertex lighting.

VReaperV commented 1 week ago

I believe this is caused by a mismatch between the depth shader and the main shader stage. The depth shader assumes that the alpha for alphaFunc GE128 should come from the image. But the main shader takes the alpha from the vertex data because the tree is using vertex lighting.

This does not seem to be the case. Both use u_ColorModulate = [1.00, 1.00, 1.00, 1.00], so it takes the vertex colour and multiplies it by the diffuse. Both have some alpha values set.

VReaperV commented 1 week ago

Depth buffer after depth pass on the tree: station15tree_depth

A lot of the vertexes have very low colour values, <= 10. Some others have colour values up to about 60, which is probably where the discrepancy comes from, since they're just multiplied by the diffuse.

Here's the colour buffer after rendering this tree, with colour values normalized in range of [0.0, 0.00390625]: station15tree_colour

VReaperV commented 1 week ago

So it's probably a map/shader bug.

illwieckz commented 1 week ago

Was it an answer for the bad vertex lighting:

Or for the part of the tree not being rendered?

slipher commented 1 week ago

I could be wrong about the specifics of how the depth shader is mismatched. But disabling depth pass with #1412 fixes the issue

VReaperV commented 1 week ago

Or for the part of the tree not being rendered?

Point is, nothing's not being rendered. It looks black because the resulting colour is very close to 0.

VReaperV commented 1 week ago

So either the original issue was fixed at some point, or there was no void there in the first place.

slipher commented 1 week ago

It looks black because the resulting colour is very close to 0.

That's not it. The bug is nothing being rendered at all in some pixels. It can be clearly seen if you turn off r_clear; if you don't see it maybe it doesn't happen on your machine.

VReaperV commented 1 week ago

Ohh, I found where that is happening now. Apparently it's like one small part of a branch that's affected.

illwieckz commented 1 week ago

Yes, only a small part of the branch, the part colliding with the other plant.

illwieckz commented 1 week ago

Sometime I do believe we may have some r_clearColor cvar to debug such thing.

VReaperV commented 1 week ago

Ah, found the issue now.

VReaperV commented 1 week ago

LightMapping shader multiplies with the vertex colour first, and then does the u_AlphaThreshold check: https://github.com/DaemonEngine/Daemon/blob/559e2df4bd6dd51943d742f21a3cdef7cd47e677/src/engine/renderer/glsl_source/lightMapping_fp.glsl#L102-L108

While the generic shader, which is used by the depth pre-pass, does the u_AlphaThreshold check first, and then does the multiply: https://github.com/DaemonEngine/Daemon/blob/559e2df4bd6dd51943d742f21a3cdef7cd47e677/src/engine/renderer/glsl_source/generic_fp.glsl#L64-L76

illwieckz commented 1 week ago

LightMapping shader multiplies with the vertex colour first, and then does the u_AlphaThreshold check

Maybe that's wanted for terrain blending?

VReaperV commented 1 week ago

Maybe that's wanted for terrain blending?

I suppose so. I think just doing the multiplication first in generic shader should fix this issue.