Wish : globally turn off edge softening

Hello, the edge softening tool is a great thing that I use on a daily basis for a large number of the geometry in my projects, there is however one problem…
When edge softening is used in large projects on a number of objects it slows down the display pipeline dramatically.
To overcome this problem I would like to have the option to temporarily turn off all edge softening while modelling, and turn it on when i would like to render. Of course this option has to include the feature that each objects has to remember its own edge softening amount and the it has to work also for objects in blocks…

best

Andreas

6 Likes

Hi Andreas - got that, thanks, I’ll add it to the pile - I guess this would apply to all of the render mesh ‘special effects’.

https://mcneel.myjetbrains.com/youtrack/issue/RH-37258

Also, @walther - for now, if you select everything you can control the ‘on’ state of EdgeSoftening etc from there, for all objects at once in Properties.

-Pascal

I am sorry to dig this one out again, but it is still bugging me even though 4 years ! have already passed…

Although Pascal mentioned that you can off course select everything and then turn of the edge softening this is not a very good solution:

  1. We need a tool to be able to select objects where the soft edging is failing

“The edges could not be softened because the softening radius is too large.”

this error message often seems to come up when reopening projects where I used soft edging, they do not seem to appear directly after applying soft edges! The problem is there is no way to Identify / select the objects where it fails !
2. Selecting everything and then turn off soft edges is destructive, since you do not have the option to revert that action since you do not want to apply soft edging to all objects.
3. Furthermore this method does not work for objects within blocks…

So imagine opening a large project consisting of objects with and without soft edges and 50 blocks also containing objects with and without soft edges. After opening the scene you are greeted by 40 error messages that soft edges are failing on some objects… I think you get the idea…

Best

Andreas

2 Likes

one more thing I forgot to mention:
What is also super annoying is the fact that the error message “The edges could not be softened because the softening radius is too large.” combined with very noticeable displayport lagging is also occurring when you execute other operations, which are completely unrelated to these objects but (I guess) force Rhino to remesh parts of the scene… I think I remember that e.g. pasting geometry or unhiding hidden parts trigger this behaviors as well…

Push

1 Like

McNeel please ! This is a real problem, this post is 5! years old and the issue is giving me problems on a daily basis.

Can someone please look into this ?

Hi Andreas -
In a simple test file here, it is possible to turn edge softening off and on with macros without running into issues.

Can you please share a simple 3dm file that shows the The edges could not be softened because the softening radius is too large issue?
-wim

Was having many of the same problems and came across this thread. Has there been any updates on this? Would love to see this added.

A temporary but ugly solution could be allowing users to set a default softening value on new objects? If users can set a default of zero and rhino treats zero as off then users can select all objects and turn softening on and off. Unless user manually adds a softening value it will always be off because it defaults to zero.

2 Likes

I was just searching whether it’s possible to turn off edge softening (as well as other effects like displacement) temporarily (eg. in Display settings) and only came across this thread. Those effects can be very demanding and they’re almost always only needed for rendering. Is really no one at McNeel looking into this?

3 Likes

Hi -
RH-37258 is not something that is on the table at this point.
Apart from the issue with blocks, are you running into problems when selecting everything and turning that option off and on in the interface or by means of macros?
-wim

Selecting everything and turning it off works fine but that’s not a useful option when you only want the effects applied to certain objects.

My issue is simply that the performance is much worse in everything, rotating camera, moving objects, un/isolating objects. In my current scene where I only use it on simple objects, using _Testmaxspeed gives me four times higher FPS if I turn all edge softening off. Which is understandable, since it’s a lot more geometry to draw, hence why I’d want to have that option to disable it temporarily. Especially since this effect is not only applied in Rendered viewport but also Shaded, Ghosted… everything that draws meshes. Leaving Wireframe the only unaffected viewport.

2 Likes

+1 for this feature. Display performance is totally unworkable when edge softening is on in a large model. A command like ‘EdgeSoftOff’ or similar would be much simpler than selecting everything in the model (especially when certain layers are on/off at different times, or trying to remember which of the 5000 objects in my model do or do not have edge softening).

2 Likes

I agree with this wish, and your point as to why simply globally disabling softening on all objects does not help – so give a try to this python script

from System import *
from Rhino import *
from Rhino.Render import *

doc = RhinoDoc.ActiveDoc
key = 'edgesoftening'
changed = []

try:
    Display.RhinoView.EnableDrawing = False
    
    for obj in doc.Objects:
        if obj.Attributes.UserDictionary.ContainsKey(key):
            obj.SetCustomRenderMeshParameter(CustomRenderMeshProvider2.EdgeSofteningId, "on", True)
            obj.Attributes.UserDictionary.Remove(key)
            obj.CommitChanges()
            changed.append(obj.Name and obj.Name or obj.Id.ToString())
        elif Convert.ToBoolean(obj.GetCustomRenderMeshParameter(CustomRenderMeshProvider2.EdgeSofteningId, "on")):
            obj.Attributes.UserDictionary.Set(key, True)
            obj.SetCustomRenderMeshParameter(CustomRenderMeshProvider2.EdgeSofteningId, "on", False)
            obj.CommitChanges()
            changed.append(obj.Name and obj.Name or obj.Id.ToString())
                
except Exception as ex:
    print 'An unexpected error occurred: %s'%ex
    
finally:
    Display.RhinoView.EnableDrawing = True
    print 'Changed objects: %s'%changed

it either stores the current softening state on objects that have it enabled, and disables softening, or it enables softening, if it finds it has previously been used to disable softening on an object

if it works for you, you can save it to a .py file and put it in a toolbar button with a macro like this

_NoEcho
-_RunPythonScript "c:/Users/<user>/Documents/rhino/toggle-edgesoftening.py"

it has not been tested beyond the few minutes since I just threw it together, so anyone is welcome to test & improve it

Thanks, I just tested it on an edge-softening-heavy scene and the FPS went from 13 to 42! And then back to 13 when I used the script to toggle it back. Don’t currently have time for any more testing (like is there something that could cause it to “forget” which objects were softened before turning it off) but the basics seem to work.

Of course because it’s a simple toggle, if you use it to turn softening off and then you forget about it and turn on softening manually for some new object and then you run the script again, your old objects will be softened but your new object not.

Which is why I think the best way to implement this feature would be as an override in Display properties.

But for the time being, it’s a good hack for those really heavy scenes.

Also minor nitpick, even with the _NoEcho, it completely erases the command line history and rewrites it with two lines of random haxadecimal codes (object IDs?), at least in Rhino 6. But I know nothing about Python scripting in Rhino to be able to fix that.

just remove the very last line of the script

Ah, thanks, should’ve realized. With some Google’s help, I managed to replace it with a line (not sure if completely correct)

    print 'Edge softening toggled on %s'%len(changed), 'objects.'

so that I would at least get some feedback.

yep that should do the trick

here’s a different version that works as an on/off rather than a toggle

from System import *
from Rhino import *
from Rhino.Render import *
import rhinoscriptsyntax as rs

def is_enabled(o):
    return Convert.ToBoolean(o.GetCustomRenderMeshParameter(CustomRenderMeshProvider2.EdgeSofteningId, 'on'))

def enable(o,v):
    o.SetCustomRenderMeshParameter(CustomRenderMeshProvider2.EdgeSofteningId, 'on', v)

def toggle_edgesoftening():
    
    on = "On" == rs.GetString("Toggle Edge Softening", "On", [ "On", "Off" ])
    key = 'edgesoftening'
    num = 0
    
    try:
        Display.RhinoView.EnableDrawing = False
        
        for obj in RhinoDoc.ActiveDoc.Objects:
            if on and obj.Attributes.UserDictionary.ContainsKey(key):
                enable(obj, True)
                obj.Attributes.UserDictionary.Remove(key)
                obj.CommitChanges()
                num += 1
            elif not on and is_enabled(obj):
                enable(obj, False)
                obj.Attributes.UserDictionary.Set(key, True)
                obj.CommitChanges()
                num += 1
                
    except Exception as ex:
        print 'An unexpected error occurred: %s'%ex
        
    finally:
        Display.RhinoView.EnableDrawing = True
        print 'Edge softening %s on %s object(s).'%(on and 'enabled' or 'disabled', num)

toggle_edgesoftening()

it will ask to turn softening on or off, and you can use it in a toolbar button like this to turn softening on:

_NoEcho
-_RunPythonScript "c:/Users/<user>/Documents/rhino/toggle-edgesoftening.py" On

or off:

_NoEcho
-_RunPythonScript "c:/Users/<user>/Documents/rhino/toggle-edgesoftening.py" Off

with the added context of whether you are trying to enable or disable, it can better handle what happens when you enable/disable on objects between uses of the script

2 Likes

having the same issue with edge softening, were I hid alot of geometry to work on something and unhideing everything has it hanging and the edge softening error, tried this script and it did give the option to turn it off but then after hitting enter a script error pops up: "global ‘display’ is not defined. Don’t know much about scripting, I just entered the edit python script command, created a new document and pasted in your scripted and saved it and ran it.

update: the first script works, however, it looks like it only toggles objects off that are visible? is there a way to toggle on or off all layers and objects even when hidden?

both of the scripts appear still to work fine in rhino 7 or 8, so check you have copied them exactly

they do not pay attention to visible or not, probably have to use a different way of getting objects to get hidden ones