Sister blog of Physicists of the Caribbean. Shorter, more focused posts specialising in astronomy and data visualisation.

Friday 19 February 2016

Improved SPH particle visualisation in Blender



Today's, "I'm waiting for my simulations to finish" side project : improve visualisation of particle data.

A long-standing issue I've had with using Blender's halos to display particles (raw data example shown on the left) is that when you have many halos in close proximity, the halo opacities sum up so the circular shape of the halos is revealed (I call this the "glowing orbs problem", middle panel). Normally you can't just lower the opacity so that the total is lower, because in other regions the particle density is much lower so that would make most particles invisible. Sometimes that's a good thing - maybe you don't care about the low-density stuff, or you want to emphasise the density contrast - but often you want to show everything that's going on and preserve the density contrast.

Fortunately (?) smoothed particle hydrodynamics is more complicated than just taking a bunch of particles with gravity and seeing what happens. Particle properties are smoothed over different kernel sizes, which depends on the particle density. So each particle is assigned a different "smoothing length", in this case chosen to contain 50 particles. The bottom line is that you can think of each particle as having a finite size, which can be used to set the halo size in Blender (right panel).

What that allows you to do is resolve very dense features and display them as the bright but small structures they really are, without losing the diffuse material. Lots of tweaking still to do to get this optimised, but it's clearly far better than using a fixed halo size.

Since in Blender creating 10,000 unique objects and materials is the equivalent of shouting rude words at your computer and questioning its parentage, I use the smoothing length to bin the halo size so there are only 100 unique objects, not 10,000 (but still 10,000 vertices, which Blender has no problem with). This is pretty fast for loading a single frame, not sure how well this will work for animations but I think it should be OK.

No comments:

Post a Comment

Back from the grave ?

I'd thought that the controversy over NGC 1052-DF2 and DF4 was at least partly settled by now, but this paper would have you believe ot...