Skip to content

Custom Copernicus Operators

Blend height maps

opencl
// run with opencl
#bind layer height1? fpreal val=0
#bind layer height2? fpreal val=0
#bind layer !&dst
// bind parameters
#bind parm blend float
@KERNEL
{
float base = 0;
float height_start = max(@height1, @height2) - @blend;
float level1 = max(@height1 - height_start, base);
float level2 = max(@height2 - height_start, base);
float result = ((@height1 * level1) + (@height2 * level2)) / (level1 + level2) ;
@dst.set(result);
}