Working with 3D Effects and Visual Effects — Aspose.Slides FOSS for .NET

This guide shows how to apply visual effects and 3D formatting to shapes in PowerPoint presentations using Aspose.Slides FOSS for .NET. Every shape exposes two formatting objects:

  • EffectFormat (shape.EffectFormat): 2D visual effects — shadow, glow, soft edge, blur, reflection
  • ThreeDFormat (shape.ThreeDFormat): 3D appearance — bevel, camera projection, light rig, material, extrusion depth

Both formatting objects persist through save/reload cycles.


Visual Effects (EffectFormat)

Outer Drop Shadow

Call ef.EnableOuterShadowEffect() to activate the outer shadow, then set BlurRadius, Direction, Distance, and ShadowColor:

using Aspose.Slides.Foss;
using Aspose.Slides.Foss.Drawing;
using Aspose.Slides.Foss.Export;

using var prs = new Presentation();
var shape = prs.Slides[0].Shapes.AddAutoShape(ShapeType.Rectangle, 100, 100, 300, 120);
shape.AddTextFrame("Shadowed Text");

var ef = shape.EffectFormat;
ef.EnableOuterShadowEffect();
ef.OuterShadowEffect.BlurRadius = 10;      // softness in points
ef.OuterShadowEffect.Direction = 315;       // angle: 315 = upper-left cast
ef.OuterShadowEffect.Distance = 8;          // offset in points
ef.OuterShadowEffect.ShadowColor.Color = Color.FromArgb(128, 0, 0, 0);  // semi-transparent black

prs.Save("shadow.pptx", SaveFormat.Pptx);

Common Direction values: 0 = right, 45 = lower-right, 90 = down, 270 = up, 315 = upper-left.

Glow Effect

Call ef.EnableGlowEffect() to add a colored glow around the shape, then set Radius and Color.Color:

using Aspose.Slides.Foss;
using Aspose.Slides.Foss.Drawing;
using Aspose.Slides.Foss.Export;

using var prs = new Presentation();
var shape = prs.Slides[0].Shapes.AddAutoShape(ShapeType.Ellipse, 150, 100, 200, 200);

var ef = shape.EffectFormat;
ef.EnableGlowEffect();
ef.GlowEffect.Radius = 15;
ef.GlowEffect.Color.Color = Color.Gold;

prs.Save("glow.pptx", SaveFormat.Pptx);

Soft Edge (Feathered Border)

Call ef.EnableSoftEdgeEffect() to add a feathered border around the shape, then set Radius to control the feather distance in points:

using Aspose.Slides.Foss;
using Aspose.Slides.Foss.Export;

using var prs = new Presentation();
var shape = prs.Slides[0].Shapes.AddAutoShape(ShapeType.Rectangle, 100, 100, 350, 180);

var ef = shape.EffectFormat;
ef.EnableSoftEdgeEffect();
ef.SoftEdgeEffect.Radius = 12;   // feather radius in points

prs.Save("soft-edge.pptx", SaveFormat.Pptx);

Blur

Call shape.EffectFormat.SetBlurEffect() with a blur radius and a grow flag to apply a blur effect to the shape:

using Aspose.Slides.Foss;
using Aspose.Slides.Foss.Export;

using var prs = new Presentation();
var shape = prs.Slides[0].Shapes.AddAutoShape(ShapeType.Rectangle, 100, 100, 350, 180);

shape.EffectFormat.SetBlurEffect(8, true);

prs.Save("blur.pptx", SaveFormat.Pptx);

Checking and Removing Effects

Check ef.IsNoEffects to detect whether any effect is active, then call DisableOuterShadowEffect() or DisableGlowEffect() to remove specific effects:

using Aspose.Slides.Foss;

using var prs = new Presentation();
var shape = prs.Slides[0].Shapes.AddAutoShape(ShapeType.Rectangle, 100, 100, 200, 100);
var ef = shape.EffectFormat;

ef.EnableOuterShadowEffect();
ef.EnableGlowEffect();
Console.WriteLine($"Has effects: {!ef.IsNoEffects}");  // True

ef.DisableOuterShadowEffect();
ef.DisableGlowEffect();
Console.WriteLine($"Has effects: {!ef.IsNoEffects}");  // False

3D Formatting (ThreeDFormat)

Bevel Effect

Set tdf.BevelTop.BevelType to a BevelPresetType value and configure Width and Height to apply a bevel to the top face of the shape:

using Aspose.Slides.Foss;
using Aspose.Slides.Foss.Export;

using var prs = new Presentation();
var shape = prs.Slides[0].Shapes.AddAutoShape(ShapeType.Rectangle, 150, 150, 250, 120);
shape.AddTextFrame("3D Button");

var tdf = shape.ThreeDFormat;
tdf.BevelTop.BevelType = BevelPresetType.Circle;
tdf.BevelTop.Width = 12;
tdf.BevelTop.Height = 6;

prs.Save("bevel.pptx", SaveFormat.Pptx);

BevelPresetType values: Circle, RelaxedInset, CoolSlant, Divot, Riblet, HardEdge, Slope, Convex

Camera Preset

Set tdf.Camera.CameraType to a CameraPresetType value to change the projection angle applied to the 3D shape:

using Aspose.Slides.Foss;
using Aspose.Slides.Foss.Export;

using var prs = new Presentation();
var shape = prs.Slides[0].Shapes.AddAutoShape(ShapeType.Rectangle, 150, 150, 250, 120);
var tdf = shape.ThreeDFormat;
tdf.BevelTop.BevelType = BevelPresetType.Circle;
tdf.BevelTop.Width = 10;
tdf.Camera.CameraType = CameraPresetType.PerspectiveAbove;
prs.Save("camera.pptx", SaveFormat.Pptx);

Light Rig and Material

Set tdf.LightRig.LightType and tdf.LightRig.Direction to control how light falls on the shape, then set tdf.Material to one of the MaterialPresetType values:

using Aspose.Slides.Foss;
using Aspose.Slides.Foss.Export;

using var prs = new Presentation();
var shape = prs.Slides[0].Shapes.AddAutoShape(ShapeType.Rectangle, 150, 150, 250, 120);
shape.AddTextFrame("Metal Button");

var tdf = shape.ThreeDFormat;
tdf.BevelTop.BevelType = BevelPresetType.Circle;
tdf.BevelTop.Width = 10;
tdf.BevelTop.Height = 5;
tdf.Camera.CameraType = CameraPresetType.PerspectiveAbove;
tdf.LightRig.LightType = LightRigPresetType.Balanced;
tdf.LightRig.Direction = LightingDirection.Top;
tdf.Material = MaterialPresetType.Metal;
tdf.Depth = 20;

prs.Save("3d-metal.pptx", SaveFormat.Pptx);

MaterialPresetType values: Standard, Warm, Cool, Plastic, Metal, Matte, WireFrame


Combining 2D and 3D Effects

You can apply both EffectFormat and ThreeDFormat to the same shape:

using Aspose.Slides.Foss;
using Aspose.Slides.Foss.Drawing;
using Aspose.Slides.Foss.Export;

using var prs = new Presentation();
var shape = prs.Slides[0].Shapes.AddAutoShape(ShapeType.RoundCornerRectangle, 150, 150, 300, 120);
shape.AddTextFrame("Premium Card");

// Solid fill
shape.FillFormat.FillType = FillType.Solid;
shape.FillFormat.SolidFillColor.Color = Color.FromArgb(255, 30, 80, 180);

// 3D bevel
var tdf = shape.ThreeDFormat;
tdf.BevelTop.BevelType = BevelPresetType.Circle;
tdf.BevelTop.Width = 8;
tdf.Camera.CameraType = CameraPresetType.PerspectiveAbove;
tdf.Material = MaterialPresetType.Plastic;

// Drop shadow
var ef = shape.EffectFormat;
ef.EnableOuterShadowEffect();
ef.OuterShadowEffect.BlurRadius = 12;
ef.OuterShadowEffect.Direction = 270;
ef.OuterShadowEffect.Distance = 6;
ef.OuterShadowEffect.ShadowColor.Color = Color.FromArgb(80, 0, 0, 0);

prs.Save("premium-card.pptx", SaveFormat.Pptx);

See Also

 English