SPS system normal mapping

Hi gang,

I’m using a Solid Particle System to manage a ton of little object instances in my scene, and it seems that all the vertex normals on the particles are recalculated, so i’m losing smooth shading on the meshes i’m using as particles. Is this to be expected and/or is there a way to make the particles retain their vertex normals?

pinging @jerome

Each time the particles rotate, the vertex normals are recomputed (rotated also), because they are a part of a global big mesh that is passed at once to the GPU.
So, if your particles don’t rotate after some step, you can then freeze them with

SPS.mesh.freezeNormals()

In this case, you can also notify the SPS that there’s no more need for computing the particle rotations :

sps.computeParticleRotation = false

Both can be canceled at any time. For instance, you can activate the normal rotations only on the frame where particles rotate, then disable them back.

If your particles rotate along the time, you have to deal with the related normal rotations …

1 Like

Sorry to revive this old thread, but I have the same problem (for years, but it never bothered me as much has now) that SPS seems to lose their smooth shading… I tried the above options of freezeNormals() and setting sps.computeParticleRotation to false, but neither seem to work for me.

I’m using SPS mainly to batch static meshes that never move and save on scene.meshes length.

Do you have a PG repro please ?

Aah, I found it, sps.recomputeNormals = false fixes this :slight_smile: also i am using an older version of babylon.js without that flag available.