Revised mesh tension add-on

Excellent as hell! It’s definitely a dramatic improvement. Even though it’s still not close to realtime, it’s now fast enough for me to to be able to preview the tension maps and dial them in! Thanks for sticking to this.

1 Like

Huh. New problem. After a day and a power cycle, rendering an image now results in a complete crash to desktop.

not good! i haven’t been able to reproduce on my end yet, so any simple scene that demonstrates the issue would be much appreciated!

edit: i’ve managed to get a somewhat reproduceable crash as i’m working on a tension spread feature. i’ll work at isolating the cause

1 Like

Yeah, I’m using the addon on a pretty complex character, I didn’t think the issue would be recreatable in a simpler one. But if you’ve got it, you’ve got it!

Let me know if you want me to pack something up to send to you. It’d be kinda overwhelmingly big though.

1 Like

i solved my own crashing issue, however i’m not sure if its the same one you were experiencing. it stemmed specifically from code in a new ‘spread’ feature which wasn’t in version 1.4. but on the off chance anything accidentally fixed it, you’re welcome to give version 1.5 a try (see the first post again for the update).

failing that, have you determined if reverting to 1.3 resolves your crash? trying to determine if it was definitely something introduced in 1.4.

1 Like

Does it need to do this by itself? I dont see this happening.

PS does this also work on cloth animations?

EDIT
well i dont see it in the code as an generative mode. I do see the strectch vgroup change when i go into edit mode and backout of it.

PS do you function A to call function B to do the update? you call function call_list_refresh to do refresh in a different function, doesnt make sense to me?

Also on line 42 you have context without bpy before it. it doesnt raise an error, but this is i believe an error.

call_list_refresh() is specifically a callback function from updating certain variables. i wanted to separate it out from the more generalized list_refresh() function that gets called in other situations. it might be safe to combine the two cases, but i like to separate them out for troubleshooting.

you are correct about the line 42 mistake, thanks for catching. originally that code was in call_list_refresh() which passes context as a variable, and i forgot to fix it when i made it its own function.

to your earlier question about vertex groups and colours, it should create the groups/colors if they don’t exist, using functions get_vcol and get_vgroup:

def get_vcol(ob,name):
    vcol = ob.data.vertex_colors.get(name)
    if not vcol:
        vcol = ob.data.vertex_colors.new(name=name)
    return vcol

def get_vgroup(ob,name):
    vgroup = ob.vertex_groups.get(name)
    if not vgroup:
        vgroup = ob.vertex_groups.new(name=name)
    return vgroup

lastly, cloth is a deforming modifier in blender so it is detected by the tension calculations (or skipped by appending ‘_SKIPTENSION’ to the modifier name):

1 Like

Thanks for the fast reply!

Aha thats why you separated it, i wasnt sure looked a bit weird as well. You could wrap them into one function, but this works as well.

But the update rate on cloth meshes, should that show realtime when cycling frames? I only see it happen when either cycle a frame go into edit mode and back and then check vertex paint mode. Otherwise i see the the same vertex paint group and nothings changes.

I tried lookingup all this info but couldnt find info related to how it actually updates and what is happening

PS how do you get such smooth stretching to show? Im not sure what you are previewing, looks like vertex group.

Mine looks like this, almost default cloth with pinning. Seems to be showing weird tension per face in the plane.

Tensionmap-cloth-bl291.blend (1.2 MB)

it looks like you edited the mesh with a subdivision after enabling tension. the results are incorrect if you edit the vertices of the mesh after enabling tension.

right now, clicking the little ‘refresh mask’ button next to the vertex mask is enough to get it to regenerate the tension data. this is a bit obscure so i may make that button a little more prominent/better messaged as its useful for more than just refreshing mask data.

i don’t update the meshes rest state on every update to try to help performance, but the down side is it needs to be manually refreshed when you edit the mesh.

the visualization i was using was the vertex colours, but the weight paint should also be correct, thought it only currently auto updates in object mode.

from your file:

1 Like

Thanks man! That worked like a charm, i cant really remember the order. I do know i had always update on. I did check that button since it looked related to that mask option. Since its not 100% related to that, wouldnt it better to make perhaps a larger button, like a global update? Just stating my experience without any knowledge of the product. Perhaps i missed it in some posts, i did not all posts in this thread yet.

Since “always update” can be on without it doing a proper job. Perhaps rename the updated forced update.

rough sketch

I had more luck this time. Looks much better!

Earlier i asked about preview updates, perhaps you missed it. But the vertex groups only visibly update when you enter edit mode and return to object mode correct?

Just tried test animation, even though i set render size to half 1080 it keeps crashing after say 10-20 frames. Im rendering to MP4, not sure if frame sequence would solve this. I did have the lock frame enabled.

i was able to replicate your crash. it appears to be an issue with my attempts to optimize performance. i used version 1.3 and was able to render without issue. (also it does automatically recalculate rest tension on every update). anyway if you’re looking to get a render out, i’d suggest that one until i can figure out what the issue is.

1 Like

Thanks for looking into this. If you want the blend file let me know

Upon further testing, it appears the addon doesn’t work through linked assets. I’ve got a character pulled into another scene, and the tension maps won’t appear no matter what setting is on or off. I even made the mesh and material local and it’s still not updating the vertex colors.

1 Like

that is a good point. its less the material than the mesh and object that the add-on needs to be able to update. were both the mesh and its encapsulating object made local? i see vertex groups are object level, and vertex colours are object data level. i’d have to look into it more to know if these types of data are library overrideable, since that would be the ideal.

1 Like

Yep! It’s all local. Going into vertex paint mode to test the non-tension map stuff I had just crashes blender, so I can’t really see myself if they’re object data level unfortunately.

Hey guys! Is it possible to run it on multiple objects in one scene? I have two deforming objects and the masks work only on one of them at a time.

Man, It’s looking more and more like this is just something we gotta pester the official devs about. We need the G U T S.