AWS Thinkbox Discussion Forums

Density Vs Alpha Fade

Hi, first time posting here, I’m new to Krakatoa, and have been very impressed.

My question is about alpha value in world-space for each particle. From what I can see tweaking the density at each particle can achieve ‘alpha-like’ effects, but those can be counter intuitive because of the interactions with lighting and the actual number of particles. Specifically, I’m using particle clouds very similar to the attached from a previous post (figure at the bottom). Where most of the space has no particles and where there are particles, there are many stacked nearly ontop of each other (to create the appearance of solid ‘wires’). When the density gets scaled down, depending on lighting etc… they begin to glow very brightly, then eventually start to fade out, but that ‘fade’ only happens between some very low density values (ie: .000001 to .00000001). Additionally problematic, that scale is dependent on how many particles are present in the wires, which changes often, making it difficult to establish a way to reliably alpha-fade out some of the wires.

I’m wondering if there is an easier way to handle a fading per particle (I want to fade some ‘wires’ and not others) directly either with alpha per particle, or some other trick that may be easier to handle then tinkering with the somewhat finicky seeming density fade.

-Thanks a million
-Tyler

Krakatoa is a volumetric renderer, and the Alpha values you see in the image are indirect result of density calculations. The Alpha reflects how much light would be blocked by the particles in a specific pixel. It depends on the values in Density, Color and Absorption channels (if enabled). For example, even if Density is high, if Color is set to black and Absorption is set to black and Emission is set to black, the particle will have no Alpha at all (as it would not scatter or absorb any light). If Emission is non-zero, then the particle will be fully additive, zero alpha, but non-zero RGB that would be added on top of the pixels behind it when compositing.
This is a relatively nice introduction into what happens: thinkboxsoftware.com/krak-mi … and-volum/

There are two types of “density” involved here, as you noticed yourself - the per-particle “density” value which determines how much a particle contributes to a cubic unit of space, and the actual number of particles per unit of space. Obviously, with each particle carrying a Density value, the more particles land in the same area of space, the higher the Density the renderer will reflect in the final image pixel. This affects both how much light will be absorbed, and how high the Alpha will be. As the Density is reduced in some areas, the amount of light passing through the cloud can increase, potentially illuminating particles that used to be in shadow. If you add Emission to the equation, things get even more difficult as particles can have their own light coming out of nowhere, and can begin to glow if the emission is not adjusted properly (for example by multiplying the Emission channel by the Density in Magma).

Using my own Hairy Teapot scene, I was unable to reproduce the issue you mentioned where particles start glowing at low densities.

So I will need more information here to be sure we are on the same page:

  • Are you using any Emission for rendering?
  • Do you definitely need volumetric lighting / shadow casting for your rendering, or would more stylized self-illuminated particles also work?
  • Could some of the effects you are after be done in post using multiple passes rendered in Krakatoa, with the Alpha animation performed in a compositing application? (this is usually tricky with volumetric rendering, but it really depends on the case).

It would be possible to bake the lighting into the Emission channel to keep the shadows around all the time. You would resave the particles to a new set of PRT files with the lighting already included, and then you could tweak the Density for the fading effects without affecting the dynamic lighting.

There isn’t much you can do about the variable density caused by more or less particles in the same spatial area. Possibly resampling the Density values using Magma and ParticleSumRadius from a clone of the PRT Loader to adjust the Density channel based on the number of neighbors in a certain small range could work, but I have never tried that.

Thanks for responding so quickly. For now I’m using volumetric lighting, though I just briefly tried emissive and it looks like setting all density to 0 (To remove black wires over emissive wires) and scaling down emission does have a ‘fade’ effect that will likely work, but has a different overall look than volumetric lighting (which could be a problem down the line).

The idea of baking the lighting into the emissive channel seems interesting and could likely work, so long as the lighting remains constant in the animation, or I automate a two-step process for each frame. I’ll try to give that a shot a bit later.

Thanks for the reply, this was alot of help =)

Privacy | Site terms | Cookie preferences