View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
---|---|---|---|---|---|---|---|---|---|
0001841 | OpenClonk | Engine - Rendering | public | 2016-11-01 19:34 | 2017-08-12 15:07 | ||||
Reporter | Luchs | ||||||||
Assigned To | Luchs | ||||||||
Priority | normal | Severity | major | Reproducibility | always | ||||
Status | resolved | Resolution | fixed | ||||||
Platform | GNU G++ | OS | Linux | OS Version | |||||
Product Version | git master | ||||||||
Target Version | 8.0 | Fixed in Version | 8.0 | ||||||
Summary | 0001841: Landscape shader selects wrong material texture | ||||||||
Description | IRC user o11c reported in #openclonk that on their system, the landscape textures are mixed up. Example screenshot: http://picpaste.com/pics/cc72dd0365c146c4a959bd6772e57989.1477815063.png Patch with workaround: https://gist.github.com/o11c/4524a20f53aab8554d6e265d5fcfcb99 - 0.5 breaks it on my system, smaller values between 0.1 and 0.4 seem to work. | ||||||||
Additional Information | OpenGL renderer string: Gallium 0.4 on AMD ARUBA (DRM 2.45.0 / 4.7.0-1-amd64, LLVM 3.8.1) | ||||||||
Tags | No tags attached. | ||||||||
Attached Files |
|
![]() |
|
Luchs (administrator) 2016-11-01 19:36 |
ck: You wrote the current renderer, I think. Any idea what would cause this? |
Clonk-Karl (administrator) 2016-11-27 00:02 |
I always found the float/integer index conversions in that shader somewhat spooky. Attached another suggestion that makes the code simpler instead of more complex. Any chance we can try that on the system that showed incorrect textures? Does the workaround with 0.5 work an that system? What about 0.1 to 0.4? |
Luchs (administrator) 2016-11-27 11:18 |
I'll forward it to o11c. 0.1 to 0.4 worked for both him and me, I think. 0.5 only worked for him. |
Luchs (administrator) 2016-11-27 18:11 |
The alternative patch does not work on o11c's system. |
occ (reporter) 2016-11-27 19:25 |
Hi! There's been a check-in that references this bug. For more information you can visit the repository browser at this address: https://git.openclonk.org/openclonk.git/commitdiff/88361ab606a3905f497077cb13f173483030e165 Changeset 88361ab by Armin Burgmeier <armin@arbur.net> Use NEAREST texture filtering for material map The material map is 1D texture that contains information about every material-texture combination. There is no point in linear filtering, i.e. trying to interpolate between two materials such as gold and granite or whichever two materials happen to be adjacent in the material map texture. This might or might not be relevant to 0001841, but should be more correct behavior in any case. |
Clonk-Karl (administrator) 2016-11-27 19:35 |
For some reason it seems that on o11c's system the index read from the material map is somewhat lower that it should be (for some materials at least--from the screenshot it doesn't look like all materials are screwed up). I'm not exactly sure how that could consistently happen, but I've found that when looking up that index in the material map (which is a 1D texture), the interpolation mode is set to linear. I don't know if/when that interpolation would kick in given the texture coordinate we use to look it up, but I changed it to nearest-neighbor instead, which seems more appropriate. I would expect that every offset between 0.0 and 0.49999 should work, given my understanding of how sampler2DArray works. So I would suggest to try out the new snapshot with "nearest"-interpolation for the material map texture, and if that does not help, add a 0.25 fudge factor. |
Clonk-Karl (administrator) 2016-11-27 19:52 |
Hm, thinking some more I actually believe the previous patch was wrong: it should be "materialDepth - 1", because we need to map the number from the texture between 0 and materialDepth exclusive. Attached another patch that does this... would be great if you could give that a try as well. |
Luchs (administrator) 2016-11-27 23:00 |
>for some materials at least--from the screenshot it doesn't look like all materials are screwed up I think that's just because there are multiple adjacent earth/sand/rock textures, so it's the wrong texture, but still the correct material. |
occ (reporter) 2017-08-12 15:05 |
Hi! There's been a check-in that references this bug. For more information you can visit the repository browser at this address: https://git.openclonk.org/openclonk.git/commitdiff/02fa5abc660710952064b8e35462e61bbbbc53d8 Changeset 02fa5ab by Armin Burgmeier <armin@arbur.net> Fix material/texture selection in landscape shader (0001841) |
Luchs (administrator) 2017-08-12 15:07 |
Fulgen reported seeing the same problem and that the second patch fixes it. I pushed that patch to the repository now. |
![]() |
|||
Date Modified | Username | Field | Change |
---|---|---|---|
2016-11-01 19:34 | Luchs | New Issue | |
2016-11-01 19:36 | Luchs | Note Added: 0005479 | |
2016-11-01 19:40 | Luchs | File Added: cc72dd0365c146c4a959bd6772e57989.png | |
2016-11-27 00:02 | Clonk-Karl | File Added: alt-patch.glsl | |
2016-11-27 00:02 | Clonk-Karl | Note Added: 0005505 | |
2016-11-27 11:18 | Luchs | Note Added: 0005506 | |
2016-11-27 18:11 | Luchs | Note Added: 0005507 | |
2016-11-27 19:25 | occ | Note Added: 0005508 | |
2016-11-27 19:35 | Clonk-Karl | Note Added: 0005509 | |
2016-11-27 19:52 | Clonk-Karl | File Added: alt-patch-2.diff | |
2016-11-27 19:52 | Clonk-Karl | Note Added: 0005510 | |
2016-11-27 23:00 | Luchs | Note Added: 0005511 | |
2017-08-12 15:05 | occ | Note Added: 0005716 | |
2017-08-12 15:07 | Luchs | Assigned To | => Luchs |
2017-08-12 15:07 | Luchs | Status | new => resolved |
2017-08-12 15:07 | Luchs | Resolution | open => fixed |
2017-08-12 15:07 | Luchs | Fixed in Version | => 8.0 |
2017-08-12 15:07 | Luchs | Note Added: 0005717 |