Something in between this realistic animation: https://app.productioncrate.com/assets/ ... sh-trail-1
and the effect seen on both sides of the boat in Wind Waker:
And thanks to the video from that great article about FX in Wind Waker: https://medium.com/@gordonnl/the-ocean-170fdfd659f1
(the first video after the “Shader Vertex” title), I'm using the same low poly half-sphere technique.
Code: Select all
<?xml version="1.0" encoding="iso-8859-1" ?>
<ZApplication Name="App" Caption="ZGameEditor application" CameraPosition="-0.6472 1.0144 -9.978" CameraRotation="0.0023 91.4897 0" FileVersion="2">
<OnLoaded>
<ZExternalLibrary ModuleName="opengl32">
<Source>
<![CDATA[//
void glBegin(int mode){}
void glEnd(){}
void glVertex3i(int x, int y, int z){}
void glVertex2f(float x, float y){}]]>
</Source>
</ZExternalLibrary>
</OnLoaded>
<OnUpdate>
<ZExpression>
<Expression>
<![CDATA[Time = App.Time;
@RefreshContent(Component :Mesh_WaterSplashTrail);]]>
</Expression>
</ZExpression>
<ZExpression>
<Expression>
<![CDATA[//
float T, X, Y;
//
T = App.Time;
App.CameraRotation.X = sin(T/2)/32;
App.CameraRotation.Y = T/16;
//
X = App.CameraRotation.X*PI*2;
Y = App.CameraRotation.Y*PI*2;
App.CameraPosition.X = -sin(Y)*cos(X)*10;
App.CameraPosition.Y = 1+sin(X);
App.CameraPosition.Z = cos(Y)*cos(X)*10;]]>
</Expression>
</ZExpression>
</OnUpdate>
<OnRender>
<RenderTransformGroup Translate="0 0 -1.2">
<Children>
<RenderMesh Mesh="Mesh_Ship"/>
</Children>
</RenderTransformGroup>
<RenderTransformGroup Name="TransformMesh" Rotate="0 0.25 0">
<Children>
<RenderMesh Mesh="Mesh_WaterSplashTrail"/>
</Children>
</RenderTransformGroup>
<ZExpression>
<Expression>
<![CDATA[// Draw grid
glBegin(1);
for(int S=-5; S<6; S++)
{
glVertex3i(S,0,-5); glVertex3i(S,0,5);
glVertex3i(-5,0,S); glVertex3i(5,0,S);
}
glEnd();]]>
</Expression>
</ZExpression>
</OnRender>
<Content>
<Mesh Name="Mesh_WaterSplashTrail">
<Producers>
<MeshSphere ZSamples="3" RadialSamples="16"/>
<MeshExpression VertexColors="255">
<Expression>
<![CDATA[if (V.Z == 0) {
V.X *= 4;
if (V.Y < 0) V.Y = 0;
else V.Y += (cos(V.X * Time * 4) * 0.05) * (1 - V.X * 0.5);
C.R = 1 - V.X * 0.2;
C.G = 1 - V.X * 0.2;
C.B = 1;
} else {
V.Z *= 0.2;
C.R = 0;
C.G = 0.8;
C.B = 1;
}
V.X -= 4;]]>
</Expression>
</MeshExpression>
</Producers>
</Mesh>
<Variable Name="Time"/>
<Mesh Name="Mesh_Ship">
<Producers>
<MeshSphere Scale="1 1 1.5" ZSamples="6" RadialSamples="3"/>
<MeshTransform Position="0 0.4 0" Rotation="0 0 0.083"/>
<MeshExpression VertexColors="255">
<Expression>
<![CDATA[//V : current vertex
//N : current normal (turn off AutoNormals when modifying normals)
//C : current color (turn on VertexColors)
//TexCoord : current texture coordinate (turn on HasTexCoords)
C.R = 1;
C.G = 0;
C.B = 0;]]>
</Expression>
</MeshExpression>
</Producers>
</Mesh>
</Content>
</ZApplication>
What do you think about the effect? Is this a good approach? Because everything in my game that touches the water will emit something like this. Should it be a shader instead?