Hi there, I was hoping I’d get some help on how to adjust saturation and brightness values for some instances of a mesh. I’d like to have a way of specifying different values for different mesh instances depending on the position of the instance on the scene.
Hello if you are using instances the only thing you can control are position/rotation and scaling
You can also use instanced buffers to change the color: Instances | Babylon.js Documentation
thanks @Deltakosh, I have looked at instanced buffers but I want to do saturation and pixelation effects on the instances so I don’t think these will help for this. I am now looking at PostEffects to do this. But I am not good at writing shader code. I wonder if there is a codebase that I can look at to see how to add mesh instances and remove them dynamically from these post effects. I am researching about this and any help on this will be much appreciated as I think it is the best way around this.
I have created the post effects using the ImageProcessing FX, but now I am not sure how to add this effect to a renderList that I can update to add meshes and remove meshes rather than doing it for the entire scene.
// convert it to [-100, 100] from [-1, 1]
let sv = saturation_value * 100
let bv = brightness_value * 100
if (!sv) {
sv = 0
}
if (!bv) {
bv = 0
}
const postProcess = new BABYLON.ImageProcessingPostProcess(
'processing',
1,
this._camera
)
const config = new BABYLON.ImageProcessingConfiguration()
const curve = new BABYLON.ColorCurves()
curve.globalExposure = bv
curve.globalSaturation = sv
config.colorCurvesEnabled = true
config.colorCurves = curve
postProcess.imageProcessingConfiguration = config