Preserving Beveled Edges

Issue #908 resolved
Midnight Arrow created an issue

Iray materials have an option to fake beveling on a per-material basis but Blender only has an object-basis Auto Smooth option. However for Cycles there is a bevel node which can offer the same kind of smoothing shading, but it doesn’t look like it’s added when the shaders are converted? Is it possible to use that to preserve the fake beveling from Daz for props and environments? I think you can use the Goemetry → Pointiness node to get an edge angle, though I’m not sure the exact algorithm to convert that into a useable angle.

Comments (14)

  1. Alessandro Padovani

    The implementation is straightforward, below the equations. In my tests it is necessary a precision of 32 to match iray. The other iray parameters are ignored because they don't have an equivalent in blender.

    Please note that this "fake bevel", the same as the smooth angle, is necessary to correctly import primitives and low poly geometry in general. They are less useful for high poly geometry where smoothing is usually modeled with real polygons. Also for very high poly geometry these fake normals may cause performance issues in the viewport as reported by Xin.

    # bevel node, cycles only
    samples = 32
    radius = round corner radius
    

    Test scene included bevel.duf. Below first iray then cycles.

    We may include the fake bevel together with the "auto smooth" option in the global settings since they're together in iray and both intended for primitives and low poly geometry. Or add a new "fake bevel" option.

  2. Midnight Arrow reporter

    I do know how to add the bevel node myself, the issue is that decent-sized environments come with dozens of materials so automating it would be very useful.

    I didn’t know there was an Auto Smooth option in the global settings. But that seems like a mistake to put it there. Wouldn’t it be better to put in it the import options so you can toggle it when you’re importing with the Environment Shared and Environment Unique types?

  3. Alessandro Padovani

    Those comments were for Thomas for the implementation since he gets little time and it is better to explain things. As for the import options those have nothing to do with the geometry. In daz studio any prop could use the bevel feature, as a sword or a helmet for example, not just environments.

  4. Thomas Larsson repo owner

    Adding the bevel node was easy enough and was done in the last commit. However, there are some things that I wonder about.

    Is the radius given in DS units, i.e. centimeters? Then there should be a conversion factor.

    The bevel node is only generated if auto smooth is enabled.

    It is inserted between the normal map node and the bump node, if both exist.

    The global settings are normally not changed, so if the auto smooth option is changed frequently it should be an import option instead. Do people change this often? I mostly import organic meshes so I never use it myself.

  5. Alessandro Padovani
    1. No, oddly enough it seems the bevel is in meters same as blender.
    2. For me it makes sense to have bevel and autosmooth together, though in iray they are independent.
    3. Yes it seems correct to me to have bevel between the normal map and the bump.
    4. I always keep autosmooth enabled it is essential to get the same shading as daz studio both for props and environments. The tooltip is wrong it doesn’t cause any artifact with organic aka subdivided meshes. What I change often is the material method, principled for animations with eevee and bsdf for photoreal pictures with cycles.

    Commit b670762 works fine here.

  6. Thomas Larsson repo owner

    Made some UI changes in the last commit. The material method is now an import option, and auto smooth is enabled by default.

  7. Alessandro Padovani

    As for commit fe0ece3, if we want the material options on import, then the hair options are needed as well. Since eevee only supports the “principled” option, while cycles supports all of them, but the closest to iray is the “hair bsdf” option. Please note that “hair principled“ doesn’t work with eevee so it’s a cycles option.

    Otherwise we could do that principled on import selects “principled” for hair, and bsdf on import selects “hair bsdf”. But it makes probably more sense just to include the hair options on import.

    edit. Or, if we want to simplify the material options, we could drop “hair principled“ that doesn’t match iray anyway, and keep only “principled“ and “hair bsdf“, so to get a global selector “principled“ and “bsdf“ for everything, as it was in the earlier versions. This makes sense since we import from iray, and “hair principled“ was included more as an extra option for cycles.

    edit. I see you changed the tooltip for auto smooth. The poor performance is not for organic meshes but for HD meshes in the viewport. So a more correct tooltip would be: “This is needed for hard edges, but may cause a poor viewport performance with HD meshes.“.

  8. Thomas Larsson repo owner

    The explicit hair material method was removed in the last commit. There are too many options, and good to get rid of combinations that don’t make sense. The hair principled method is still available in the Make Hair button.

  9. Alessandro Padovani

    Commit 7ee98e4 works fine here. I agree a simple choice for materials is easier to understand and makes more sense at least to me.

  10. Midnight Arrow reporter

    I tested 1.6.1.0903 but I don’t see any bevel nodes being added to the shader tree even when autosmooth is enabled.

  11. Alessandro Padovani

    Works fine here. Of course the bevel node is added only if it is used in daz studio, as everything else is. Otherwise it serves no purpose.

    If you have nothing more to add please mark as resolved.

  12. Midnight Arrow reporter

    I see now. I confused Round Corners Roundness for Round Corners Radius which was at 0.0.

  13. Log in to comment