Hello! I’m Soumya, and I’ll be working on the project to display simulation data for rigid bodies and cloth over the summer, and will post weekly reports here.
Here is the link to the proposal
Comunity bonding period:
work done so far:(17th May - 2nd June)
I’ve been familiarising myself with the code relevant to my project, especially the code in source/blender /draw and UI
With the guidance of my mentors, Sebastian Parborg and Sebastián Barschkis,I learnt how to draw a basic arrow(vector) in the viewport, and how to make UI panels.
Rest of the week:(till 7th June)
I plan to continue to read and understand the code, especially the bullet physics code
This week, I implemented visualisation for gravitational, normal and frictional forces, and forces applied by effectors.
Work that still needs to be done regarding the forces:
Figure out how to set the min and max clamps on the lengths of the vectors displayed
Some impulses are not displayed because(I think) they might have been applied in a substep and were over-written by zero vectors in a subsequent substep of the same timestep.
More tests to see if displayed forces are working properly
The resultant force is in blue, frictional in yellow, and the rest are in pink.
Plan for next week:
Finish displaying acceleration and velocity vectors
I implemented visualisation for collisions with the basic collision shapes. If the collision point lies on a face, the face is highlighted. If not, the entire frame of the collision shape is highlighted.
Implemented visualisation for velocity of rigid bodies
(The purple is only temporary, I will change the colour later so it looks better)
Plan for next week:
There are some issues with the collision visualisation, I will fix those
Visualise rigid body states in the viewport
Start working on displaying complex collision shapes
Worked on some bugs in the collisions and forces display code
I Started started going through the code that is relevant for drawing non-primitive collision shapes, and started planning how to go about it
Here is a clip that shows the states of the rigid bodies: passive rigid bodies are in a darker shade of grey, and animated rigid bodies have a blue tint. (The final colors will be decided after disusing with the UI module)
Plan for next week:
Draw the non-primitive collision shapes (convex hull, mesh and compound)
This week I worked on drawing non primitive collision shapes during rigid body simulations. I spent most of my time exploring two different ways to go about drawing the shapes. I’v been using this doc to put down notes while planning the tasks, and the two methods I thought of have been outlined there. I completed 2 main tasks this week:
I was able to draw the convex hull using one method, but still have some doubts about where I could store the batch or if a different method would be a better way to implement it.
I also worked on scaling compound children’s shapes according to the transform that is used by bullet to create the child shapes.
The selected object is the compound parent, and the 4 cuboids are the children. It is clear in the first image that the normal force(pink arrow) is being applied not on the walls of the child objects, but on the walls of the scaled collision shapes of the child objects.
Plan for next week:
I will take the next few days to finish drawing collision shapes, and then start with the next task, which is visualising constraints in the viewport
I discussed about which method would be best for drawing the convex hull and trimesh with Jeroen Bakker, and as he suggested, I changed the convex hull drawing implementation such that it uses mesh_batch_cache methods instead.
I implemented drawing of the mesh type collision shape using the same method. I still have some doubts about where to validate and free the mesh cache, since these meshes do not belong to objects.
started working on visualising constraints
This is how the convex hull and trimesh shapes look:
I spent the week experimenting with the rigidbody constraints to understand how they work, and planning how to visualise the linear limits
Finished visualisation for the slider constraint when one of the rigid bodies is not moving. The same can be extended to generic and spring constraints, but I haven’t yet figured out how the linear limits are affected by transforms for those constraints.
Worked on the missed forces bug. I think the best approximation would be the average, but taking the average of the forces’ locations creates another problem, the location that the vector is drawn at looks incorrect in some frames. (I gave an example in this document: notes
Pan for next week:
Finish visualising constraints
Spend some time on clean-ups and fixes for the code written so far
I tried to figure out how to get the exact limits of the 6dof constraint, but I couldn’t get very far, so towards the end of the week I worked on implementing visualisation for linear limits of the slider constraint when both objects are active.
Had a discussion with my mentor Sebastian Parborg, as per which the limits are visualised as follows:
The walls are displayed with increasing opacity as the objects get closer to the limit.
The rod between the objects only works like this when the displacement vector of the two objects aligns with the constrained axis. I will have to make a modification to show the lines for other cases.
Pan for next week:
Finish drawing the slider constraint
Finish drawing angular limits for the hinge constraint
Combined the hinge constraint with the walls from the slider to show the limits imposed by the piston constraint.
Fixed bugs in the python UI code and pointcache code
Implemented caching of the previous velocity of rigidbodies, which is required to draw the acceleration vector
Hinge:
Piston:
Plan for next week:
The constraints took longer than expected and I did not get time to work on cloth springs. I will need to spend the remainder of the time on fixes and cleanups, so I’ll have to leave the cloth springs display for after the summer
If I have time, I’ll work on changing the walls of the slider so that they fade with dithered opacity
I spent the week trying to fix some bugs and doing some cleanups. I could not fix all the problems yet.
The constraints do not work with kinematic objects as their transforms are stored differently. I initially wrote the functions using the initial and final transforms which are easily available for active objects. Though I wrote functions to get the transforms from bullet, I’ll need to change way I used the transforms now, so that they work with the format that bullet stores them in.
Moved the collision faces code so that colliding faces are found after stepping the simulation rather than in the draw engine. This is more accurate than guessing which face collided by using the average location of forces and final position of the object.
An better way to do this might be to use collision callbacks, but I didn’t get time to figure this out yet.
Fixed some memory issues in the convex hull draw data function.
I will try to fix more things this week, but I won’t have much time in the second half of the week, as I will be travelling. I’ll work on whatever is left once I’m back