I once created a simple water project in version 1.10, attempting to implement plane reflection and screen space refraction using computational shaders to calculate ripples and normals formed by interaction
At that time, we encountered many problems when implementing planar reflection. After about half a year, we updated this project in the latest 1.12 version and added many features to optimize it.
However, plane reflection still cannot be rendered properly (SkyActor cannot render correct shadows and sky lights in the reflection scene)
I have found a way to use multiple cameras to render the depth of the sky scene separately in multiple SceneRedTasks and combine them in materials. Currently, besides the above issues, the implementation is barely usable
Considering that popular 3D engines such as UE Unity and Bevy already support Camera’s Oblique projection matrix, following up with this feature will greatly improve the convenience and performance of projects using similar functions or migration.
In addition, because I used GPUBuffer to pass some water surface height modification/ripple data to compute shader, I also found that the results of using GPUBuffer in different graphics backend dx11 and dx12 were inconsistent. In dx11, the expected results could be obtained, but after passing the buffer in dx12, I encountered rendering errors.
Relevent code:
private const int ForceEntrySize = 40;
[StructLayout(LayoutKind.Sequential)]
private struct ForceEntry
{
public Float2 Center;
public float Radius;
public float Strength;
public Float2 Direction;
public float HeightAmt;
public float FoamAmt;
public float Type;
public float Pad;
}
private unsafe void UploadForceBuffer(GPUContext context, int count)
{
if (_forceBuffer == null || count <= 0) return;
for (int i = 0; i < count; i++)
_forceUploadData[i] = _forceEntries[i];
fixed (ForceEntry* ptr = _forceUploadData)
{
context.UpdateBuffer(_forceBuffer, new IntPtr(ptr), (uint)(count * ForceEntrySize));
}
}
I really like Flax Engine and hope these issues can be resolved as soon as possible ![]()
