Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Water Shader Help

Author
Message
david w
20
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 30th Jul 2014 02:06 Edited at: 30th Jul 2014 02:08
I've been working on a water shader and I've basically am trying to modify evolved's original water shader with one that I found on here that does "waves" in the vertex shader portion

Shader code



Now everything works fine except that when you introduce the waves that planar reflections do no follow the waves as I believe they should.

Now there relevant portion of code is:

float3 Reflection=tex2Dproj(WaterReflect,input.ReflProj+Distort); //*ReflectColor;

//float2 projcoord=(input.ReflProj.xy / input.ReflProj.z);

//float3 Reflection=tex2D(WaterReflect,projcoord+Distort);

Now it is my understanding that both tex2Dproj and tex2D with the calculated projected textcoords do the same exact thing. You get the nice reflection on a flat surface. I also thought this would get the reflction to follow the wave such as in this sample


http://gamedev.stackexchange.com/questions/61113/accounting-for-waves-when-doing-planar-reflections

So I guess there is two parts to this question

1: how do you account for vertex "waves" while doing planar reflections

2: How to you calculate "foam" at the shore line and on the edge of waves?

I know question 2 is probably the easier to answer but each time I try to use the alpha value for based on the "depth" then I get a sharp cut-off and or it tiles across the entire water surface

here is a link for the "foam" I would like to achieve

http://www.garagegames.com/community/forums/viewthread/124292/2

Any help on these two questions would be amazing because I've been banging my head for days.

I can build a project example if anyone needs it.

thank you
david w
20
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 2nd Aug 2014 19:53
Nobody? Well I guess I'll keep trying to get it down. I have a few ideas still left to try. I'll post any results I get. Thank you

Login to post a reply

Server time is: 2026-07-06 13:43:55
Your offset time is: 2026-07-06 13:43:55