On-the-Fly Raster Processing and SLD Application in GeoServer

Dear [GeoServer Support/Community],

I am seeking guidance on whether it is possible to perform an on-the-fly raster calculation in GeoServer to visualize a filtered layer on the map with Openlayers.

Specifically, I am interested in executing an operation similar to the following GRASS GIS r.mapcalc expression:

if(slope_450m_4326@PERMANENT >= MIN_SLOPE_VAL && slope_450m_4326@PERMANENT <= MAX_SLOPE_VAL, sea_depth_450m_4326@PERMANENT, null())

Where MIN_SLOPE_VAL and MAX_SLOPE_VAL values are user input.
Additionally, I would like to know if such an operation can be achieved through the application of an SLD style, like the application of a filter on a single layer. If GeoServer does not support this functionality directly, I would greatly appreciate your advice on the best method to achieve this result.

Thank you for your assistance and expertise on this matter.

Kind regards,
Sara