Wednesday, July 06, 2011

Underwater Screenshots

Still needs lots of tweaking but it's a start :]

The deeper you go, the less you can see away from you.  I need to simulate some particles in the water or something but I think that's something I have to do with the shader.

Ocean Water!

Thanks to the guys at the SA forums, I was able to figure out my issue.  Here's what they told me:

You probably have depth write enabled. If that's the case, it'll appear translucent if it's drawn after the geometry below it, but opaque if it's drawn before because it'll block anything behind it from being drawn.


... for which the solution is to draw all your transparent things last, and, if there's more than one transparent thing that might overlap, draw them in order from far to near.

After putting that fix in it all looks good now :]

Ocean Water?

Looks like crap but it's a start.  I'm having an issue with transparent textures on the ocean water cubes.  It's causing the cubes below it to render really weird.  Don't have time to research it tonight though so I'll check it out tomorrow.

Tuesday, July 05, 2011

Monday, July 04, 2011

More Water Screenshots

Updated the way water works.  I think I'm happy with it now.  So far my logic is like so:

if the water level > 0
 if there's a cube below
  if there's no cube behind
   add water behind
  if there's no cube in front
   add water in frnot
  if there's no cube to the left
   add water to the left
  if there's no cube to the right
   add water to the right
  add water below

If we're adding water below us, we add the water with the same amount of level as before.  If we're adding water anywhere else, we lower its level by 5 so it's not infinite.  The only time it can be infinite is if it were to keep going down nonstop.  Since we have a hard lower limit (higher is infinite still), we're guaranteed to always have some kind of hard stop.

I still haven't found a solution for the ocean that doesn't destroy the CPU.  It's pretty fun to toy with this water though so I'm in no hurry.