Sueastside's Blog futuredib Xordan's blog iceeey's blog Introductionary Blog Jwir3's Weblog Jorrit's blog Julian's Blog Pavel Krajcevski's blog OllieBrown res' Blog SamD Claudiu Mihail's blog Mohit's blog Leonardo RD's blog Baribal's Blog Christian's blog RlyDontKnow's blog Antony's blog Naman22's blog

2012-08-05

English (US)   Ocean's Shoreline  -  Categories: GSoC 2012  -  @ 09:59:06 pm

Hey all,
So finally I finished with Shoreline implementation. I know my work should be over by now but I'm happy with new things i'm learning each day. :D. Basically I took a foam texture (programmers art like) and blended it on ocean mesh where ever ocean touches terrain.
This is done by first getting all the points( These points are in world space) where ocean touches terrain and then scale them down to store it in an array. Till now all steps are pre-computed on CPU. That array is now passed to shader program. Now in a vertex program, nearest distance between vexter position and array of foam points is computed and then that distance is passed to fragment program. In fragment program foam Colour is clamped depending on the distance.

Important note:-
I got pretty much everything working with ease except for first step i.e. Getting the foam point.
To get foam points first I got terrain from engine into the water plugin. Then iterated over each terrain cell's height map. Now the thing took me so long was that The coordnate system usually start from bottom left corner so are iteration over cells. But when you are performing texture(heightmap) lookups the coordnates start from top left corner. It took me 7 days to understand this.

This is how it looks like:-

shoreline

Side notes:-
*Array size is limited to 1000 a better way would be to create a texture and store all those points in it and perform a texture lookup in shaders
*This shoreline only works for Terrains. In order for them to work for any mesh, a plan collider can be used to get foam points. Rest of the steps would remain the same.

-Naman Gupta

Trackback (0)

Comments:

No Comments for this post yet...

This post has 83 feedbacks awaiting moderation...

Comments are not allowed from anonymous visitors.

Trackback address for this post:

This is a captcha-picture. It is used to prevent mass-access by robots.
Please enter the characters from the image above. (case insensitive)

Trackbacks:

No Trackbacks for this post yet...

This post has 83 feedbacks awaiting moderation...

Pingbacks:

No Pingbacks for this post yet...

This post has 83 feedbacks awaiting moderation...

powered by
b2evolution

Credits: blog software | web hosting | monetize