Let’s forget the Magmas for a second and talk about how Krakatoa renders.
Krakatoa is a volumetric particle renderer. In order to render volumetrically with light attenuation, shadows, and scattering, it needs one or more Lights in the scene, and the Ignore Scene Lights to be OFF. If you want to render a dust color with interactive lighting and volumetic shadows, you need to provide a Color channel that will be scattered into the eye, and you need to reduce the Emission down to zero based on some factor (in your case, based on distance to the birth position, but it could be based on Age, Velocity, anything).
Your original setup for Camera Projection though had completely different (and incompatible with volumetric rendering) settings. We assumed that the texture projected on the particles carries pre-calculated lighting from another renderer, so all we want is fully self-illuminated (incandescent) particles with no lights, attenuation, shadows, scattering etc. So we abused the rgbPP/Color channel to store our birthPosition from the expression, and used a Texture map to write to the Emission channel to produce solid colors in the final rendering.
In order to marry the two approaches, we need to make some changes to the second approach to introduce the volumetric shading of Krakatoa back into the picture. So we need to
*Back up the Color channel into a custom channel (“birthPosition”) as a first step (new Magma you created)
*Input this new custom channel (“birthPosition”) in the old Magma flow to get the correct data for calculating birth-time UVs.
*Input the new custom channel (“birthPosition”) in place of the Color channel to subtract the current Position from the birthPosition.
*Fade off the “Emission” and “Density” channels over distance by multiplying by the factor you calculated.
*Add a new Output channel set to “Color”. Blend between the Red Color and the Emission color based on the distance factor value, and output the result as Color WITHOUT multiplying further.
*Disable the “Ignore Scene Lights” option and create one or more lights.
*At birth your particles will will have the same value for both Emission and Color and will have a Density of 1.0, producing solid fully emissive color.
*As the particles move away, they will start losing Emission - at distance of 4 units, the Emission will be zero. At that point, the Density will also be zero.
*As the particles move away, the projection color (taken from Emission) will be blended more and more with the Red color and will be output as the scatter color of the particle, producing volumetric shading with the scene light(s).
Things to play with:
*Disable the Density channel output node to see the result of the blending of Emission and Color over distance without having the Density fading off too.
*Once you also enable the Density falloff, consider using a different distance-based falloff for the Emission/Color blend, Emission fade-off and Density fade-off. This way, you could control separately the distance threshold and power for when the Emission will become zero, when the Color will become fully red, and when the particle will disappear due to 0.0 Density. You might want the Emission to become zero much earlier but still have some of the unmultiplied Emission in the Color channel before it blends to Red, and then keep the red color for a while before the particle fully disappears…
In your last screenshot,
*the left ? should switch to “birthPosition”.
*the right ? should stay “Emission”, but it should be just “Emission Multiplied By Distance Factor”.
*the right ? should also get another Output set to “Color” with the existing Blend feeding into it but without the Multiply By Distance Factor part.
*Then clone the whole Distance Factor sub-flow two more times and use one to control the Blending, another to control the Density fade off, and the third to control the Emission fade off.
Hope this helps.