I have many objects that I want to glow, what is the best way to do this?
What do you mean by glow?
1 Like
I have a lot of objects and I want an effect like “bloom” that means the objects are illuminated
1 Like
Hi @Jan_Honor ,
You can use a bloom post effect (this applies to all objects) and set/increase the emissive color of your objects to control the glow on these specifically.
// --------------- POST EFFECT DEFINITION --------------- //
var SAMPLE_COUNT = 15;
function computeGaussian(n, theta) {
return ((1.0 / Math.sqrt(2 * Math.PI * theta)) * Math.exp(-(n * n) / (2 * theta * theta)));
}
function calculateBlurValues(sampleWeights, sampleOffsets, dx, dy, blurAmount) {
// Look up how many samples our gaussian blur effect supports.
// Create temporary arrays for computing our filter settings.
// The first sample always has a zero offset.
sampleWeights[0] = computeGaussian(0, blurAmount);
sampleOffsets[0] = 0;
sampleOffsets[1] = 0;
// Maintain a sum of all the weighting values.
var totalWeights = sampleWeights[0];
// Add pairs of additional sample taps, positioned
This file has been truncated. show original
Check this example on how bloom is used:
https://playcanvas.github.io/#/graphics/post-effects
1 Like
Great, thank you, what should I do if I don’t want some objects to have “glow”?
That’s more complex, check this post:
I would probably do this:
change the current camera that render the world to be at priority 1 (so it renders second)
add a child camera to current camera, with the same perspective settings. Making it a child should make it have the same transformation. Call it BloomCamera, set its priority to 0 ( so it renders first), add a layer to it with objects you want bloomed. And set it up to render to a render target texture. And clear color to black on this camera.
Attach bloom postprocessing to this…