State of Fortune

Just a quick update:

  1. Improved the performance of the engine, especially the water that is changed a lot, for example showing the sandy bottom when it isn’t deep.
  2. You now start with some seeds. Seeds can be used to plant wheat (for now) on fertile land.
  3. You can make fertile land (not really liking the way it is done at the moment, will see how it ends up).
  4. You can harvest the wheat once it grew.

Main bulletpoints before I release a first version:

  • Sell wheat
  • Buy seeds
  • A title screen where you can choose which server you want to connect to, the playground or the game
  • Create more spawn points when the land around one is starting get sold out
  • Add some arrows to guide you to the closest spawn point and the selected plot
  • Bug fixes of things I noticed while testing

I’m still hoping to be done with a first version of the game part somewhere next month. :slight_smile:

And just to show some progress, the new water:

http://stateoffortune.com/pictures/screenshots/game.png

Mike

Looks great!
I think it looks nicer if you interpolate the water from very visible bottom, to no visible bottom.
This way the seam between water and land will be gone.

I really hope your done soon :smiley:

Looks great!
I think it looks nicer if you interpolate the water from very visible bottom, to no visible bottom.
This way the seam between water and land will be gone.

I really hope your done soon :smiley:

This ‘seam’ is what happens in reality, normally hidden by patches of grass, or less obvious due to the water typically not being quite so flat. The amount of reflection is determined by the viewing angle, water depth plays a much smaller role. One millimeter of water will be almost 100% reflecting if you look at it from a low point of view.

This ‘seam’ is what happens in reality, normally hidden by patches of grass, or less obvious due to the water typically not being quite so flat. The amount of reflection is determined by the viewing angle, water depth plays a much smaller role. One millimeter of water will be almost 100% reflecting if you look at it from a low point of view.

The “seam” is indeed what happens in reality as well, but my seam is extremely straight, making it stand out. As Riven said it would be better if there were some waves on the water, but that won’t come for quite some time :slight_smile:

To show the water from the beach towards the deeper water:

http://stateoffortune.com/pictures/screenshots/waterseam.png

Mike

The “seam” is indeed what happens in reality as well, but my seam is extremely straight, making it stand out. As Riven said it would be better if there were some waves on the water, but that won’t come for quite some time :slight_smile:

To show the water from the beach towards the deeper water:

http://stateoffortune.com/pictures/screenshots/waterseam.png

Mike

If you are able to easily query the water-depth in a shader, you could do some animated noise from a certain threshold to simulate some white foam at the edges.

I am not, but that sounds like an awesome idea. I don’t think I’ll be able to get the depth number though without a lot of fiddling around. I could split the water quad into smaller pieces and put the depth into one of the color channels, but that’d have to be further down the line.

Nevertheless, a really good suggestion, worthy of a gold star! :slight_smile:

Mike

hmm, since you already seem to have two-pass rendering for the reflection, could you not simple store the depth-buffer in the fbo and compare the value with the depth-value of the water-plane?

The fbo’s/textures I currently use in the shader is:
Reflection Texture
Depth to bottom of water (from camera)
DUDV
Normal

As I don’t have any “how far is it from the water level to the ground underneath” the best guess I can do is “how far is it from the camera to the ground - the distance from the water fragment to the camera”. The problem with this is that it will change depending on the where the camera is and the angle the water is looked at. The other challenge is that the depth buffer isn’t an absolute number but based on the depth precision and clipping fields. It might work but I’m not sure how good the result will be.

Mike

If you are able to easily query the water-depth in a shader, you could do some animated noise from a certain threshold to simulate some white foam at the edges.

I am not, but that sounds like an awesome idea. I don’t think I’ll be able to get the depth number though without a lot of fiddling around. I could split the water quad into smaller pieces and put the depth into one of the color channels, but that’d have to be further down the line.

Nevertheless, a really good suggestion, worthy of a gold star! :slight_smile:

Mike

camToGround-camToWaterFragment was what I meant. you may need to restrict the effect to only be rendered relatively near to the camera, so you don’t get precision problems. I am unsure however regarding the non-linearity of the depthbuffer, but maybe you can just write the fragments z position into some custom fbo-attachment to get linearized values.

hmm, since you already seem to have two-pass rendering for the reflection, could you not simple store the depth-buffer in the fbo and compare the value with the depth-value of the water-plane?

The fbo’s/textures I currently use in the shader is:
Reflection Texture
Depth to bottom of water (from camera)
DUDV
Normal

As I don’t have any “how far is it from the water level to the ground underneath” the best guess I can do is “how far is it from the camera to the ground - the distance from the water fragment to the camera”. The problem with this is that it will change depending on the where the camera is and the angle the water is looked at. The other challenge is that the depth buffer isn’t an absolute number but based on the depth precision and clipping fields. It might work but I’m not sure how good the result will be.

Mike

camToGround-camToWaterFragment was what I meant. you may need to restrict the effect to only be rendered relatively near to the camera, so you don’t get precision problems. I am unsure however regarding the non-linearity of the depthbuffer, but maybe you can just write the fragments z position into some custom fbo-attachment to get linearized values.

[quote] I am unsure however regarding the non-linearity of the depthbuffer,
[/quote]
As you can see in the image below, view1 and view2 represent camera rays which are looking at the same point on on the sea bed. Obviously view 2 traveled a longer distance under water. If you use that distance to determine water depth you will get inconsistent result.


           view 1
              |     view 2    
              |      /  
              |     /
--------------|----/----------   water surface
              |   /
              |  /
              | /
              |/
--------------*---------------   sea bed

To find the water depth, we can use a bit of math from similar triangles:

                                camera position                           
                             C
                            /|
                           / |
                          /  |  D
                         /   |
                        /    |
                       /     |
----------------------O-----------   water surface
             |       / 
             |      /
             |     / 
             |    /
          d  |   / 
             |  /
             | / 
             |/
-------------X--------------------  sea bed

C is the camera position
D is the distance from camera position to the water level,
O is where camera ray intersect water surface,
X is where camera ray intersect the sea bed,
and d the water depth will equal to D/CO * OX

[quote] I am unsure however regarding the non-linearity of the depthbuffer,
[/quote]
As you can see in the image below, view1 and view2 represent camera rays which are looking at the same point on on the sea bed. Obviously view 2 traveled a longer distance under water. If you use that distance to determine water depth you will get inconsistent result.


           view 1
              |     view 2    
              |      /  
              |     /
--------------|----/----------   water surface
              |   /
              |  /
              | /
              |/
--------------*---------------   sea bed

To find the water depth, we can use a bit of math from similar triangles:

                                camera position                           
                             C
                            /|
                           / |
                          /  |  D
                         /   |
                        /    |
                       /     |
----------------------O-----------   water surface
             |       / 
             |      /
             |     / 
             |    /
          d  |   / 
             |  /
             | / 
             |/
-------------X--------------------  sea bed

C is the camera position
D is the distance from camera position to the water level,
O is where camera ray intersect water surface,
X is where camera ray intersect the sea bed,
and d the water depth will equal to D/CO * OX

Nice! Now just to get the correct distance from the depth map (seeing as it isn’t linear based on the perspective). I’ll have a look at it. Thanks!

Mike