I’m using a Translucent material, with Surface TranslucencyVolume as the Lighting Mode. This is for an Ocean shader.
However, since there are waves, parts of the surface are obscured by itself, when the camera is low enough. When that happens, random backfaces get rendered a much darker color. I made a blocky mesh to make this more visible. First pic is a normal opaque material to show the shape, second pic is with the translucencyvolume mode enabled.
I have created a blocky texture inside of Maya and imported it into UE4. I then changed the blend mode to translucent and turned the lighting mode to Translucency Volume.
A couple questions and trouble shoots for this.
1.) Is this a plane or a cube that you used
2.) What OSX and Graphics card are you using?
3) What Modeling program did you use
4.) Send me a screenshot of what your material looks like.
5.) See if you can recreate this in another project.
1.) Make sure you have clean geometry
2.) Make sure you don’t have any unnecessary export settings turned on.
3.) Unwrap your geometry.
This is a plane, subdivided maybe 50 times on both directions to give a grid. I then selected strips a couple squares wide and pushed them up and down to give the simplest approximation of a wave, and exhibit the bug.
Win 7, GeForce GT750M, made in Blender
Yes, I can recreate the issue in a separate project, using a newly made mesh.
The bug is much more apparent if you check “Two Sided” in the Material properties, but that’s not required.
I have the same settings for export as I normally do for FBX, never had an issue with those. I am confident the topology is clean.
What you are experiencing is a normals issue inside of blender.
The steps to fix this are as follows,
1.) Open Edit Mode inside of Blender
2.) Go to Mesh, right beside the edit mode button.
3.) Click on the normals option
4.) Then click recalculate outside.
5.) Re export from blender, just like you did before, and try it again.
So I took your model into a 3D modeling software and made sure all of your normals were facing the right way and your topology was clean, etc. I then imported your model into UE4 and applied the shader mentioned above. I was able to recreate the bug you are experiencing on your model.
I then took a plane and modeled it to as close as I could to your model in Maya and repeated the applying of the above material. My model is clean and does not have the artifacting that I see in yours.
One thing that I did notice was your wave was triangulated upon importing it into Maya.
If you export from Maya to or other modeling programs like 3DS Max and you have smoothing groups selected or smooth in the .fbx options then UE4 tessellates the mesh in a triangular fashion.
What I’ve concluded is that the issue you are having is somewhere inside of your geometry. This may be cause by vertices not welding together and after the light map back you have light being cast through that opening.
I would suggest going back to your original mode and reducing the polygons you have. Right now with the triangulation it has over 22,000 Polygons. Even for deformation and normal map purposes this is a lot.
Start with something like 50 polygons or so just having say four or five divisions across the mesh vertically and horizontally, Then, import that into a new project and put the same material on it.
I will also attach a screenshot of your mesh in engine and my mesh in engine.
Yep, the shading was Smooth, and it gets fixed if I use Flat.
Is there any way to visualize normals in the editor? And do you have any guess as to why smooth shading would produce these artifacts? I’m not sure to get why Unreal tessellating smooth groups would lead to this.
The reason I’m asking is because I originally encountered the bug on a flat grid mesh that gets displaced in the material, to produce waves. On that mesh the Flat shading does not change anything since it’s already flat I guess. But the normals are definitely smooth once computed (i.e. they are computed to be half-way between face normals).
Something about Surface TranslucencyVolume does not like smooth normals.
In order to truly understand you methodology with that formula I will need a screenshot of your material and how you are implementing Gerstner’s algorithms. I know that if you don’t set the algorithm up exactly correct then it WILL break your models. Also I have a link to a guy who has already done the math and set the project up in UE4’s node based system.
You can download his project through GitHub. I know the way he is implementing it, it will never be used inside of an engine. I will also link you to our wiki page where a much more cost efficient way implementing waves and translucency has been used.
Thanks for the links , I downloaded the Ocean Project. My material code is strictly equivalent AFAICS. And if I simplify their material (to remove detail maps, SSR, that kind of stuff) and just keep the Gerstner basis, I can reproduce the issue in there as well. Lots of visible triangles seen through the waves. They use the same type of translucency (Volume).
I’ll look at the other material. For gameplay reasons though, directional moving waves would be best. I am also in the process of implementing Tessendorf which gives a non-directional, very fluid kind of ocean, as if you just shook it really hard, like during a storm. But it’s not as good at giving the illusion of wind in a given direction, and I would definitely tone it way down near shores in favor of Gerstner. Blending both would probably be ideal, but costly.
So, after looking at Ocean Project in more detail, it seems they use a workaround based on the Custom Depth buffer, to get rid of the artifacts. So they are basically rendering the surface of the ocean twice, with one of the surfaces writing to Custom Depth and not to the main pass.
Then the opacity of the main surface is set to 0 whenever its depth relative to the cam exceeds the depth in the Custom Depth buffer, essentially hiding the far triangles.
Since this means the whole displacement computation with Gerstner is run twice, this is a very costly workaround. I believe there should be a better fix in the renderer.