Thanks to a suggestion by georgatos7 I've gradually increased the transparency of the water as it laps onto the beach (by 'lerping' more beach texture into the water/foam combo)
Calm before the storm...
Flyby of a calm sea on a hot summer's day.
Recorded in fullscreen mode using the Windows10 inbuilt video capture software.
I'll now be moving into the real meat of my project... the Surf Zone.
This is where all the action will be happening in the form of breaking surfable waves.
I have a number of ideas to carry out and experiment with, but I'll still update my progress, good and bad.
Currently all my wave creation and processing is being carried out in the GPU via HLSL shader code, with the CPU feeding the neccessary parameters to change the physical shape and visual appearance. Being able to tesselate the water surface gives marked speed and resolution improvemnents over my original 'Surfing Simulation' using Esenthel, where most of the work was being done in the CPU.
However, the problem that I have now hit upon is how to access all the wave data existing in the GPU, since I need the vertex position and normals at any point on the dynamic wave surface at any time, so as to manipulate floating objects (e.g surfboard). The standard GPU shaders (VS,HS,DS,PS) have no easy means of achieving this (that I can find,anyway)
However, my saving grace could well be in the form of the Directx Compute Shader... I have started reading up on this and am looking at a few working examples. As well as being able to pass data back and forth to/from the standard shaders, it can also pass data back to the CPU (at a slower rate, though). Another plus is that all processing is performed in parallel on seperate threads... this could very well suit the wave grid processing and enable me to do away with the tessellation shaders, and just use standard grids, but at a higher resolution.
This all remains to be seen, so I will be spending the next couple of weeks getting to grips with the Directx Compute Shader.
Maybe you could replicate on the CPU (in a simplified way) what you are doing on the GPU?
That way, you wouldn't have to send any data back to the CPU.
Y as Tottel proposed maybe you could re-evaluate your waves position and normal on the CPU but just for the single position you are interested to place your floating object. I think i remember reading about this as a possible solution for similar cases, i don't know the specifics of your implementation though so not sure if it's doable or not.
Edit: It looks like the source of information was actually this vid that probably is using a similar implementation for the ocean, but it's done with the built-in node based shader tool for the ocean geometry and is using a parallel cpu code implementation to calculate the Buoy's height and normal. http://www.youtube.com/watch?v=PBWLfpm0K0o&t=14m30s
(This post was last modified: 02-19-2016 12:57 PM by georgatos7.)
Quote:I think i remember reading about this as a possible solution for similar cases
Hi, georgatos7, if you could possibly dig out that reference it would be much appreciated. I really want something 'quick and dirty' and not too mathematical.
Edit: Thanks!
(This post was last modified: 02-19-2016 12:16 PM by 3DRaddict.)
On giving this some thought, it does seem to be a feasible solution. I'm going to give it priority over the Compute Shader. Thanks for the input, Tottel and Georgatos7.
A slight synchronisation problem, but at least duckie is now keeping his head above water! If any creature has more than the nine lives of a cat, then its a duck...he's drowned many times today.
Its been a frustrating day, but thanks again to G and T for their suggestion... I'm sure its saved me a couple of weeks work investigating Compute Shaders.
Whenever I come across complex formulations and equations that I will require to use in my 3D application, I resort to an old favourite of mine...the humble spreadsheet.
For me it is the ideal way of testing and visualizing in a 2D format, and once working correctly, it is fairly easy to repeat that 2D slice along the 3rd dimension of your 3D application. The spreadsheet allows you to build up tables of functions and their parameters, then visualize them by means of XY line charts. Key parameters can be altered manually (or automatically, by means of macros) resulting in instant visual results on the chart. However, some familiarity with spreadsheet programming is required.
For example, I'm currently working on what happens to the shape of a wave as it approaches a beach. The dynamics of the wave changes as the depth gets less... the wavelength, speed and height are all affected. When the wave height is larger than 0.8 times the water depth then the wave breaks.
Here are a few screenshots of my spreadsheet to get a better idea.
Very interesting approach. It makes a lot of sense to try to achieve a different and more realistic behavior the closer you get to the shore especially since in this case water is a main gameplay element.
(This post was last modified: 02-26-2016 03:34 PM by georgatos7.)
I've been working on the spreadsheet simulation as shown in my previous post. I've progressed to the stage where I now have an algorithm that changes the shape of the wave profile as it advances from deep water, through the intermediate stages to shallow water, and finally on the beach. It is during the intermediate stages that the wave is surfable as it start to spill over. The wave breaks completely into a mass of foam when it hits the shallow water.
Unfortunately, a spreadsheet simulation proceeds at an incredibly slow pace due to the large amount of spreadsheet cells which have to be calculated each frame. So, rather than a video, I was only able to take a series of screenshots as the simulation proceeded.
The shots start with the wave forming in the deep water on the right and end with the broken up wave on the beach on the left. To fit everything in, I had to drastically reduce the scale, so the wave appears as a rather indistinct blue blob. However, at the bottom of the shot is an enlarged version of the wave, showing the shape detail more clearly at that instant in time.
I guess I'm now ready to transpose everything from the spreadsheet to the 3D project version.