I have a question, this is for anyone who answers this. How do I make materials glow in playcanvas. I want to make an io like game but i can’t see m to figure out how to make it glow?
Hi @jus.co_ding_me_23 ,
So you can increase the emissive value of materials and then use in combination the bloom post process effect. That will work as an full screen effect, materials with high brightness will glow more:
// --------------- POST EFFECT DEFINITION --------------- //
Object.assign(pc, function () {
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];
This file has been truncated. show original
1 Like
it works @Sebastian and @Leonidas ,see the fixed version of my game, i will send in later forum
1 Like
but please send me your project @Sebastian , i dont know where to put all the emmisive stuff
Hi @jus.co_ding_me_23
Could you post your project so I can have a look at it?
here
https://playcanvas.com/editor/scene/1039494
i dont know where to put all the bloom stuff
it shows can not read posteffects of undefined
Heya @jus.co_ding_me_23 ,
simply add the bloom effect as a script to your camera
// --------------- POST EFFECT DEFINITION --------------- //
Object.assign(pc, function () {
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];
This file has been truncated. show original
thanks, i was trying to attach it to the player