| Author | Topics » Book an abo for this thread |  |
3Nitro

Status:Offline Date registered: 23.10.2009 Post:3 Send Message | Created on 23.10.2009 - 06:43 |  |
Hi, can anyone make shader that add noise effect (Film grain) like in silent hill 2 or etc?
Or where I can find some info about writing shaders for this plugin?
And one more question) Is there way to combine 2 or more shader effects?
|
|
|
KrossX Strong supporter
 

Status:Offline Date registered: 16.06.2008 Post:90 Send Message | Created on 07.11.2009 - 23:54 |  |
From This Thread on the ePSXe's forum, you might want to check the following to know more about Shaders:
Shaders @ Wiki | Guide to Shaders
About a "noise" shader. This is what I was able to do. Is not animated and it flickers sometimes... but, it's something. XD
gpuPeteOGL2.slv
| Code: | | 1: | | 2: | | 3: | | 4: | | 5: | | 6: | | 7: | | 8: | | | | uniform vec4 OGL2Param;
|
| void main()
| {
| gl_Position = ftransform();
| gl_TexCoord[0].xy = gl_MultiTexCoord0.xy;
| }
| | |
gpuPeteOGL2.slf
| Code: | | 1: | | 2: | | 3: | | 4: | | 5: | | 6: | | 7: | | 8: | | 9: | | 10: | | 11: | | 12: | | 13: | | 14: | | 15: | | 16: | | 17: | | 18: | | | | uniform sampler2D OGL2Texture;
| uniform vec4 OGL2Param;
|
| void main()
| {
| vec2 constant1 = vec2( 142.0/11.0, 1017.0/13.0 );
| float constant2 = 481344.0/11.0;
|
| vec3 final = texture(OGL2Texture, gl_TexCoord[0].xy).xyz;
| float noise = fract( sin( dot( gl_TexCoord[0].xy, constant1 )) * constant2);
|
| // Color correction 16-235
| final = final * 1.16438356 - 0.07305936;
|
| gl_FragColor.xyz = mix(final, noise, OGL2Param.z * 0.15);
|
| }
| | |
#EDIT: Cleaned it up a bit.
[Dieser Beitrag wurde am 15.11.2009 - 23:08 von KrossX aktualisiert]
Signature
 |
3Nitro

Status:Offline Date registered: 23.10.2009 Post:3 Send Message | Created on 15.11.2009 - 19:15 |  |
Thx KrossX, but it's still too difficult for me to write shaders.
About you noise filter, it's flicking all the time, but that is better then nothing, thank you.
Also I find game/demoscene called Ruinas 2.0
http://blenderartists.org/forum/showpos … ostcount=4
Maybe you can extract noise shader from it?
Game created with Blender, and contain project '*.blend' files. So you can just open it with Blender.
|
KrossX Strong supporter
 

Status:Offline Date registered: 16.06.2008 Post:90 Send Message | Created on 15.11.2009 - 21:49 |  |
I'll see if I can stop the flickering. But I would need some constantly changing value to animate it, like "time". Sadly, I don't know of such thing on Pete's OGL2. =S
Also, the noise function was taken from here: Lumina - Noise
#EDIT: Cannot get rid of the flickering at all. =_="
[Dieser Beitrag wurde am 15.11.2009 - 23:06 von KrossX aktualisiert]
Signature
 |
3Nitro

Status:Offline Date registered: 23.10.2009 Post:3 Send Message | Created on 16.11.2009 - 11:29 |  |
So it means that plugin is compiling shader code, some functions are not realized and cant be included?
Maybe you can get random val. from the each frame (color of some pixel, overall luminance or something else)? Then when frame changed noise will refresh. Or that's impossible too?
|
KrossX Strong supporter
 

Status:Offline Date registered: 16.06.2008 Post:90 Send Message | Created on 16.11.2009 - 14:30 |  |
Well, custom variables must be provided prior shader. That is, from the plugin in this case. For example, the OGLParam, that has information like shader level selected.
I did try to base the noise on the image itself. The outcome was some kind of "animated" noise... but where and when the image actually changed, so it looked ugly. =S
There are noise functions on GLSL, but I have no idea on how to use them. That is, I always get no result from them. >_<
Anyhow, I've just merely attemped to mess with shaders. I still don't know what each thing does, nor what can the plugin provide. T_T
#EDIT: Perhaps using an external noise texture? At least it wouldn't flicker I think. Or perhaps, use external textures to get values and animate the noise... I dunno how can that be done... >_<
[Dieser Beitrag wurde am 16.11.2009 - 14:42 von KrossX aktualisiert]
Signature
 |