Fix smoothing effect on sosci, fix noise on windows, make noise multi-coloured

pre-release-3
James H Ball 2025-01-05 19:33:05 +00:00
rodzic 9e3659105a
commit 80250944d4
7 zmienionych plików z 22 dodań i 23 usunięć

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 1.1 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 21 KiB

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 8.9 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 84 KiB

Wyświetl plik

@ -47,7 +47,7 @@ void SosciAudioProcessor::processBlock(juce::AudioBuffer<float>& buffer, juce::M
point = { x, y, brightness }; point = { x, y, brightness };
} }
for (auto& effect : effects) { for (auto& effect : permanentEffects) {
point = effect->apply(sample, point); point = effect->apply(sample, point);
} }

Wyświetl plik

@ -9,7 +9,7 @@ uniform sampler2D uTexture5; //screen glow
uniform float uExposure; uniform float uExposure;
uniform float uSaturation; uniform float uSaturation;
uniform float uNoise; uniform float uNoise;
uniform float uTime; uniform float uRandom;
uniform float uGlow; uniform float uGlow;
uniform float uAmbient; uniform float uAmbient;
uniform float uFishEye; uniform float uFishEye;
@ -26,8 +26,16 @@ vec3 desaturate(vec3 color, float factor) {
return vec3(mix(color, gray, factor)); return vec3(mix(color, gray, factor));
} }
float noise(in vec2 uv, in float time) { float noise(vec2 texCoord, float time) {
return (fract(sin(dot(uv, vec2(12.9898,78.233)*2.0 + time)) * 43758.5453)) - 0.5; // Combine texture coordinate and time to create a unique seed
float seed = dot(texCoord, vec2(12.9898, 78.233)) + time;
// Use fract and sin to generate a pseudo-random value
return fract(sin(seed) * 43758.5453) - 0.5;
}
vec4 max4(vec4 a, vec4 b) {
return vec4(max(a.r, b.r), max(a.g, b.g), max(a.b, b.b), max(a.a, b.a));
} }
void main() { void main() {
@ -49,7 +57,7 @@ void main() {
if (uRealScreen > 0.5) { if (uRealScreen > 0.5) {
vec4 reflection = texture2D(uTexture4, vTexCoord); vec4 reflection = texture2D(uTexture4, vTexCoord);
vec4 screenGlow = texture2D(uTexture5, vTexCoord); vec4 screenGlow = texture2D(uTexture5, vTexCoord);
scatter += screenGlow * reflection * max(1.0 - uAmbient, 0.0); scatter += max4(screenGlow * reflection * max(1.0 - uAmbient, 0.0), vec4(0.0));
} }
float light = line.r + uGlow * 1.5 * screen.g * screen.g * tightGlow.r; float light = line.r + uGlow * 1.5 * screen.g * screen.g * tightGlow.r;
@ -62,7 +70,10 @@ void main() {
gl_FragColor.rgb += ambient * screen.rgb; gl_FragColor.rgb += ambient * screen.rgb;
} }
gl_FragColor.rgb = desaturate(gl_FragColor.rgb, 1.0 - uSaturation); gl_FragColor.rgb = desaturate(gl_FragColor.rgb, 1.0 - uSaturation);
gl_FragColor.rgb += uNoise * noise(gl_FragCoord.xy, uTime); float noiseR = noise(gl_FragCoord.xy * 0.01, uRandom * 100.0);
float noiseG = noise(gl_FragCoord.xy * 0.005, uRandom * 50.0);
float noiseB = noise(gl_FragCoord.xy * 0.07, uRandom * 80.0);
gl_FragColor.rgb += uNoise * vec3(noiseR, noiseG, noiseB);
gl_FragColor.a = 1.0; gl_FragColor.a = 1.0;
} }

Wyświetl plik

@ -1005,18 +1005,6 @@ void VisualiserComponent::drawCRT() {
setShader(glowShader.get()); setShader(glowShader.get());
setOffsetAndScale(glowShader.get()); setOffsetAndScale(glowShader.get());
drawTexture({blur3Texture}); drawTexture({blur3Texture});
// blur the glow texture to blend it nicely. blur3Texture and blur1Texture are reserved, so we can't use them
// horizontal 512x512
activateTargetTexture(blur2Texture);
setShader(wideBlurShader.get());
wideBlurShader->setUniform("uOffset", 1.0f / 512.0f, 0.0f);
drawTexture({glowTexture});
// vertical 512x512
activateTargetTexture(glowTexture);
wideBlurShader->setUniform("uOffset", 0.0f, 1.0f / 512.0f);
drawTexture({blur2Texture});
} }
#endif #endif
@ -1025,7 +1013,7 @@ void VisualiserComponent::drawCRT() {
outputShader->setUniform("uExposure", 0.25f); outputShader->setUniform("uExposure", 0.25f);
outputShader->setUniform("uSaturation", (float) settings.getSaturation()); outputShader->setUniform("uSaturation", (float) settings.getSaturation());
outputShader->setUniform("uNoise", (float) settings.getNoise()); outputShader->setUniform("uNoise", (float) settings.getNoise());
outputShader->setUniform("uTime", time); outputShader->setUniform("uRandom", juce::Random::getSystemRandom().nextFloat());
outputShader->setUniform("uGlow", (float) settings.getGlow()); outputShader->setUniform("uGlow", (float) settings.getGlow());
outputShader->setUniform("uAmbient", (float) settings.getAmbient()); outputShader->setUniform("uAmbient", (float) settings.getAmbient());
setOffsetAndScale(outputShader.get()); setOffsetAndScale(outputShader.get());
@ -1198,8 +1186,6 @@ void VisualiserComponent::paint(juce::Graphics& g) {
} }
void VisualiserComponent::renderScope(const std::vector<float>& xPoints, const std::vector<float>& yPoints, const std::vector<float>& zPoints) { void VisualiserComponent::renderScope(const std::vector<float>& xPoints, const std::vector<float>& yPoints, const std::vector<float>& zPoints) {
time += 0.01f;
if (screenType != settings.getScreenType()) { if (screenType != settings.getScreenType()) {
screenType = settings.getScreenType(); screenType = settings.getScreenType();
#if SOSCI_FEATURES #if SOSCI_FEATURES

Wyświetl plik

@ -157,8 +157,6 @@ private:
juce::OpenGLContext openGLContext; juce::OpenGLContext openGLContext;
float time = 0;
juce::Rectangle<int> buttonRow; juce::Rectangle<int> buttonRow;
juce::Rectangle<int> viewportArea; juce::Rectangle<int> viewportArea;

Wyświetl plik

@ -147,6 +147,10 @@
file="Source/visualiser/BlurFragmentShader.glsl"/> file="Source/visualiser/BlurFragmentShader.glsl"/>
<FILE id="Fimn0E" name="BlurVertexShader.glsl" compile="0" resource="0" <FILE id="Fimn0E" name="BlurVertexShader.glsl" compile="0" resource="0"
file="Source/visualiser/BlurVertexShader.glsl"/> file="Source/visualiser/BlurVertexShader.glsl"/>
<FILE id="ahlSbF" name="GlowFragmentShader.glsl" compile="0" resource="0"
file="Source/visualiser/GlowFragmentShader.glsl"/>
<FILE id="yKcFST" name="GlowVertexShader.glsl" compile="0" resource="0"
file="Source/visualiser/GlowVertexShader.glsl"/>
<FILE id="R6Yr8V" name="LineFragmentShader.glsl" compile="0" resource="0" <FILE id="R6Yr8V" name="LineFragmentShader.glsl" compile="0" resource="0"
file="Source/visualiser/LineFragmentShader.glsl"/> file="Source/visualiser/LineFragmentShader.glsl"/>
<FILE id="aK7kZN" name="LineVertexShader.glsl" compile="0" resource="0" <FILE id="aK7kZN" name="LineVertexShader.glsl" compile="0" resource="0"