We started out the some superficial improvements to the scene such as adding a plane with a sandy bottom texture beneath the water and adding a sky box. We also changed the water texture. These improvements are by no means final, we are simply testing out different ideas as we go along. Either way the scene undoubtedly looks a lot better than day 1. We have also investigated refraction and lighting effects further but have little to show at this moment.
First interactions
Today we have taken our first step towards an interactive water surface. We have created a click function that allows the user to set the epicenter of the sinus waves. In order of achieve this we’ve implemented an event listener that captures the mouse click event. We then use then convert the mouse screen coordinates to coordinates in the near plane. A ray is sent out from the camera origin to figure which object in scene it intersects first.
Secondly using the same principle for detecting target we have implemented a drag function on the ball which translates the sphere in the xz-plane.
We’ve noticed that the camera controls are a bit unintuitive, but decide to leave them as they are for know and focus on the scene instead.
It floats!
We have investigated a series of possibilities for having a floating effect on the sphere. Thus far the sphere floats only in y-direction, lying completely still in the xz-plane. The first idea was to simply calculate the y-position in the same manner as for the vertices that make up the water surface. Because we made these calculations based on the center of the sphere it didn’t look quite natural. This was improved by putting it slightly out of phase. This solution did however seems a little bit to hard coded so we moved on.
We did some experiments of implementing a physics plugin. We had some success with this, but felt that we wanted to investigate further how we could create our own floating effect. The third idea was to accelerate and decelerate the sphere y wise depending on whether the center was above or below the surface.
We had decent results with this approach. Next step should be to more accurately mimic world physics by having a constant gravitational pull on the sphere and an upward force dependant on the volume of the sphere which is submerged, per Archimedes principle.
How to proceed
We will continue to investigate lighting effects, we will likely implement different shaders for the surface and bottom respectively. We should continue working on gravity and floatation physics. The waves should be improved by supporting several epicenters simultaneously. We might also look into wave shape alternatives other than the sinus waves.
Summary
- Implemented sky box and bottom plane
- Implemented click function to set epicenter
- Implemented drag function on the sphere
- First attempts at physics
- Changed the water texture
// Kevin
Inga kommentarer:
Skicka en kommentar