Hi,
If you’ve been following my other thread ‘Developing Landscape’:
http://blenderartists.org/forum/showthread.php?t=152260
you’ll know that I’ve been experimenting with stencil maps and multiple textures.
For my environment, I created a pretty good ocean shader, which I am now making available to the community.
It uses three GLSL shaders and a stencil map.
Here is a screen shot:
You can download the complete blend file here:
http://www.mediafire.com/?ogqo0lrirnc
*** THIS HAS NOW BEEN UPDATED TO VERSION 1.1
The Version 1.1 file is here:
http://www.mediafire.com/?hwvg2ih3kyn
To change the position of the surface layer of sea foam, you just paint on to the stencil map.
It’s cool because you’re actually painting an animated shader - not just a flat texture.
Enjoy,
Journeyman
Attachments
Mr_Smith
(Mr. Smith)
April 7, 2009, 10:11am
2
That is some really nice work!
John_tgh
(John_tgh)
April 7, 2009, 10:34am
3
That’s just F****** awesome! Good man!
DanZMan
(DanZMan)
April 7, 2009, 10:49am
4
Pretty good! One thing is the foam shader doesn’t compile correctly because the last line your are assigning a float “color.a” to a vec4 “stencil.” Also, seeing as your only using one value of the stencil map, you could simply change the last lines to this:
float stencil = texture2D(stencilMap, gl_TexCoord[0].st).r;
color.a = stencil;
gl_FragColor = color;
This fixes the problem and saves some memory.
Anyway, pretty neat. I like your use of UV coordinates to simulate refraction the best. For a minute there I almost thought you had figured out how to do realtime refraction. Looking forward to seeing more!
Do you plan on including lighting calculations in your shaders?
it looks so nice, maybe a Chromatic aberration to the water would give this kind of crysis look
Doggie_B
(Doggie_B)
April 7, 2009, 9:56pm
6
You’re my hero! I was looking for this for ages!
Thanks!
Dazman - well spotted… I will update my code.
I would cool if people could post the frame rates they are getting with these shaders.
I’m getting 60fps when minimised and around 25fps in full screen.
Cheers,
Journeyman
i did a quick testrun and it looks great!
full screen (1920x1200) with dual socket xeon mobo (2xquad core): 60fps
minimised … the same
Mr_Smith
(Mr. Smith)
April 9, 2009, 5:19am
9
It runs perfectly 60 fps on my system.
However I have some problems trying to implement the refraction shader
into my game. Can you post a little tutorial on impementing the shader into
a game, starting from the ground up. :o I’m not good at coding shaders.
Mr Smith…
The easiest way to integrate the Ocean Shader with your own project is as follows:
Goto File | Append or Link
Navigate to the OceanShader.blend
Select ‘Group’
Select ‘Ocean’ then ‘Load Library’
This should load everything including the shaders.
If I can find the time today, I’ll do a longer tutorial.
Cheers,
Journeyman
Mr_Smith
(Mr. Smith)
April 9, 2009, 11:01am
11
Thanks for the response, but linking the file isn’t really possible
in my case. So I would really appreciate if you could pst a longer tutorial. :yes:
I run it at 125 FPS consistantly. Great job!
peace,
-nick
Awesome work, but how do I make it larger? Scaling normally stretches the textures.
I think I’ll do a little version update, which includes a ‘large area’ example of the shader. The current shader only covers a small area - like a cove or inlet.
I might do a small video tutorial also.
Stay tuned!
From
Journeyman
Okay!
Here’s a small update, which includes a larger area sea.
The Version 1.1 file is here:
MediaFire is a simple to use free service that lets you put all your photos, documents, music, and video in a single place so you can access them anywhere and share them everywhere.
With larger areas, you sometimes see flickering on the horizon, so you need to use Blenders Mist settings to minimize any unwanted artifacts.
I’ve updated the script files also.
There are only two variables you can really play with:
‘speedofwarp’ and ‘sizeofwarp’
which control the amount of distortion and the speed respectively.
If you need to change the scale of the geometry, you will need to scale the UV coordinates by the same amount to maintain the look of the shader.
Enjoy!
Journeyman
Doggie_B
(Doggie_B)
April 11, 2009, 6:31am
16
Allright! I will use this in my next game for sure.
set the size of warping to 1 and the speed of warping to 100 and you get some crazy stuff lol
Benny_Flex
(Benny_Flex)
September 1, 2009, 8:46am
18
From what i saw the rocky textures looks better than the vegetation, maybe it lacks alpha and randomness.
Too bad you don’t want to make it a full game!
thanks journeyman17 for the file, very interesting since i dream for a long time to build a surf game with blender… I m going to study it!
polyman
(polyman)
September 2, 2009, 2:00pm
19
i get 60 fps regularly on my laptop with a crappy ati card- greeat work!!!
Super man great wat a blend. Dear can u give any tutorial for real time reflection or the ocen shader u used or done on yourself