-
Notifications
You must be signed in to change notification settings - Fork 20
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
Mesh Motion Blur with VTK data #108
Comments
Hi Dominik, from you node setup I see you try to visualize particles, so you're after motion blur for particles, I assume. I haven't really pursued motion blur after 2020, and I don't know if Blender nowadays has this capability via Python. I tried a quick search on devtalk.blender.org but did not find anything new. I sort of expect this would be possible via Blender simulation nodes, but I haven't followed up with that. If anyone finds a way, please comment below! The way I can think of to do this now is to use object keyframing: skip BVTKNodes and use custom Python to create every particle as a single object and then set keyframes for each object according to particle velocity. However, this will not work for even a "medium" number of particles, since Blender will become quickly too slow with many objects in a scene. |
Thank you @tkeskita. I am wondering if it may be possible to extract the particle velocity and add them to the "Velocity" vector for the "Vector Blur Node" in the compositor. Could that be a workaround? The Blender internal simulations support such a feature. |
Not sure if it helps, but the Blender Add-on "VisualSPHysics" allows motion blur from vtk data. Do you think one could implement that? I would try and do the work (in November). But it would be good for me to know if this is even feasible. |
Hi, it seems that VisualSPHysics uses Shape Keys for saving velocity of each vertex to get motion blur. A very nice find! I think it could work! For BVTKNodes, it would only require that you specify name of the VTK vector point field to be applied for the vertex motion blur. Logical place for this entry would be the VTK to Blender Mesh node. Please go ahead! I'll wait for you to give it a try. BR, |
Unfortunately, I’ve run into a problem when I turn on automatic node update for rendering animations in Blender. If motion blur is switched on with a shutter setting of 1, Blender seems to load data from the previous and current frames. This ends up overwriting the keyframes I've set up, which causes some odd artefacts. I’ve tried using Do you have any advice or know if there's a method to detect this? Any help would be great! |
Hi, great, image looks awesome! Do you have your code already in github to view it? I didn't quite follow what exactly happens in you problem, can you please elaborate step by step? Does shutter value 0.99 work fine? What are you doing with keyframes? What kind of odd artefacts? BR, |
Hi @dwerner95 I'm planning to add this Shape Key motion blur method to BVTKNodes during xmas holiday break. Could you please share your code with me so I can work on that? Code does not need to be super clean, I can modify it as necessary. Thanks! BR, |
hey @tkeskita, apologies for the silence on here. i will upload it to my branch over the weekend and let you know! |
Hey @tkeskita! I've pushed to code to a new branch in my Fork (see here). Would you like me to open a pull request? The code itself works as long as you want to generate a static frame. If I include a TimeSelector and automatic frame updates, it breaks down due to the way motion blur works in blender. I try to explain it again in a way i understand it, and that might be wrong: However, when using BVTKNodes, a complication arises. The act of "looking ahead" to the next frame inadvertently triggers BVTKNodes to load new data from VTK files. Furthermore, if BVTK-motion blur is enabled, this process also resets certain keyframes that are essential for creating the BVTK- motion blur effect. As a result, the frame generation gets disrupted, leading to a chaotic output instead of a smoothly rendered motion blur. Ideally, to address this issue, there would be a way to distinguish whether Blender is processing a frame as the primary frame to be rendered or as an auxiliary frame for calculating motion blur. This differentiation would prevent BVTKNodes from unnecessarily resetting keyframes or loading new data when it's only rendering frames for motion blur. Unfortunately, I haven't been able to find such a flag or feature in Blender that provides this specific information. I am keen to see how we could get around this issue. Another thing worth mentioning: When using a large I got different errors depending on the shutter time: This is not a problem for me, as those timesteps are way to large anyways, however it might be for other people.Apologies again for the delay. November was busier than anticipated! Best wishes, Dominik |
Hi, |
Hi @dwerner95 |
Hi @dwerner95 I spent today looking at this. I've made a lot of modifications to your code while debugging. Would it be OK for you if I don't use your commits (= no need for pull request, since I don't merge your branch to master), but instead mention your contribution in my commit as a comment? Or, I can wait for your pull request, accept it, and then modify, either way works. At least one bug I've found is that the values for shape key layer must be co + vel*timestep and not just vel like it seemed to be in VisualSPHysics code.. Update: I found out that if you use motion blur Position type "Start on Frame", then the frame does not change during rendering of animation and you get correct motion for the blur for the frames! BR, |
Hey @tkeskita! Good to hear that it works! I am ok with you uploading it yourself! Beat wishes, |
- Thanks to Dominik Werner (dwerner95) for looking up this Shape Key animation technique and the initial implementation (#108)! - Motion Blur option is available in the VTK To Blender Mesh node. You need to specify a point vector array name applied for motion blur, as well as a time step between frames for calculating blur length. Motion blur is calculated for forward linear transformation. - Added optional motion blur to example tree cubeflow_vector_glyphs. Enable motion blur for particles mesh to see the effect. - Bumped version number to 0.11 to mark this new feature.
Hi, BR, |
Hello @tkeskita, Thanks for implementing this feature. It's performing excellently for individual frames on my end; I haven't attempted to use it for animations yet. I have a query regarding the computation of the shape-key mesh with the following code:
My question is about the use of the factor of two. If I'm not mistaken, the time step for motion blur is supposed to match the camera's shutter speed. Wouldn't multiplying it by two essentially double this value? Could you explain the reason for this choice? Best Wishes, |
Hi @dwerner95 , I now think maybe that failure is related to non-linear default key frame value interpolation, that should be checked. Please leave this issue open until this is confirmed. |
Hi @dwerner95, I tested briefly and it looks like I could get some motion blur even in animation after changing line https://github.com/tkeskita/BVtkNodes/blob/master/converters.py#L736 to |
- Keyframing for mesh motion blud with shape keys is now set for current frame and next frame. Found out a way to change shape key fcurve interpolation to linear type, to get rid of the default bezier interpolation causing initial location "burning" in the image.
Ok I found a way to change the interpolation to linear, so I removed the velocity scaling. Key frames are now set to current and next frame. Please let me know if there's still issues thanks! |
Hey @tkeskita,
i am currently working on a project for which i must generate images from simulations that should be as realistic as possible, therefore I need some motion blur.
I tried playing around with it without success.
My current workflow is quite simple:
plus the time selector
I understand that the motion blur system in blender works by interpolating the positions of the mesh between frames, however, technically this mesh is not moving, it is generated new in each frame and there is no way for blender to figure out how the movement was done.
I read that you were talking about something motion blur related 2 years ago, was there any success with this?
Thank you, Dominik
The text was updated successfully, but these errors were encountered: