smoth corners - round edges on materials

Hi all,
I am beginner in UE4. Is there any function in material editor to do smooth - round edges on materials? I mean similar function in some 3d renders, for example - Vray has vrayedge material, where user can control the size of roundness and it generates smooth corners for all objects which have that material. It only works well with small radius and I am looking for exact same in UE4.
I can’t imagine, that I will have to bake for all object normal maps with smooth edges in 3DS max for example.
The reason for this is that I am trying to do real-time architectural visualization test and there is a lot of furniture. Practically all furniture has little smooth edges.

http://help.chaosgroup.com/vray/help/150SP1/images/examples/vrayedgestex/edges_tex_phong.png

Thanks .

It might be possible to do, but there isn’t anything like that at the moment. You’d probably need to know more about shaders to figure out how to do it on your own.

Sadly, the most rational, easy, and functional way to have round edges on models is to have it in the mesh. Game engines don’t work like offline renderers in most cases like this. The only way to have your existing Static Mesh smooth out sharp corners exactly how you want is to make a Displacement map for each object and then tessellate it in the material, which can get a little tricky (not to mention expensive for performance). Content Examples Sample Project for Unreal Engine | Unreal Engine 5.1 Documentation

For this workflow, you would need to create a smooth, hi-poly copy of every piece of furniture and then bake the displacement map. You may also be able to bake a tangent normal map to give the illusion of a rounded corner, but that is hard to get working perfectly. For best results, you would go in and smooth out the meshes by hand before putting them into UE4. I could be wrong, but I don’t think there is anything that can detect edges and tessellate them by itself.

I was looking for the same thing. I think the easiest way is to bevel the corners in the high poly mesh and bake that into the normal map.

For me, this was important because I am doing some low poly furniture assets and I don’t want to have to do the high poly version just for round corners. A way around this is to add a bevel modifier and bake the normal from that. This way you “generate” a high poly mesh but in it you also have the low poly mesh. If you want to obtain the low poly, you just remove the modifiers.

I feel that this is much needed to speed up production of secondary objects like chairs or tables. Sometimes you don’t have the time to bake from high poly and a simple material that defines only the amount of smoothness would be a god-send to remove those low poly hard edges . I lack the knowledge to write it but it seems quite similar to a normal mapped material performance-wise.

From the Vray documentation

Enable Round Edges - enables the round edges effect which uses bump mapping to smooth out the edges of the geometry during render time.
Radius - specify a radius (in world units) for the round edges effect. Since the actual geometry is not being changed and only the normals of the faces are affected large values here may produce undesirable effects.

I’m playing around inside the material editor to see what I can do with a curvature map. I really hope that the dev team realizes how many guys coming from the arch industry and indie community may find this helpful!

If someone is interested I just saw this video about what we are trying to achieve here but in Substance Designer.
He basically take the world space vertex color, blurs the result and convert it in tangent space. I wonder if this is possible in UE4 or if what I just wrote makes any sense…

Hello everyone,

I am also trying to do the same thing.
it will be great to be able to chamfer on any mesh by simply applying a shader in unreal engine.
I did some research and I read about post:

Finally, have you found a solution?

Hello,
Have you found a solution yet?
i’m trying to do the exact same thing, but with no luck at all.
Would really appreciate sharing your solution if you’ve found one.

1 Like

Coming from industrial too. So, sometimes you have just the time to convert the CAD file to mesh and the result is not clean topology. With the Round Edges attribute like the one you can find in Arnold I can smooth the corners even if i don’t have clean edges to bevel and this is really time saving. Has anyone find a solution for this? I was looking to bake the Round Edges Normal from Maya and Arnold and then import the map inside of unreal but it seems not to work.

1 Like

made a short tutorial how to smooth bevel edges. it is in russian but with subtitles.

Thanks for the video but this is not what i was looking for. Let’s say that I have to smooth corners on an object that comes from .step file like a car. The car has a lot of small pieces and I can’t paint them one by one. I can’t spend time even to do proper uvs. How can i achieve the round corner result in this case? I link some example from Blender Example in Blender

I don’t think what you’re describing is reasonably possible in real time without some amount of pre-processing or baked information, at least for an arbitrary, non-analytical shape.
This is because when a pixel is drawn in the shader, it really only has data about itself. It generally doesn’t know about the pixel next to it, let alone that pixel’s normal. Because of that, it can’t interpolate or smooth it’s normals with a neighbor it doesn’t know anything about.
Offline renderers like blender can tell a pixel a lot more information than we can afford to in real time.

That said, the opposite is actually trivial. You can find an object’s faceted/hard normals by using DDX and DDY (one of the few cases where pixels do know about their neighbors) of the world position, and then take the cross product and normalize it.
If your mesh already has smoothed vertex normals, you can probably interpolate between the original smooth mesh normals and the procedurally generated faceted normals to achieve some kind of bevel or blend.

1 Like

Okay, decided to give a crack at it based on what I described and here’s how it went…
With a metallic material to really show off the bevel:


And here it is with a matte material:

Because the cube already had hard edges, I generated some rounded spherical, smooth normals. Ideally, you’d want to do the opposite - take a smoothed object as the starting point. I added an unused example of generating the flat, faceted normal at the top with DDX/DDY. So normally you’d want to blend between the generated flat normals and the natural smooth vertex normals.
It doesn’t work great with a cube normal and sphere normal because the flat normals and smoothed normals are a little too different.
In my case I used the UVs to create an edge mask, as you need some way to drive the lerp. This is also problematic when working with an arbitrary mesh, as edge detection will be more difficult than with a cube.
Last, I slightly shrunk the mesh on the shadow pass. This prevents the shadow terminator from still appearing sharp despite the smooth normals.
No shadow shrinking:
image
With shadow pass switch shrinking:
image

All in all, kind of a success, but kind of a dud. Might be useful in some cases.

2 Likes

Could you please post a higher resolution of your material? I would love to try this solution on some meshes and see what it produces.

Thanks!

This is soooo close to being what I need. Personally I’m using trim sheets for a lot of interior stuff which requires overlapping UVs at times- but plugging in the lightmap UV coords and cranking the stiffness parameter it seems to work? Albeit with some issues.

I’ve wanted a round corners shader in Unreal for almost a decade now and this is sooooo close to what I was envisioning! Major props

Yeah - without some sort of pre-processing or planning around the edge detection it’s essentially impossible to get ideal results. A specialized UV layout is one option but it’ll probably struggle with complex geo. A distance field or curvature texture is probably the way I’d go. Obviously if you’re going to use a texture you could just bake a normal map instead, but if the DF or curve texture works well then you’ve saved a channel since they can fit in a single grayscale channel, should work for any geometry, and wont need a unique UV index. Plus they can also be reused for other things like edge wear.

Even the ideal results will probably be inferior to baked normals, but this has the advantage of being able to control the look easily in real time which is nice, maybe save a bit of texture memory and add some extra utility.

The biggest flaw so imo is that because it’s interpolating across the whole edge, unless you have supporting edge loops, certain lighting conditions will look incorrect. Here, the shape is lit from above, but you can see the dark shading on the bottom 1/3 of the edge because by then the normal begins to point downward, even though the edge brightness should be consistent. (compared to true bevel + face weighted normal where edge lighting is consistent)


Extra edge loops would solve this, but then that begs the question of why not just model the bevel in if you have to add loops anyway.
Regardless, with some effort I think you can get good enough results, but I’m still not convinced it’s worth it.

1 Like

Could you please post a higher resolution of your Blueprint Screenshot?I merely can not see any thing clearly so can you please reupload one?

Here’s a higher res screenshot of what he did, although, this is not so great and doesn’t work well with meshes other then cubes.

Here’s the code I rewrote: Rounded Edges Normal Effect. posted by jdiab1207 | blueprintUE | PasteBin For Unreal Engine

1 Like