Page 1 of 1
Custom Shaders discussion
Posted: 09 Sep 2022, 05:00
by Lobby
For better overview I moved discussions about custom shaders to here. Here you can also suggest changes to the tutorial.
To go to the tutorial:
The Custom Shaders documentation
[1.10.50] Custom Shaders
Posted: 09 Sep 2022, 05:37
by Bevise
I don't comprehend it at all. Maybe I should try out the plugin. ._.
Re: Custom Shaders discussion
Posted: 09 Sep 2022, 11:10
by Simon142
YOOOO nice. I kinda know glsl, imma make my first shader plugin!
Re: Custom Shaders discussion
Posted: 10 Sep 2022, 11:01
by PixelDubs
To be honest probably won't be using this, can't use GLSL, when I start developing BetterTT I will not be using shaders as the project would take forever as it is.
Re: Custom Shaders discussion
Posted: 10 Sep 2022, 15:56
by PixelDubs
I also think shaders won't be used much too.
Re: Custom Shaders discussion
Posted: 02 Oct 2022, 18:46
by Simon142
Does the existence of type IDs shader imply there is a way to get pixel's type (part of GUI, text, or tile)? If so, how can I make something similar too? I'd like to make it so my shaders don't affect game UI.
Also, is/will there be the source code reveal of fancy/X fancy shaders?
Re: Custom Shaders discussion
Posted: 03 Oct 2022, 01:31
by Bearbear76
Simon142 wrote: ↑02 Oct 2022, 18:46
Does the existence of type IDs shader imply there is a way to get pixel's type (part of GUI, text, or tile)? If so, how can I make something similar too? I'd like to make it so my shaders don't affect game UI.
Also, is/will there be the source code reveal of fancy/X fancy shaders?
True the game UI was bearly visible with your plugin if I remember correctly.
Re: Custom Shaders discussion
Posted: 03 Oct 2022, 12:46
by IlikeBurgerHam
How do you recreate the LOL shader that's in-game? Like what's the code?
Re: Custom Shaders discussion
Posted: 03 Oct 2022, 17:31
by Simon142
Bearbear76 wrote: ↑03 Oct 2022, 01:31
Simon142 wrote: ↑02 Oct 2022, 18:46
Does the existence of type IDs shader imply there is a way to get pixel's type (part of GUI, text, or tile)? If so, how can I make something similar too? I'd like to make it so my shaders don't affect game UI.
Also, is/will there be the source code reveal of fancy/X fancy shaders?
True the game UI was bearly visible with your plugin if I remember correctly.
I think most UI was visible, but only some light grey text in settings wasn't
Re: Custom Shaders discussion
Posted: 20 Nov 2022, 13:00
by Simon142
Bearbear76 wrote: ↑03 Oct 2022, 01:31
Simon142 wrote: ↑02 Oct 2022, 18:46
Does the existence of type IDs shader imply there is a way to get pixel's type (part of GUI, text, or tile)? If so, how can I make something similar too? I'd like to make it so my shaders don't affect game UI.
Also, is/will there be the source code reveal of fancy/X fancy shaders?
True the game UI was bearly visible with your plugin if I remember correctly.
Fixed now
Re: Custom Shaders discussion
Posted: 23 Nov 2022, 16:18
by Hadestia
What's the uniform type for night animations
Re: Custom Shaders discussion
Posted: 25 Nov 2022, 02:34
by Hadestia
Here I provided some alternative function from glsl that the game doesn't have
step generates a step function by comparing x to edge
Code: Select all
float step(float x, float edge) {
return (x < edge) ? 0.0 : 1.0;
}
returns the fractional part of x.
Code: Select all
float fract(float x) {
return (x - floor(x));
}
mix performs a linear interpolation between x and y using a to weight between them
Code: Select all
//@param A Vector3
//@param B Vector3
//@param a Alpha
//@return Vector3
vec3 mix(vec3 A, vec3 B, float a) {
return vec3(A * (1.0 - a) + B * a);
}
overlay a foreground color from background color
Code: Select all
//@param base Vector3 background color
//@param blend Vector3 foreground color
//@return Vector3
vec3 overlay(vec3 base, vec3 blend) {
return vec3(
base.r < 0.5 ? (2.0 * base.r * blend.r) : (1.0 - 2.0 * (1.0 - base.r) * (1.0 - blend.r)),
base.g < 0.5 ? (2.0 * base.g * blend.g) : (1.0 - 2.0 * (1.0 - base.g) * (1.0 - blend.g)),
base.b < 0.5 ? (2.0 * base.b * blend.b) : (1.0 - 2.0 * (1.0 - base.b) * (1.0 - blend.b))
);
}
Show
using screen resolution
Since 1.10.83 Drawing.setUniform() was available, we could just include this on our script:
uniform.lua
Code:
Select all Reset
local w, h = Drawing.getSize()
Drawing.setUniform('Resolution', (w + .0), (h + .0)) -- we need to ensure that our values are in float format
Interactive Lua editorRun
However user Resolution change over time depending on user choice in game settings, so I don't think this would be updated in runtime, Anyway our fragment shader will look like to use our uniform.
Code: Select all
...
uniform vec2 Resolution; //Drawing.getSize() returns 2 values so our uniform would be vec2
...
void main() {
// use our uniform as example:
// Resolution.x = screen width or Resources.r
// Resolution.y = screen height or Resolution.g
if (Resolution.x >= 10.0 || Resolution.y <= 10.0) {
//your code
}
}
Feel free to correct me if you nnotice something wrong.
Re: Custom Shaders discussion
Posted: 05 Jan 2023, 04:42
by GreenKeldeo
It's been a *very* long time since I last did anything with TheoTown, but I'm pleased to see at least some graphical scripting support available. Does the game process a depth buffer when rendering? If so, I might try my hand at scripting a PBR handler when I eventually have some spare time.