Slope

Detect edges and compute slope gradients from images.

What it does

Slope measures how quickly brightness changes from pixel to pixel and turns that change into colour. Method picks the operator: Sobel for the best quality, Prewitt for a faster pass, Laplacian for edges that favour no direction. Output picks what is packed: the default Slope mode stores horizontal change, vertical change, edge strength and edge angle together in one image, or isolate Magnitude (edge strength as grey), Direction (edge angle as colour), or a single X or Y gradient.

Slope also reads a Volume, tracing the same gradient in three dimensions, where Direction packs magnitude, azimuth and elevation instead of a flat angle. Fed a 3D scene rather than an image, it renders the scene's depth, normals or object silhouettes first and finds edges in that.

When to use it

ParameterTypeDefaultWhat it does
content_inColor Field or Volume or Collection——
cameraCamera3D—Camera viewpoint for geometry rendering. Uses scene camera if not connected.
sourceString"Color"Which G-buffer to detect edges on. Color: full render, Depth/Normal/Object ID: single buffer, Combined: weighted blend of all three. One of: Color, Depth, Normal, Object ID, Combined.
methodString"Sobel"Sobel: best quality, Prewitt: faster, Laplacian: omnidirectional. One of: Sobel, Prewitt, Laplacian.
outputString"Slope"Slope: packed RGBA (dX, dY, mag, dir), Magnitude: edge strength, Direction: angle as color, X/Y: directional gradients. One of: Slope, Magnitude, Direction, X-Gradient, Y-Gradient.
strengthNumber1Multiply gradient intensity (1.0 = normal)
thresholdNumber0Edges below this strength are hidden (0 = show all). Ignored in Slope mode.
invertBooleanfalseSwap black and white — negates the output RGB (dark edges on light background). Applies in every output mode.
depth_weightNumber1Weight of depth edges in combined output
normal_weightNumber1Weight of normal edges in combined output
id_weightNumber1Weight of object boundary edges in combined output
spatial_strengthField—Spatial field controlling where the effect applies (0=bypass, 1=full)

Gotchas

Threshold affects Magnitude mode only. It is ignored everywhere else, including the default Slope output.

The Camera and Source controls appear only once a 3D scene is wired in. With an image input they stay hidden and Slope reads the image directly.

Invert flips black and white in every output mode, not only Magnitude, so it gives light edges on a dark background or the reverse.

Worked example

  1. Add a Slope node and wire an image into it. Leave Method on Sobel and Output on Slope for the default packed result.

  2. Switch Output to Magnitude to isolate edge strength, then raise Threshold to drop faint, noisy edges.

  3. Turn on Invert for light edges on a dark background.

  4. To trace edges on a 3D scene instead, wire a Geometry input in and pick a Source such as Normal or Object ID for a clean silhouette pass.

See also

Emboss · Normal Map · Sharpen · Rasters (images)