[Discussion] Film Grain, Converting to C2

Share your Construct 2 effect files

Post » Wed Aug 26, 2015 1:01 pm

Hi all,

I've been away from all this for a while and alhough I have ideas swimming around, I'm usually too busy to work on much. I revisited an old project a few days ago and have been playing with various effects to give things a certain look - I had left the 'noise' effect on the layout and although it works nicely I was wondering if there might be a way to implement a more accurate 'film grain' style effect.

There is already a great shader available here http://devlog-martinsh.blogspot.fi/2013/05/image-imperfections-and-film-grain-post.html (or for the code, see here https://dl.dropboxusercontent.com/u/11542084/FilmGrain_v1.1 ) that I have been trying to convert over to c2 but naturally, nothing is working as expected. I'm at work currently and can't access the code I had been modifying, but I wanted to check I wasn't just hitting c2 limitations as I was getting constant errors - seemingly with the initial declaration of variables, and the c2 effect template was a bit confusing (I also found that there is an additional parameter in the stock c2 effects such as noise that doesn't appear in the effect template XML file - to do with opacity I think). I keep having it crash complaining about a syntax error with 'mediump' - there are a lot of vaiables in there and I'm not sure how it handles things.

Does every float need to be explicitly assigned a precision? I tried precision mediump float at the beginning but no luck. Is there a way to get the game's X and Y resolution, as it seems to be relevant in this shader? Can C2 handle multiple functions in the shader outside of the main function call? Forgive me if anything is obvious but I just want to avoid wasting time if I won't be able to get it working!

EDIT I also removed the code relating to coloured noise as I wanted to keep it monochrome, I thought it may speed things up slightly

Cheers
B
15
S
6
G
6
Posts: 103
Reputation: 2,968

Post » Mon Aug 31, 2015 4:05 pm

A proper film grain would be great. If you could get this working I would love to try it out.
The noise filter bundled with C2 looks okay, but it's not quite film grain quality.
Be sure to check out my Metroidvania game, A Hole in the Earth
B
59
S
24
G
3
Posts: 359
Reputation: 5,683

Post » Tue Sep 01, 2015 8:43 am

Working on it... Not had any fedback on here as to the way c2 works so I'm just working blind at the moment. I don't have a lot of time at the moment and life is getting to me, but I managed to get it working in shadertoy at the weekend (took til 4am though) so now I understand it better it should be (hopefully) easier to port to c2. Will keep you posted.
B
15
S
6
G
6
Posts: 103
Reputation: 2,968

Post » Tue Sep 01, 2015 8:46 pm

@untune

I had a look at your 'FilmGrain_v1.1' file...way too complicated for my brain.

The best I can come up with is this basic noise/image mix effect-

Image

I will play around with the sums to see if i can improve it.

Its a start?.

https://dl.dropboxusercontent.com/u/22173473/filmgrainrequest.rar


P.S
' I don't have a lot of time at the moment and life is getting to me'

Its only a shader :)
B
21
S
6
G
8
Posts: 1,215
Reputation: 7,881

Post » Wed Sep 02, 2015 9:52 pm

chrisbrobs wrote:@untune

I had a look at your 'FilmGrain_v1.1' file...way too complicated for my brain.

The best I can come up with is this basic noise/image mix effect-

Image

I will play around with the sums to see if i can improve it.

Its a start?.

https://dl.dropboxusercontent.com/u/22173473/filmgrainrequest.rar



Thanks, I'll have a look at this tomorrow :)

chrisbrobs wrote:P.S
' I don't have a lot of time at the moment and life is getting to me'

Its only a shader :)


Haha yes I know, it's just been a very tough week! Getting better though :) I've got a much better understanding of the code now so it should be easier to convert as long as a few things are possible with C2...
B
15
S
6
G
6
Posts: 103
Reputation: 2,968

Post » Fri Sep 04, 2015 6:13 pm

I dont want to disturb you and chrisbrobs

Here is a quick port of this shader from your source ...

Tell me if it's ok .. i have not added grain amount a,d other parameters just converted it.
Here is a demo like i love :) : http://gigatron3k.free.fr/html5/C2/FX/fgrain/
http://gigatron3k.free.fr/Intro/

https://www.shadertoy.com/user/gigatron

https://twitter.com/realistquantum

Ezekiel 1-4 ; ufo landing explanation ..

CONSTRUCT 2 THE ONLY FAST WAY TO HTML5

Image
B
61
S
21
G
29
Posts: 821
Reputation: 22,205

Post » Sat Sep 05, 2015 1:16 pm

Gigatron wrote:I dont want to disturb you and chrisbrobs

Here is a quick port of this shader from your source ...

Tell me if it's ok .. i have not added grain amount a,d other parameters just converted it.
Here is a demo like i love :) : http://gigatron3k.free.fr/html5/C2/FX/fgrain/


Nicely done gigatron! I did finally get this working a few nights ago but I've not been well the last couple of days and haven't had the chance to clean up the code etc
B
15
S
6
G
6
Posts: 103
Reputation: 2,968

Post » Sat Sep 05, 2015 1:35 pm

So , no need for me to finalize this shader fx ?
http://gigatron3k.free.fr/Intro/

https://www.shadertoy.com/user/gigatron

https://twitter.com/realistquantum

Ezekiel 1-4 ; ufo landing explanation ..

CONSTRUCT 2 THE ONLY FAST WAY TO HTML5

Image
B
61
S
21
G
29
Posts: 821
Reputation: 22,205


Return to Effects

Who is online

Users browsing this forum: No registered users and 1 guest