-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Further Performance improvements #12
base: master
Are you sure you want to change the base?
Further Performance improvements #12
Conversation
Thank you ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's really hard to read imo, if this can be formatted in a better way, I'd be glad to improve it!
I've always found the python way of writing inline ifs (ternary) very readable, as in you can read the line of code in English and it makes sense.
No problem with readability in my opinion.
I'm glad to hear this increases performance, because it clearly increases the overall readability too 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice, and a lot more readable again ! Good job.
If I could, I would format it like this. It's a bit easier to see what happens in each case at a glance, in my opinion.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really like using a class for a single, may I say constant, variable.
I think the function (as it was in your previous commit) is better.
I'm the kind of dev that likes to use OOP only when it really makes sense, and keep to functions and data structures for the rest.
I don't think it resolves the problem of "If the object's geometry changes, you have to refresh manually", right ?
Here is what I propose:
This is an extra boost of real-time performance, for the ones that really need it. So why not use the same principle as the "cache" functionality found in many places in Blender ?
You would manually choose to "cache" a mesh for TensionMap, enabling this performance gain.
But since you manually chose to enable cache, then it's okay to have you update the cache when you change the mesh.
That way, most users have the current behaviour of auto updating every frame, but don't have the hassle of updating the mesh in TensionMap manually everytime.
And the hardcode real-time users can choose the functionality, knowing they will need to manually update.
If you don't want to work on the UI part of this, let me know, I'll gladly do it.
I'll take your current work here, turn it into a function, and link it to the UI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I like this.
But it would be under the same optional "cache" behaviour, because again, when you change your mesh, you would need to manually update the TensionMap. See my other comments.
One line is fine by me. It starts to take more room than it really should otherwise. |
Caching is a really fitting name for it! Sounds good.
I'll try it myself next week, the UI part didn't seem too complicated. |
Alright. When the cache is enabled, the button is replaced by two buttons (in the same line maybe) that say "Disable cache" and "Update Cache". The update of the Cache would need to stop being linked with Have fun coding :) |
…tically each frame if caching is disabled.
Okay, I re-implemented it as a cache. |
using BMesh for faster edge length calculation made clamp use def, not assignment as per E731 fix: channel size set to 4, not 2 removed a variable when setting colors_tension_data for a minor performance boost
I added some more performance improvements by using bMesh: |
Hey, Haven't had much time recently. I'll be sure to test & merge your changes as soon as I can. Thanks for the contributions ! |
Hey, did you have time to look over it yet? |
Hey, |
Alright! I'll wait for a notification then. |
Hello,
I sat down and tried to get a bit more performance out of the script.
Baseline, vertex colors only: 23,8 fps
I made the following changes, one per commit:
I now get 31,32fps with all those changes together.
I'll mark this as draft for now, since I want to look into it a bit more, but your input would be appreciated!