[Community Project] WIP Weather & Water Shader

Code is not Formula? With features to Rotate?

c822b522a9ddfa20a2cb4f5b36ed816e6cf32fb0.jpeg

If I plug the result of code on a Displacement pin inside material, the plane will not have ONE WAVE?



FVector AOceanManager::CalculateGerstnerWaveVector(float rotation, float waveLength, float amplitude, float steepness, const FVector2D& direction, const FVector& position, float time, FWaveCache& InWaveCache, bool CalculateXY, bool CalculateZ) const
{
	float frequency = (2 * PI) / waveLength;

	FVector dir;
	if (!InWaveCache.GetDir(rotation, direction, &dir))
	{
		dir = FVector(direction.X, direction.Y, 0);
		dir = dir.RotateAngleAxis(rotation * 360, FVector(0, 0, 1));
		dir = dir.GetSafeNormal();
		InWaveCache.SetDir(rotation, direction, dir);
	}

	float wavePhase = frequency * FVector::DotProduct(dir, position) + time;
	float c = 0, s = 0, QA = 0;

	//FMath::SinCos(&s, &c, wavePhase);

	if (CalculateXY)
	{
		c = FMath::Cos(wavePhase);
		QA = steepness * amplitude;
	}

	if (CalculateZ)
	{
		s = FMath::Sin(wavePhase);
	}

	return FVector(QA * dir.X * c, QA * dir.Y * c, amplitude * s);
}