Files
vectorcraft/docs/revolve.md
Ayberk A. 043b446b94 3D and Materials: the light takes the documented settings
The public 3D and Materials panel options give the Light Settings as
Intensity (0–100 %), Rotation (-180° to 180°), Height (0° to 90°),
Softness (0–100 %) and Ambient Light (0–200 %), with the light moved to
the back or the front of the object. The 3D effects (Revolve included)
had Direction and Elevation (an azimuth and elevation), Intensity and
Ambient (0–100 %).

- Rotation turns the light round the object on the page (our reading:
  0° on its right, counterclockwise); Height raises it from beside the
  object (0°) to straight in front (90°); Light behind the object puts
  it at the back. The light gizmo's ring and line are Rotation and
  Height.
- Softness wraps the light round the object: at 0 % it falls off with
  the angle as before, at 100 % it reaches nothing only straight away.
- Ambient Light runs to 200 %; faces stay no brighter than the art.
- lightRotation, lightHeight, lightBehind and lightSoftness replace
  lightAzimuth and lightElevation. An earlier light is read as the same
  direction, so it shades exactly as before (old and new code give the
  same colours for the four effects and five lights); effect.setParams
  turns a stored one into the new form before applying new values, and
  the parameter description names lightAzimuth and lightElevation as the
  earlier form, so effect.apply and effect.setParams still take them. The
  default light is the earlier default's: Rotation 125.26°, Height 30°.
- The dialog's Lighting tab shows the settings in the documented order;
  Softness, Ambient Light and Light behind the object are in every
  catalog, and the unused Direction, Elevation and Ambient are gone.

Light colour, presets, several lights and shadows are not built.
2026-10-14 05:10:48 +07:00

83 lines
6.3 KiB
Markdown

# Revolve
This initial implementation follows the scope agreed in [issue #605](https://github.com/storytold/vectorcraft/issues/605#issuecomment-6070543567).
Draw an open profile with the Pen tool, select it, then choose **Effect > 3D and Materials > Revolve**.
The profile's horizontal distance from a vertical axis is its radius. **Axis side** chooses the left or right
edge of the profile's bounds; **Offset** moves the axis outward. For a cylinder made from a vertical
line, give it a nonzero offset. A vertical line at zero offset lies on the axis and has no surface.
**Revolve angle** sweeps 0 to 360 degrees. **Rotation X/Y/Z** rotates the viewing direction, with all three axes defaulting to 0 degrees. **Perspective**
runs 0° to 160°, as documented: 0° is an orthographic view, and wider angles bring the eye nearer (see
[three-d.md](three-d.md#perspective)). **Segments** controls radial resolution (8 to 128 for a full turn).
Lighting is one directional light with the documented Light Settings (see [three-d.md](three-d.md#lighting)):
**Intensity**, **Rotation**, **Height**, **Softness** and **Ambient Light**, and **Light behind the object**.
Turn **Shading** off to keep the source paint without lighting.
The dialog has **Rotation** and **Lighting** tabs. Rotation groups the profile and view controls. Drag a value or its label
to adjust it, use its slider, or double-click the value to type. Angles show degrees and lighting
values show percentages. **Segments** is in the **Advanced** section. Lighting controls are disabled
when **Shading** is off. A filled dot at the end of a row means the value differs from its default;
click the dot to reset that value. **Reset all** restores every Revolve parameter to its default.
The compact settings dialog opens beside the artboard. With **Preview** enabled, the selected
object has X (red), Y (green) and Z (blue) rotation rings directly on the artboard. Drag a ring to
adjust that axis; drag inside the rings to rotate freely. Hold Shift to snap to 15-degree increments.
The rings and the rotation fields stay in sync. Escape during a drag restores that gesture and
keeps the settings open. Escape again or Cancel restores the document before the dialog opened.
The gizmo appears while editing Revolve; normal source-path selection returns when the dialog closes.
Select the **Lighting** tab to use the light gizmo on the artboard. Drag the sun handle to move
the light on its side of the object: round the centre for its Rotation, towards the centre for a
greater Height. A hollow sun marks a light behind the object. Drag the **Rotation** ring or its label
horizontally to turn the light round the object; drag the **Height** line or its label vertically to
raise or lower it. The labels remain usable when the ring shrinks to a point (Height 90°).
Hold Shift to snap to 15-degree increments. Light gestures update their matching fields without
rotating the object, and keep the same temporary preview, Escape, Cancel and undo behaviour.
Intensity, Softness and Ambient Light are draggable fields and sliders.
**Shading** off hides the light gizmo and disables lighting controls. Switch to **Rotation** to return
to the object rings. **Show axis** in **Advanced** displays the source's vertical axis on the object.
Turning **Preview** off restores the original artwork and hides artboard controls until Preview is enabled.
In small windows, the controls scroll while OK and Cancel stay visible. Reset dots restore individual
settings; **Reset all** restores parameters on both tabs.
Preview changes are temporary until OK. Cancel restores the document; OK creates one undo step.
The source anchors remain editable. Appearance lists the effect for reopening its options.
SVG/PDF export evaluates filled vector faces; native saves retain the profile and effect parameters.
**Object > Expand Appearance** replaces the live effect with ordinary editable vector faces.
In **Advanced**, **Keep visible surfaces only when expanding** is on by default. Expansion removes
completely covered faces and trims partially covered ones using the current rotation and perspective.
Visible interior surfaces through open ends remain. Uncheck it to retain every projected face.
The checkbox has its own reset dot and is included in **Reset all**. Its saved command parameter is
`expandVisibleOnly`; it does not change the live preview or SVG/PDF export baking.
Trimming applies to opaque solid paint. Transparent objects, gradients, patterns, non-normal blending,
later geometry effects and surfaces exceeding bounded visibility limits keep their complete geometry
to preserve their appearance. Visibility follows the same painter order as the live effect, including
its approximation for intersecting surfaces. Expansion changes are undoable with the standard command.
## Initial limits
- Paths and compound paths only. Type, images and groups must be converted to paths first.
- Open profiles produce uncapped surfaces. Closed profile boundaries are swept as provided.
- One Revolve per source object. Edit its options rather than applying another.
- Object-level Revolve uses the top visible fill, falling back to a stroke. Per-item Revolve uses that item's paint.
- Flat shading, one directional light, no textures, cast shadows, end caps or physical materials.
- Faces use back-to-front depth sorting. Intersecting profiles can have incorrect visibility.
- Curves use sixteen samples per segment; profiles are limited to 1,024 samples and surfaces to 32,768 faces.
- Axis, bounds and ordinary selection handles continue to refer to the editable 2D source profile.
- Extrude & Bevel, Inflate, Rotate and Materials remain unimplemented.
## Architecture
`vectorcraft-three-d` depends only on `vectorcraft-geom`. It creates a surface of revolution,
applies Euler view rotation, projects it, shades faces and sorts their depth. It has no UI or GPU dependency.
`vectorcraft-effects` turns those faces into document art. The renderer, export baking and
Expand Appearance use the same evaluator. The standard `effect.apply`, `effect.setParams`,
`effect.remove` and `effect.expandAppearance` commands expose it to the CLI, control channel and MCP.
Behaviour reference: [public 3D effects documentation](https://helpx.adobe.com/illustrator/desktop/special-effects-styles/create-3d-graphics/create-3d-objects.html).
This implementation uses original mathematics and source code, with no Adobe software, assets or presets.