ageller / Firefly

A WebGL interactive particle viewer
GNU Affero General Public License v3.0
64 stars 12 forks source link

move conditionals out of shaders #90

Open agurvich opened 2 years ago

agurvich commented 2 years ago

having conditionals in the shader degrades performance (apparently). what if we made ~4 different shaders and then compiled them then created materials for each of the particle groups at startup and then had the UI swap between materials rather than create new ones all the time.

Do something like:

viewerParams.partsMaterials = {'PartType0':[defaultShader,velocityShader,columnDensityShader]}

or maybe a dict

{'Partype0':{'default':defaultMaterial, 'velocity':velocityMaterial, etc.