XNA UK User Group

A helping hand for bedroom coders throughout the land.
in

RandomChaos

Generic XNA - Ocean II

"Water, Water everywhere and not a drop to drink..."

http://www.youtube.com/v/dp1wC53S4XA <p><a href="http://www.youtube.com/v/dp1wC53S4XA">http://www.youtube.com/v/dp1wC53S4XA</a></p>

Yes more water. This is the fix to my original Ocean class. I found a fair few errors in the class, the shader was fine, just me as usual. As you can see the performance is better and is comparable with Anirudh S Shastry's shader I posted last time.

Not much else to add so you can locate the solution here.

Comments

 

GameDevKicks.com said:

You've been kicked (a good thing) - Trackback from GameDevKicks.com

May 5, 2008 10:23 PM
 

brainziziz said:

Hi! I must tell you the performance boost is very arguable... In fact, I think there is a considerable performance drop. Try scaling it up a bit, like 1024, 1, 1024... Then reset the scale and put Width and Height to 1024x1024... Then do the same with the first shader....

May 10, 2008 4:40 PM
 

Nemo Krad said:

Well my test was with the system I have posted, I have not done any extensive perf testing with the two methods.

Thanks for taking the time to check it out.

May 12, 2008 8:53 AM
 

Steven Linton said:

Hi,

I really like this shader. I used an earlier version and it would crash out my XBox, this one doesn't.

I was wondering if there is an easy way for me to make the water semi-transparent?

Cheers.

ps. Still eagerly awaiting the cloud volume example code :)

May 15, 2008 12:22 PM
 

Nemo Krad said:

The shader it's self is unchanged from the previous post, it's the Ocean class that has been fixed.

I also got the 360 crash when I played it on my XBox, I did fix it at the time, but never got around to posting it.

 If you look at the old version in the Draw method there is the method to make the water transparent.

My CC account has ran out now so I can't test my samples on the 360, so it's good to know this version is fine on the 360 thanks :)

The cloud system I have some performance issues with at the moment, but it may just be my crappy GCard now that I have moved the shader over to use alphas. I am a bit stumped as to why I am getting the perf hit so might end up posting the system anyway and see if the community can help improve it.

May 15, 2008 12:41 PM
 

JohnK said:

Hello Nemo! Thanks for sample, it's awesome. But i have some bug, when adding another game component. ( like fps counter )

So, here, ru.ziggyware.com/.../oceanii.zip

If you comment  this:

SkyBox sb = new SkyBox(this, "Models/skybox", "Shaders/skybox", skyBoxTexture);

Components.Add(sb);

- you will see the uncorrect waves. How to fix that? Thank you!

May 19, 2008 1:54 PM
 

Nemo Krad said:

Thanks for posting this up. I know exactly what the issue is as I have had it with other samples I have written once I have started to use them with other things.

When I start writing a sample there is nothing else in the scene, I add a skybox (note in the shaders the first few elements of the vert struct a the same) and all looks well, until you do something like this. The fundamental error I am making is leaving my Vertex declaration in the LoadContent of the OceanII class, if you move this to the top of the Draw call it should work fine then.

The reason why the sky box makes it all work is that it is setting the vertex declaration and the vert structure is similar and so the shader (by luck) behaves. But when you remove it or put another object before and/or after it in the draw sequence, then you get odd things happening.

This may be an issue with other samples of mine to. I wont fix them as I intend to put them all together into some sort of engine, that way I will find all the issues like this and with any luck have a nice working engine.

Hope this helps,

See you on IRC ;P

May 19, 2008 2:25 PM

Leave a Comment

(required)  
(optional)
(required)  
Add

About Nemo Krad

Have been a professional developer since 1995. My skill set ranges from C/C++, VB6,MSSQL, Java Script, VB Script, HTML/ASP, Java, C#, ASP.NET as well as others. I started 3D and games development when the first release of XNA came out in December 2006 and have become addicted to it.