Script : Harden edges of all UV borders (break Phong shading)
kisaf last edited by
Hi, I'd like to present you a simple script.
It let you automatically select all UV borders and break their Phong shading, that might be useful for game modeling, especially with hardsurface props.
More info about hard edges - http://www.polycount.com/forum/showthread.php?t=107196
Unfortunately, the 'Texture View' window must be opened at least once for properly work :(
Just close 'Texture View' and continue work.
Download link: https://github.com/rocketjump4d/UV2PhongEdges
mp5gosu last edited by
Thanks for that script. I wrote something similar some years ago but never finished it.
As you commented in your source, there's a huge bottleneck in performance somewhere so it needs definitely some more work. Also, there are are some polys selected on processing end, the selection should be restored after the process.
Plus, please add Undo - absolutely neccessary!
But nice work so far. :)
I'm pretty certain, if you work out a more low level variant, without the need to open texture view, it will become a huge tinmesaver.
kisaf last edited by kisaf
Hi @mp5gosu, thank you for your feedback!
Yep, it has Undo problem. I assume, it's because the script uses
CallCommand. And there are 2 places where I still don't understand how to avoid this :(
the selection should be restored after the process
Thank you for this remark. I'm gonna fix it asap.
EDIT: I've fixed the script. Now it restores the selection after the process.
a_block last edited by
CallCommand() is exactly the same as a user choosing a command from the menu or clicking a palette button. So, indeed using CallCommand() most likely involves the creation of an undo step, and there no means to avoid. So, as soon as your code creates additional custom undo steps or makes use of CallCommand() multiple times, multiple undo steps are inevitable.
The only workaround would be to do the work done in a command manually. For certain commands it may be easily achievable as the API provides functions toi achieve the same directly, for other (and unfortunately most) commands it will involve more work, up to the point of re-engineering the internals of one of our commands.