OpenClonk Bugtracker - OpenClonk
View Issue Details
0000895OpenClonkEngine - Renderingpublic2012-12-26 10:392017-08-12 19:40
Assigned ToLuchs 
Platform64 BitOSWindows 7OS Version-
Product Version 
Target Version8.0Fixed in Version8.0 
Summary0000895: SetMatAdjust() does not work with high resolution landscape
DescriptionI tried SetMatAdjust(RGBa(255,127,127,127)) from via console and scenario script.
TagsNo tags attached.
Attached Files

2012-12-26 10:41   
Can be closed. Found a equivalent in bugtracker.
2013-11-10 19:32   
I can reproduce this.

SetMatAdjust does not work with high resolution landscape option on.
2013-11-12 17:57   
PeterW can perhaps say if this is even possible to implement for the highres shader. (I don't think the function is used anywhere / doesn't make so much sense to me)
2013-11-12 18:05   
(Last edited: 2013-11-12 18:07)
It is certainly possible. You'd just need to pass it to the shader and process it there accordingly. You could now even make it per-material if you really wanted to. However, you would probably want to disable this in the default case, so it doesn't end up causing performance reductions (Guenther's old shader went to some pains to do this).

So the question here is - is the use case important enough to warrant a special case? If yes, the actual change is actually not too complicated, so it might be a good project for somebody trying their hand at engine development (Paelleon?).

2013-12-04 14:18   
Paellon is working on it
2015-11-10 20:35   
This has not happened, has it? Should we just drop SetMatAdjust? For a constant MatAdjust, the same effect can be achieved by overloading the landscape shader in a custom scenario. And once we have shader parameters that can be changed in C4Script, that would be a full replacement.

At the moment, only ScorchedGardens uses SetMatAdjust (and probably hasn't worked there since a while now...)
2015-11-11 00:20   
I agree it's not needed by default as it's another per-pixel operation done in the shader. Custom scenario shaders can now gain much more control over how to draw the landscape and other things.
2015-11-11 16:06   
On the other hand, the "material shinyness" patch pretty much introduced exactly what's needed for this - a material property map that is sent to the shader. For example, it would be trivial now to change material's emittence dynamically.
2015-11-11 16:09   
That's actually a good idea. PeterW would you want to implement that?
2015-11-11 16:13   
I could easily change SetMatAdjust to change the emittence, if that's acceptable (it's an adjustment - just a different one!). For a new dynamic property, I'd grumble a bit more, because it means yet more shader code for a fairly rare use case.
2015-11-11 16:21   
Yes, changing the emittence is what I had in mind.
2015-11-12 22:26   
Hm, the current material adjustment is actually global, had not realised that. Is that how it should be? If we want it per-material, this raises the question of how we should save it. As a big NameList in the scenario core, possibly?

... what exactly would we want to use this for anyway? ;)
2015-11-12 22:38   
As a first step I think it's fine to just restore (the global) SetMatAdjust functionality. At the moment the function just does nothing.
2015-11-12 22:45   
(Last edited: 2015-11-12 22:49)
Yes, it would just store the global adjustment as MatAdjust in C4Landscape, synchronized/stored via Game.txt.

C4MaterialCore would keep the static value defined in the .c4m and the C4Material would have the dynamic value as the static value multiplied by the current MatAdjust. Multiplication would happen at game start (for savegame resume), on SetMatAdjust() and when a material is reloaded.

I don't think we need a Scenario.txt entry.

Individually adjustable materials sound nice, but I don't really see the use case. Maybe to do scripted material animation? (e.g.: "Boiling" lava changes its brightness between bright and very bright). But we can always add that later by adding a parametger to SetMatAdjust (SetMatAdjust(adjust) sets all materials and SetMatAdjust(adjust, material) sets only one material).

2015-11-12 23:10   
> ... what exactly would we want to use this for anyway? ;)

Actually, the only use case I know was in sequences, people liked to do SetSkyAdjust, SetMatAdjust and SetClrModulation on all objects to make everything except the UI darker. I guess now you can just use SetGamma?
2015-11-13 09:02   
> the only use case I know was in sequences, people liked to do SetSkyAdjust, SetMatAdjust and SetClrModulation on all objects to make everything except the UI darker

Which would be a very bad fit for the "emittence" SetMatAdjust, because it would make everything strictly brighter.

And yeah, the best use case I could come up with would be "pulsating" Lava or Crystal - and even then it would arguably be more natural to achieve this by material texture animations (not bound to game tick) or object overlays (so you can "bloom"). Not sure...
2017-08-12 19:40   
Not sure about all the extra discussion, but I fixed SetMatAdjust in 19395b23ae67a0a037ba887177f1281750aea50f a while back.

Issue History
2012-12-26 10:39user22New Issue
2012-12-26 10:41user22Note Added: 0002368
2013-11-10 19:32NewtonNote Added: 0002737
2013-11-10 19:33NewtonStatusnew => acknowledged
2013-11-10 19:33NewtonSummarySetMatAdjust() does not work => SetMatAdjust() does not work with high resolution landscape
2013-11-12 17:57NewtonNote Added: 0002748
2013-11-12 18:05PeterWNote Added: 0002749
2013-11-12 18:06PeterWNote Edited: 0002749bug_revision_view_page.php?bugnote_id=2749#r504
2013-11-12 18:07PeterWNote Edited: 0002749bug_revision_view_page.php?bugnote_id=2749#r505
2013-11-12 18:24NewtonPrioritynormal => low
2013-12-04 14:18NewtonNote Added: 0002795
2013-12-04 14:18NewtonStatusacknowledged => confirmed
2015-10-16 00:33Sven2Target Version => 7.0
2015-11-10 20:35Clonk-KarlNote Added: 0004098
2015-11-11 00:20Sven2Note Added: 0004099
2015-11-11 16:06PeterWNote Added: 0004100
2015-11-11 16:09Sven2Note Added: 0004101
2015-11-11 16:13PeterWNote Added: 0004102
2015-11-11 16:21Sven2Note Added: 0004103
2015-11-12 22:26PeterWNote Added: 0004104
2015-11-12 22:38Clonk-KarlNote Added: 0004105
2015-11-12 22:45Sven2Note Added: 0004106
2015-11-12 22:47Sven2Note Edited: 0004106bug_revision_view_page.php?bugnote_id=4106#r996
2015-11-12 22:49Sven2Note Edited: 0004106bug_revision_view_page.php?bugnote_id=4106#r997
2015-11-12 22:49Sven2Note Edited: 0004106bug_revision_view_page.php?bugnote_id=4106#r998
2015-11-12 23:10Sven2Note Added: 0004107
2015-11-13 09:02PeterWNote Added: 0004109
2016-01-02 19:42ClonkonautTarget Version7.0 => 8.0
2017-08-12 19:40LuchsAssigned To => Luchs
2017-08-12 19:40LuchsStatusconfirmed => resolved
2017-08-12 19:40LuchsResolutionopen => fixed
2017-08-12 19:40LuchsFixed in Version => 8.0
2017-08-12 19:40LuchsNote Added: 0005720