View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
---|---|---|---|---|---|---|---|---|---|
0001206 | OpenClonk | Engine - C4Script | public | 2015-01-01 20:19 | 2016-11-12 23:28 | ||||
Reporter | Sven2 | ||||||||
Assigned To | Luchs | ||||||||
Priority | normal | Severity | feature | Reproducibility | N/A | ||||
Status | resolved | Resolution | fixed | ||||||
Product Version | |||||||||
Target Version | Fixed in Version | 8.0 | |||||||
Summary | 0001206: Script functions to affect shaders at runtime | ||||||||
Description | It's already possible to overload shaders in local Graphics.ocg files in scenarios. This potentially offers great possibilities for scenario authors to create special effects. However, you cannot really control them at runtime by script. I would like to see: * Functions to set variables in the shader from script * Options to have multiple sets of shaders which differ by values for #defines and between which you can switch. | ||||||||
Tags | No tags attached. | ||||||||
Attached Files |
|
![]() |
|
Luchs (administrator) 2016-10-30 11:45 |
I added AddFragmentShader() [1] which allows adding (and also removing) shader slices during runtime. It could be used for the second point, although it involves re-compiling the shader on each switch. [1]: http://docs.openclonk.org/en/sdk/script/fn/AddFragmentShader.html |
occ (reporter) 2016-11-12 21:10 |
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/6847e50e790c4baa32894fa2f7d56febf107b14e Changeset 6847e50 by Lukas Werling <lukas.werling@gmail.com> Implement setting shader uniforms from script (0001206) Uniform variables are read from the "Uniforms" proplist set on Scenario or on individual objects. Proplist keys are uniform names. Values can either be an int or an array of one to four ints in C4Script. In GLSL, the uniforms then need a matching type (int/ivec2/ivec3/ivec4). There is no error reporting; uniforms are only set if both name and type match. The implementation walks the "Uniforms" proplists on each Draw call. We may need to cache the uniform maps if this turns out to be too slow. |
Luchs (administrator) 2016-11-12 23:28 |
It's now possible to load custom shaders and to set uniforms globally, per definition, or per object. This should be enough for most graphical effects, I think. |
![]() |
|||
Date Modified | Username | Field | Change |
---|---|---|---|
2015-01-01 20:19 | Sven2 | New Issue | |
2016-10-30 11:45 | Luchs | Note Added: 0005476 | |
2016-10-30 11:46 | Luchs | Status | new => acknowledged |
2016-11-12 21:10 | occ | Note Added: 0005490 | |
2016-11-12 23:28 | Luchs | Assigned To | => Luchs |
2016-11-12 23:28 | Luchs | Status | acknowledged => resolved |
2016-11-12 23:28 | Luchs | Resolution | open => fixed |
2016-11-12 23:28 | Luchs | Fixed in Version | => 8.0 |
2016-11-12 23:28 | Luchs | Note Added: 0005491 |