Translucent Tessellated Material Bug

Hello every one,
I tried to make a shader using translucent material. It all worked fine.
Then I enabled tessellation. When moving camera, my material suddenly turned into some sort of flickering magic shape(As seen in the attached file). Well… I started to play with the settings and once I disabled Use Translucency , it fixed itself.
It appears that the translucency + tessellation+ camera moving = magic something.
Has anyone ever had this issue? How can this be resolved?

There’s no flickering or flickering magic shape in the video. It may be a part of the recorded clip was removed incidentally before saving or during save. The thing about tessellation is it could extend past the original bounds of the mesh / actor, which would cause some flickering. It may easily appear as a different shape with enough odd flickering. One way to check this is using Visualize > Out of Bounds Pixels under Show dropdown in Viewport. Here is the page on it:

Basically, if any pixels are outside of the mesh or actor’s bounds, then they’re not getting rendered entirely or correctly, so flickering occurs. In my perspective, it’s like the engine is trying to render the pixels, but continually fails or encounters errors, so the pixels are repeatedly starting to render and stopping, which looks like flickering. That’s an interpretation though. Tessellation does increase the volume of an actor / mesh beyond its initial (pre-tessellation) form, and as far as I know, doesn’t automatically calculate new bounds to fit within.

Thank you so much, Your comment was helpful.
I traced my material further and found that the problem was with the part of the material using custom depth( The image of it attached).
my model has inner triangles. I cull any pixels that are behind the outer shell of the mesh by rendering my mesh into the Custom Depth buffer. It works fine without tesselation.
the problem is created by enabling tesselation. It looks like parts of the mesh pixels are not rendered.
I’m posting a video that compares my scene in both modes(with and without tesselation). The download link is as follows:…ew?usp=sharing

Is there an idea to explain this problem? Is there a solution?
I appreciate.

It appears that tessellation adds geometry (triangles) that doesn’t get rendered, similar to what you’re saying about parts of the mesh not being rendered. Could it be something to do with the “if” node in the custom depth sorting group? Another idea is if the R channel is the only one being masked, which I presume is for culling pixels using custom depth, then perhaps the new tessellation triangles are not being written to the depth buffer because they’re handled differently in tessellation. I don’t see why it would work that way, but it could be the case rather easily.

Are you using a smoothing group with the tessellation? or is it flat tessellation?

Another thing to consider is in terms of translucency, rendering is done from the back to the front in reference to the camera. So, the part of the mesh that isn’t rendering, inside the eye, could be because the material setup isn’t correct for that back-to-front method. So, in the material network you posted, the If node is outputting 0 if A > B. Since it is 0, when it’s multiplied by any other value, such as the opacity value of 0.5 and the other connected value it’s multiplied by, the product or result is going to be 0. Thus, it is resulting in 0 opacity at the main material node, which is invisible. Looking at the comparison of A and B, if the sum of Pixel Depth and the Bias Parameter is greater than the Custom Depth mask value, then it outputs 0. If it didn’t output 0, that part of the mesh could become visible. It’s a thought at least.

Tessellation + translucency obviously works fine, or any water material/the community ocean plugin wouldn’t be working.

If you provide a clear(er) explanation of what it is that you need to do one of us can probably give you a good solution.

What is the end goal?
Why do you need tessellation to achieve it?

What are we looking at on the Left of the video VS the right? What is it actually supposed to look like?

Thank you so much for your time.
I think your explanation of the cause of my problem is probably correct. But setting output from 0 to a larger amount didn’t solve the problem, unfortunately.
you said, “… is in terms of translucency, rendering is done from the back to the front in reference to the camera”. Can you explain more about it?

Thank you for your reply.
I describe the issue from the beginning and appreciate your help.
I have a mesh whose data is sent to َUE4 by a plugin on the network and dynamically generated on the CPU side in C++ using the UE4 procedure class.
This mesh bit by bit is destroyed in run time, and this is done interactively with the user. ie, the mesh triangle removed one after another.
To reduce the CPU overhead, a low poly mesh is created and is relatively sharp. That’s why I need tesselated material so I can have a smooth mesh, especially at the borders.
As can be seen in the image, this mesh is an ellipsoid and have some borders.
The material I want should have these features:

  1. Be transparent.
    2-Transparency is not the same in all its parts. Parts of the mesh should be completely opaque and other parts more transparent.
    I created a map showing the desired opacity value for different mesh points and used the map in the material. In this map, the points at the higher z are completely opaque and the points at the lower z are more transparent.
    But that wasn’t enough and it didn’t work out as I expected. When I rotated the camera, the mesh walls, which were transparent and located at the lower z of the opaque mesh section, also rendered. To solve this problem, I added the “Custom Depth Sorting” section in my material (in the above-attached image) and multiply it in the opacity map. Then the mesh was rendered as I wanted.
    It does not work fine with tesselation.
    In Left of the video tesselation disabled and the mesh rendered as I wanted. in Right of the video PN tesselation enabled, as shown by moving camera, some parts of the mesh that higher Z not rendered and other parts in lower Z be rendered.
    thankyou for your time.

I’m still missing the overall goal here.

First thing first. If you are trying to simulate a liquid like substance or jello like substance, then you need different sheets of transparency.
Putting more then one transparent surface in front of another will generate the opacity effect.
You can have an opacity map define the opacity level for the transparency.
This should allow you to easily render a section more transparent then another, and preserve the look, at the cost of some performance.

Secondly, this seems to be some sort of medical application, if you could share what that is along with a paper on it, perhaps there are better ways to achieve the end goal.
Also a picture or video of what you want for reference should be very helpful in understanding if it exists…

Hello dear MostHost LA,
In the file that follows, my final target is showing in Wireframe. I want to put the material on it as an attached image. This is related to the cataract surgery of the human eye.
thanks a lot.

Basically, the rendering of translucency is performed from behind the object to the front of it, in reference to the camera view. So, viewing the eye from its front, any materials and parts that use translucency (Translucent blend mode) in the back of the eye (the part that is invisible in the right video from the earlier post) is rendered before the front area / parts of the eye. It displays simultaneously, as far as I understand it. But it’s like the buffer, where certain things are processed before others, and then it’s all displayed together.

So, in this case, two things appear to disrupt the rendering of the back area of the eye. The custom depth is culling pixels behind the outer shell of the mesh, which surrounds the entire eye, right? In effect, with translucency performed back to front, the back part of the mesh’s outer shell is rendering, and the buffer sees the next part inside of the eye as behind that outer shell. Hence, those pixels are getting culled before they are initialized to render. The other thing is tessellation. Since tessellation adds triangles (aka new geometry), the renderer is probably not processing those PN triangles because those PN triangles do not have translucency and/or custom depth rendering properly applied. In other words, things aren’t rendering in the correct order because the custom depth aspect and the tessellation are in non-compliant passes. One of the notes about tessellation is certain types of shadowing / rendering (e.g., vertex colors, vertex animation) don’t work with it because it’s often used with world position offset, which is probably because it’s too complex using a simple setup. Landscapes also require particular material network setups when utilizing tessellation, and probably due to similar problems with rendering order and lighting complexity. But yours is a much simpler scene as far as lighting goes, and even texturing, so it’s probably going to be easier to fix.

I suggest trying a different material setup than comparing pixel depth to custom depth. Pixel depth is limited to the pixel currently being drawn, so as the view is moved to get that back area to display, the current setup is outputting wrong results somewhere in it. Where in 3D space is the back area (not outer shell, but the off-red organ) located? It might work to compare (using the if node) world space location or local space location of the back organ object to the custom depth, and output the correct value if they’re either equal or within a certain range of each other. Then it would be telling the renderer to render the back organ if its object location coincides with the custom depth (which is distance from the camera to world/local location of the object). It may require a convert to world / local space node in one or both of the connection lines before the If node (e.g., World Space Location to If, and/or Custom Depth to If).

There’s a setting called Translucency Sort Priority, in which you’re able to set what renders in front of / behind what. Go to the object’s details panel, look for that setting, and set it to higher than other objects (or parts of the eye) so it renders in front of those. It may not fix the issue, but it’s possible the part in the back that isn’t rendering has the same or lower priority than the part of the eye behind it.

Thanks a lot.