tag:blogger.com,1999:blog-1023441640234597436.post5580231081199704368..comments2023-09-22T13:25:07.113-04:00Comments on Graphics Runner: Water Game ComponentKyle Haywardhttp://www.blogger.com/profile/00654406875137720609noreply@blogger.comBlogger31125tag:blogger.com,1999:blog-1023441640234597436.post-52227010187803638282012-11-13T15:40:06.870-05:002012-11-13T15:40:06.870-05:00Hi! I could havе sworn I've been to this blog ...Hi! I could havе sworn I've been to this blog before but after reading through some of the post I realized it's new to me.<br />Nonetheleѕs, I'm definitely delighted I found it and I'll be <br />bοokmarking and cheсking baсk frequently!<br /><i>Here is my weblog</i> - <b><a href="http://earnonlinesite.net" rel="nofollow">Earnonlinesite.net</a></b>Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1023441640234597436.post-68797680198363640562012-08-20T04:57:23.327-04:002012-08-20T04:57:23.327-04:00I'd like to add my name to the list of people ...I'd like to add my name to the list of people requesting an XNA 4.0 update - There's a dearth of good water samples right now, and this one looks absolutely amazing!Anne-Lise Paschhttps://www.blogger.com/profile/07599093117281057746noreply@blogger.comtag:blogger.com,1999:blog-1023441640234597436.post-88223922881227446952012-02-07T19:51:35.614-05:002012-02-07T19:51:35.614-05:00I don't at this time. There has been a bit of ...I don't at this time. There has been a bit of interest in it so I think I'll look into it.Kyle Haywardhttps://www.blogger.com/profile/00654406875137720609noreply@blogger.comtag:blogger.com,1999:blog-1023441640234597436.post-36334235596205155692012-02-07T11:21:52.918-05:002012-02-07T11:21:52.918-05:00It's really nice ! There an xna4 version ?It's really nice ! There an xna4 version ?rc183noreply@blogger.comtag:blogger.com,1999:blog-1023441640234597436.post-88511391336164890862011-08-06T14:28:40.680-04:002011-08-06T14:28:40.680-04:00I love this. However, it doesn't work with th...I love this. However, it doesn't work with the XNA 4.0 version. :( Is there any way we could get a port uploaded? Or what should I use toAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-1023441640234597436.post-19388742884095822762011-07-27T18:27:21.824-04:002011-07-27T18:27:21.824-04:00Thanks for sharing this water gale component, it l...Thanks for sharing this water gale component, it looks very nice. Did you have a visual studio 2010 version?<br /><br />Thanks :)Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1023441640234597436.post-83626576988472665742010-10-27T13:25:38.958-04:002010-10-27T13:25:38.958-04:00its a great jobits a great jobBazookaohttps://www.blogger.com/profile/08688048442976726674noreply@blogger.comtag:blogger.com,1999:blog-1023441640234597436.post-22570979870820180672010-06-14T16:16:52.630-04:002010-06-14T16:16:52.630-04:00:) Looks cool.
You're right, the best solutio...:) Looks cool.<br /><br />You're right, the best solution is to provide an axis. My intent was to make the code as readable and simple as possible. However, maybe I should have been a bit more generic :)Kyle Haywardhttps://www.blogger.com/profile/00654406875137720609noreply@blogger.comtag:blogger.com,1999:blog-1023441640234597436.post-56158124758524050092010-06-13T15:28:53.506-04:002010-06-13T15:28:53.506-04:00Hi Kyle - thanks a lot for making this available. ...Hi Kyle - thanks a lot for making this available. I had a bit of trouble with it initially, as my game uses the Z axis as Up instead of Y.<br /><br />Setting the World matrix of the water mostly worked, but there were a couple of places in the code and the shader where you did a Y axis check for above/below water. Once I changed this to Z, everything was fine. Probably a better thing to do would be to do an actual axis check so that it would work for any transform.<br /><br />Other than that, it was super-easy to integrate and looks great! If you are interested, you can see some shots of my game <a href="http://blog.nostatic.org/2010/06/avatar-pinball.html" rel="nofollow">here</a>.Mikehttps://www.blogger.com/profile/13599208082890099005noreply@blogger.comtag:blogger.com,1999:blog-1023441640234597436.post-20615036966814083482010-03-10T02:14:56.975-05:002010-03-10T02:14:56.975-05:00I'm unsure of your question.
water.fx is an e...I'm unsure of your question.<br /><br />water.fx is an effect file with hlsl shaders inside.<br /><br />wave0.dds is a DDS texture with a wave-like normal map inside.Kyle Haywardhttps://www.blogger.com/profile/00654406875137720609noreply@blogger.comtag:blogger.com,1999:blog-1023441640234597436.post-76699613944517263772010-03-08T10:30:43.537-05:002010-03-08T10:30:43.537-05:00hey kyle, i'm new to the XNA enviroment, can y...hey kyle, i'm new to the XNA enviroment, can you tell me how you get the wave0.dds and water.fx. do i need a software to do this? thksAlvinnoreply@blogger.comtag:blogger.com,1999:blog-1023441640234597436.post-41553557928983412402009-11-24T20:23:41.336-05:002009-11-24T20:23:41.336-05:00Is this still active because i have a problem with...Is this still active because i have a problem with the reflection not rendering my sky at all.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1023441640234597436.post-14019222477968554902009-09-24T05:26:56.436-04:002009-09-24T05:26:56.436-04:00:) thank you! :):) thank you! :)Chrishttps://www.blogger.com/profile/14911562490589992197noreply@blogger.comtag:blogger.com,1999:blog-1023441640234597436.post-68204411506204619772009-09-23T20:13:50.398-04:002009-09-23T20:13:50.398-04:00Yes the reason is because in the demo, I didn'...Yes the reason is because in the demo, I didn't clip the refracted objects to the water plane. Usually this isn't too important, and most games don't do a refraction pass anyway (they just render the scene to a texture and use it).<br /><br />So you need to setup a clip plane similar to the reflection rendering.<br /><br />I've updated the demo to use a clip plane for the refracted objects.Kyle Haywardhttps://www.blogger.com/profile/00654406875137720609noreply@blogger.comtag:blogger.com,1999:blog-1023441640234597436.post-81549288509193377482009-09-23T17:53:52.545-04:002009-09-23T17:53:52.545-04:00Hello,
great-looking sample :) it helped me a lot...Hello,<br /><br />great-looking sample :) it helped me a lot with my water surface.<br /><br />A small question though:<br /><br />A pillar in your sample shows refraction along its silhouette in areas which are not submerged.<br />Are you sure it should be like that? <br /><br />I have a lot more and smaller objects in my game which are partially or not at all submerged and they still appear refracted completely on the water surface.<br /><br />To fix it I guess I will have to draw the refraction map only with submerged vertices or check the vertices or pixel positions in the shader.<br /><br />Please let me know what you think. Maybe I am completely wrong!<br /><br />Thanks,<br />ChristianChrishttps://www.blogger.com/profile/14911562490589992197noreply@blogger.comtag:blogger.com,1999:blog-1023441640234597436.post-26003257781023114102009-09-19T05:41:44.742-04:002009-09-19T05:41:44.742-04:00Of course you and anyone else that wants the shaer...Of course you and anyone else that wants the shaers will be able to get them at https://sourceforge.net/projects/gamedevstoolbox , there is nothing posted at the moment because I want to get something working together first but i'll send you a message on msn when I mod your component with the full source.LewisCowleshttps://www.blogger.com/profile/09854232531620764095noreply@blogger.comtag:blogger.com,1999:blog-1023441640234597436.post-59532856298469031422009-09-18T18:03:31.185-04:002009-09-18T18:03:31.185-04:00Go ahead! I'd like to see your lava and dirty ...Go ahead! I'd like to see your lava and dirty water effects! :)Kyle Haywardhttps://www.blogger.com/profile/00654406875137720609noreply@blogger.comtag:blogger.com,1999:blog-1023441640234597436.post-29719440836675592972009-09-18T13:20:00.439-04:002009-09-18T13:20:00.439-04:00Hi, I'm building a World Class with different ...Hi, I'm building a World Class with different Camera and Terrain Classes, Can I use your Code "with full credits to you" and produce other modified effects like lavaflow(pure refraction) and dirty water etc???LewisCowleshttps://www.blogger.com/profile/09854232531620764095noreply@blogger.comtag:blogger.com,1999:blog-1023441640234597436.post-89421762780493109562009-04-02T05:42:00.000-04:002009-04-02T05:42:00.000-04:00Thanks, thats great, it really helps to clear thin...Thanks, thats great, it really helps to clear things up for me.<BR/><BR/>Thanks Again,<BR/>ArThorArThornoreply@blogger.comtag:blogger.com,1999:blog-1023441640234597436.post-86570131213941852162009-04-01T20:07:00.000-04:002009-04-01T20:07:00.000-04:00Sure :)The Fresnel effect is the observance that t...Sure :)<BR/><BR/>The Fresnel effect is the observance that the amount of reflectance you see on a surface depends on the viewing angle. When the angle is small there is high reflectance, when the angle is large (like when you're looking down into the water), the reflectance is low.<BR/><BR/>The Fresnel term is calculated to blend between reflection and refraction.<BR/><BR/>The equation for the fresnel term is:<BR/><BR/>F = R_0 + (1 - R_0) + (1 - theta)^5<BR/><BR/>where,<BR/><BR/>R_0 = (1 - R_i)^2 / (1 + R_i)^2<BR/><BR/>where, R_i is the refractive index. The refractive index for clear water is 1.3333f. So we precompute R_0 and it is declared at the top of the shader.<BR/><BR/>Also, once the Fresnel term is calculated, I also add in reflectance based on the height of the camera. Here, .007f is just some arbitrary value I chose that produced pretty good visual results. This makes sure that the water slowly turns to total reflection as the camera height rises. <BR/><BR/>Finally, we make sure that the final fresnel value is not greater than 1 by taking the min() value.<BR/><BR/>Hope that helps :)Kyle Haywardhttps://www.blogger.com/profile/00654406875137720609noreply@blogger.comtag:blogger.com,1999:blog-1023441640234597436.post-61704797194085992262009-04-01T05:06:00.000-04:002009-04-01T05:06:00.000-04:00I know its bee a few months, but if u possible cou...I know its bee a few months, but if u possible could you explain a bit more how you calculate the amount of reflection and refraction to use?<BR/><BR/>//compute the fresnel term to blend reflection and refraction mapsfloat ang = saturate(dot(-toEyeW,n1));float f = R0 + (1.0f-R0) * pow(1.0f-ang,5.0);//also blend based on distancef = min(1.0f, f + 0.007f * EyePos.y);ArThornoreply@blogger.comtag:blogger.com,1999:blog-1023441640234597436.post-48193049500295784852008-12-02T21:16:00.000-05:002008-12-02T21:16:00.000-05:00Glad it helped. And thanks for the comments :)I do...Glad it helped. And thanks for the comments :)<BR/><BR/>I do get the feeling that quite a few people use drawable game components. I've tried to stay away from them in the past articles since it facilitates copying and pasting of code; and not facilitating understanding of what's going on. On the other hand they do allow more easy integration and community sharing of code/methods <I>because</I> they are pluggable. Maybe I will start to use them more often.<BR/><BR/>I've had quite a few requests to put the water effect into a drawable game component, and Ziggy and the Xna blog picked up the post within a few days of me posting it(even though I had this in my camera animation tutorials for months).Kyle Haywardhttps://www.blogger.com/profile/00654406875137720609noreply@blogger.comtag:blogger.com,1999:blog-1023441640234597436.post-52701441347278629212008-12-02T20:54:00.000-05:002008-12-02T20:54:00.000-05:00Thanks a ton Kyle!I was having trouble setting upt...Thanks a ton Kyle!<BR/><BR/>I was having trouble setting upthe "DrawObjects" function in that I wasn't sure how to pull out DrawableGameComponents from the component collection as meshes. Makes sense now though. Thanks for sharing your knowledge. I appreciate it. Your blog is chocked full of good stuff.<BR/><BR/>I really like this GameComponent design strategy, it really keeps your code clean and organized and makes for extremely re-usable and adaptable components.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1023441640234597436.post-39378875044861679912008-11-30T15:59:00.000-05:002008-11-30T15:59:00.000-05:00Sure I can do that. I'll post it in a day or two.K...Sure I can do that. I'll post it in a day or two.<BR/><BR/><BR/>KyleKyle Haywardhttps://www.blogger.com/profile/00654406875137720609noreply@blogger.comtag:blogger.com,1999:blog-1023441640234597436.post-24004939194865814582008-11-29T14:00:00.000-05:002008-11-29T14:00:00.000-05:00I've been intrigued into using this as a GameCompo...I've been intrigued into using this as a GameComponent in my project, but i'm having a hard time having it render. Anyway you could possibly spare some time to throw it in a super simple project to show how its used as a GameComponent? The simpler the better. Thanks!Anonymousnoreply@blogger.com