Skip to content

Commit

Permalink
Noise effect removed due to similar implementation to film grain.
Browse files Browse the repository at this point in the history
  • Loading branch information
metaphore committed Sep 28, 2019
1 parent 3a15f6e commit 9ce2c93
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 135 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ public void onViewCreated(Group sceneRoot) {
// Film Grain
{
FilmGrainEffect filter = new FilmGrainEffect();
filter.setNoiseAmount(0.18f);
effectsRoster.add(new EffectEntryModel("Film Grain", filter));
}
// Motion Blur (MIX)
Expand All @@ -128,11 +129,6 @@ public void onViewCreated(Group sceneRoot) {
MotionBlurEffect filter = new MotionBlurEffect(Pixmap.Format.RGBA8888, MixEffect.Method.MAX, 0.75f);
effectsRoster.add(new EffectEntryModel("Motion Blur (MAX)", filter));
}
// Noise
{
NoiseEffect filter = new NoiseEffect(0.35f, 2f);
effectsRoster.add(new EffectEntryModel("Noise", filter));
}
// Old TV
{
OldTvEffect filter = new OldTvEffect();
Expand Down
7 changes: 4 additions & 3 deletions gdx-vfx/effects/assets/shaders/film-grain.frag
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,18 @@
#define PRECISION
#endif

const float NOISE_AMOUNT = 0.18;
uniform sampler2D u_texture0;

varying vec2 v_texCoords;
uniform sampler2D u_texture0;

uniform float u_seed;
uniform float u_noiseAmount;

void main() {
vec2 uv = v_texCoords;
vec4 color = texture2D(u_texture0, v_texCoords);

float n = fract(sin(dot(uv, vec2(u_seed + 12.9898, 78.233))) * 43758.5453);
color *= (1.0 - NOISE_AMOUNT + n * NOISE_AMOUNT) * 1.1;
color.rgb *= (1.0 - u_noiseAmount + n * u_noiseAmount) * 1.1;
gl_FragColor = color;
}
39 changes: 0 additions & 39 deletions gdx-vfx/effects/assets/shaders/noise.frag

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<extend-configuration-property name="gdx.files.classpath" value="shaders/levels.frag" />
<extend-configuration-property name="gdx.files.classpath" value="shaders/mix.frag" />
<extend-configuration-property name="gdx.files.classpath" value="shaders/nfaa.frag" />
<extend-configuration-property name="gdx.files.classpath" value="shaders/noise.frag" />
<extend-configuration-property name="gdx.files.classpath" value="shaders/old-tv.frag" />
<extend-configuration-property name="gdx.files.classpath" value="shaders/radial-blur.frag" />
<extend-configuration-property name="gdx.files.classpath" value="shaders/radial-blur.vert" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ public class FilmGrainEffect extends ShaderVfxEffect {

private static final String U_TEXTURE0 = "u_texture0";
private static final String U_SEED = "u_seed";
private static final String U_NOISE_AMOUNT = "u_noiseAmount";

private float seed = 0f;
private float noiseAmount = 0.18f;

public FilmGrainEffect() {
super(VfxGLUtils.compileShader(
Expand All @@ -39,6 +41,7 @@ public void rebind () {
program.begin();
program.setUniformi(U_TEXTURE0, TEXTURE_HANDLE0);
program.setUniformf(U_SEED, seed);
program.setUniformf(U_NOISE_AMOUNT, noiseAmount);
program.begin();
}

Expand All @@ -55,6 +58,15 @@ public float getSeed() {

public void setSeed(float seed) {
this.seed = seed;
rebind();
setUniform(U_SEED, seed);
}

public float getNoiseAmount() {
return noiseAmount;
}

public void setNoiseAmount(float noiseAmount) {
this.noiseAmount = noiseAmount;
setUniform(U_NOISE_AMOUNT, noiseAmount);
}
}
86 changes: 0 additions & 86 deletions gdx-vfx/effects/src/com/crashinvaders/vfx/effects/NoiseEffect.java

This file was deleted.

0 comments on commit 9ce2c93

Please sign in to comment.