Old Film Effect filter

Old Film filter simulate the effect of a classic looking film effect. It’s a port of this shader effect.

This filter is part of ShaderBlow plugin lib.

Features:

  • Allow to set the filter’s color. Default is sepia (ColorRGBA(112f / 255f, 66f / 255f, 20f / 255f, 1.0f)).
  • Allow to set the color’s density. Default is 0.7. Shader clamps this value between 0 to 1. The color image gets grayscale when color’s densite is set to 0.
  • Allow to set the noise’s density. Default is 0.4. Shader clamps this value between 0 to 1.
  • Allow to set the scratches’ density. Default is 0.3. Shader clamps this value between 0 to 1.
  • Allow to set the vignetting’s diameter. Default is 0.9. Shader clamps this value between 0 to 1.4. Vignetting effect is made using two circles. The inner circle represents the region untouched by vignetting. The region between the inner and outer circle represent the area where vignetting starts to take place, which is a gradual fade to black from the inner to outer ring. Any part of the frame outside of the outer ring would be completely black.

NOTE: I chose to clamp this value inside the frag shader code instead of using java code because I thought this way is faster (better from preformace point of view). You can clamp this values using java code if you want.

The following video shows all the features. First I turned off and on the filter. Then I played a little bit with turning down and up color’s density, noise’s density and scratches’ density. Finally I decreased and increased the vignetting diameter.

[video]Old Film Effect Filter for jME - YouTube

Test Case

Hope you like it!

9 Likes

Very nice, good work

Nice stuff, I like that the scratches seem to be procedural (?)

@nehon said: Very nice, good work
Thanks!!
@normen said: Nice stuff, I like that the scratches seem to be procedural (?)
Thanks!! Yes, noise, scratches and vignetting are procedural.

Nice work! =)

This is really cool stuff!

if jME existed in the 50’s, nice!

1 Like

Hey! @H you did really cool filter! I love it a lot!!! Certainly need to use it!
The only feature I would like to see is “animation speed” of noise. At present, speed is hardcoded.

@wezrule said: if jME existed in the 50's, nice!

I think you mean 30’s… otherwise the filter would come with old style red/blue 3d glasses :wink:

@kwando, @t0neg0d and @wezrule,
Thanks!!

@mifth said: Hey! @H you did really cool filter! I love it a lot!!!!! Certainly need to use it! The only feature I would like to see is "animation speed" of noise. At present, speed is hardcoded.
Thanks!! I will take a look but I'm not sure which part of the noise's calculations/formula handles the noise's animation speed. I think noise's animation speed is related with frameRate, I mean it is not part of the calculations.
@H said: @kwando, @t0neg0d and @wezrule, Thanks!!

Thanks!! I will take a look but I’m not sure which part of the noise’s calculations/formula handles the noise’s animation speed. I think noise’s animation speed is related with frameRate, I mean it is not part of the calculations.

I will help you if you don’t find it. Just write here or to my skype if you will need some help. :slight_smile:

@H , I tried to run the filter but had an exception.

LOG:
мар 03, 2013 9:38:44 AM com.jme3.scene.Node attachChild
INFO: Child (BitmapFont) attached to this node (null)
мар 03, 2013 9:38:44 AM com.jme3.scene.Node attachChild
INFO: Child (null) attached to this node (Statistics View)
мар 03, 2013 9:38:44 AM com.jme3.scene.Node attachChild
INFO: Child (Statistics View) attached to this node (Gui Node)
мар 03, 2013 9:38:44 AM com.jme3.scene.Node attachChild
INFO: Child (StatsDarken) attached to this node (Gui Node)
мар 03, 2013 9:38:44 AM com.jme3.scene.Node attachChild
INFO: Child (StatsDarken) attached to this node (Gui Node)
мар 03, 2013 9:38:45 AM com.jme3.material.MaterialDef
INFO: Loaded material definition: ColorScale
мар 03, 2013 9:38:45 AM com.jme3.app.Application handleError
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.IllegalArgumentException: Material parameter is not defined: InnerVignetting
at com.jme3.material.Material.checkSetParam(Material.java:444)
at com.jme3.material.Material.setParam(Material.java:460)
at com.jme3.material.Material.setFloat(Material.java:601)
at com.shaderblow.filter.oldfilm.OldFilmFilter.initFilter(OldFilmFilter.java:152)
at com.jme3.post.Filter.init(Filter.java:234)
at com.jme3.post.FilterPostProcessor.initFilter(FilterPostProcessor.java:168)
at com.jme3.post.FilterPostProcessor.reshape(FilterPostProcessor.java:442)
at com.jme3.post.FilterPostProcessor.initialize(FilterPostProcessor.java:149)
at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:955)
at com.jme3.renderer.RenderManager.render(RenderManager.java:1029)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:252)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:185)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:228)
at java.lang.Thread.run(Thread.java:722)

Excellent. I had already pointed this one out to @sploreg for possible use in AotGB.

@mifth said: @H , I tried to run the filter but had an exception.

LOG:
мар 03, 2013 9:38:44 AM com.jme3.scene.Node attachChild
INFO: Child (BitmapFont) attached to this node (null)
мар 03, 2013 9:38:44 AM com.jme3.scene.Node attachChild
INFO: Child (null) attached to this node (Statistics View)
мар 03, 2013 9:38:44 AM com.jme3.scene.Node attachChild
INFO: Child (Statistics View) attached to this node (Gui Node)
мар 03, 2013 9:38:44 AM com.jme3.scene.Node attachChild
INFO: Child (StatsDarken) attached to this node (Gui Node)
мар 03, 2013 9:38:44 AM com.jme3.scene.Node attachChild
INFO: Child (StatsDarken) attached to this node (Gui Node)
мар 03, 2013 9:38:45 AM com.jme3.material.MaterialDef
INFO: Loaded material definition: ColorScale
мар 03, 2013 9:38:45 AM com.jme3.app.Application handleError
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.IllegalArgumentException: Material parameter is not defined: InnerVignetting
at com.jme3.material.Material.checkSetParam(Material.java:444)
at com.jme3.material.Material.setParam(Material.java:460)
at com.jme3.material.Material.setFloat(Material.java:601)
at com.shaderblow.filter.oldfilm.OldFilmFilter.initFilter(OldFilmFilter.java:152)
at com.jme3.post.Filter.init(Filter.java:234)
at com.jme3.post.FilterPostProcessor.initFilter(FilterPostProcessor.java:168)
at com.jme3.post.FilterPostProcessor.reshape(FilterPostProcessor.java:442)
at com.jme3.post.FilterPostProcessor.initialize(FilterPostProcessor.java:149)
at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:955)
at com.jme3.renderer.RenderManager.render(RenderManager.java:1029)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:252)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:185)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:228)
at java.lang.Thread.run(Thread.java:722)

I’ve ran TestOldFilm class and all have worked fine. Did you run the test or did you try to use the filter on another project?
If you ran the TestOldFilm test, please make sure that you update all the files (shaders, material def, etc).
If you tried on onother project (using shaderblow plugin), please build a test case.

@erlend_sh said: Excellent. I had already pointed this one out to @sploreg for possible use in AotGB.

What does AoTGB mean? just curious XD

@mifth said: @H , I tried to run the filter but had an exception.

According to the LOG, OldFilm.j3md has not defined InnerVignetting param. Can you check that on your code? Please, make sure that you the shaderblow project code up-to-date.

@H said: I've ran TestOldFilm class and all have worked fine. Did you run the test or did you try to use the filter on another project? If you ran the TestOldFilm test, please make sure that you update all the files (shaders, material def, etc). If you tried on onother project (using shaderblow plugin), please build a test case.

Ahh!! It seems i forgot to clean and build the project after updating. Thank you man. :slight_smile:

Hi hi, I was just being super lazy. Should’ve linked that to Attack of the Gelatinous Blob.

Attack of the Gelatinous Blob. RTS based in the 1950’s.

Already got this thread bookmarked :slight_smile:

Hey, thanks for the cool filter!
But it seems like I can only change its propertys by creating a new one, the setter - methods don’t have any effect.
Example:

[java]
OldFilmFilter off = new OldFilmFilter(ColorRGBA.Blue, .5f, .5f, 1, .9f);
off.setFilterColor(ColorRGBA.Yellow);
filterPostProcessor = new FilterPostProcessor(assetManager);
viewPort.addProcessor(filterPostProcessor);
filterPostProcessor.addFilter(off);
[/java]
The filter is still blue.