Installation
Choose your framework. The registry installs one component file and its PixiJS dependency.
Installation unavailable
The preview is public, but its installable release is still being prepared.
The registry command writes the component to src/lib/components/ui/PhysicalGlassLogo.svelte and installs its dependencies.
The registry command writes the component to src/components/ui/PhysicalGlassLogo.tsx and installs its dependencies.
The registry command writes the component to src/components/ui/PhysicalGlassLogo.vue and installs its dependencies.
The generated component builds its SVG distance field in the browser and does not upload artwork to a server.
PixiJS provides matching WebGPU and WebGL implementations, with WebGL used as the fallback backend.
Overview
The SVG silhouette is converted to a signed-distance field. One height profile uses its distance and gradient to shape the raised front bevel and derive its normals; a flat rear surface completes the glass volume.
Light rays refract at entry and exit according to Snell’s law. Schlick Fresnel balances reflection and transmission, Beer-Lambert absorption tints the internal path, and a GGX microfacet lobe shapes the highlights.
Basic usage
The shader fills its parent. Your layout decides whether that parent is a card, hero, or viewport.
- The defaults form a wide, shallow bevel with a quadratic slope falloff. Width controls its footprint, height controls its slope, and curvature concentrates the bend toward the outline.
- Index of refraction controls bending at both surfaces. Glass thickness and background distance determine how far the transmitted image is displaced.
- Set dispersion to 0 for neutral refraction, or increase it to separate the red and blue ray paths.
- The current version refracts its built-in animated color field rather than arbitrary page content.
- Simple, filled SVG silhouettes produce the cleanest normals and internal ridges.
Component API
Types below match the selected Svelte component.
Additional classes for the parent-sized root element.
- Type
string
Inline SVG markup, an SVG URL, or a data URL used as the physical glass silhouette.
- Type
string- Range / values
Inline SVG, URL, or data URL
Animation speed of the color field seen through the glass.
- Type
number- Default
1- Range / values
0–2
Size of the SVG glass solid within its container.
- Type
number- Default
1- Range / values
0.2–2
Horizontal position in normalized container units.
- Type
number- Default
0- Range / values
-0.5–0.5
Vertical position in normalized container units.
- Type
number- Default
0- Range / values
-0.5–0.5
Clockwise rotation of the glass silhouette in degrees.
- Type
number- Default
0- Range / values
-180–180
Width of the sloped front edge, measured inward from the SVG outline.
- Type
number- Default
0.04- Range / values
0.01–0.5
Rise from the outer edge to the central face; higher values make the bevel steeper and bend light more strongly.
- Type
number- Default
0.05- Range / values
0–0.25
Controls how quickly the bevel flattens toward the center; higher values concentrate the bend near the edge.
- Type
number- Default
0.5- Range / values
0.25–6
Radius used to average the distance-field gradient around corners and internal ridges.
- Type
number- Default
0.01- Range / values
0.0005–0.04
Distance between the beveled front surface and flat rear surface; thicker glass increases the optical path.
- Type
number- Default
0.35- Range / values
0.01–1
Refractive index used at both air-glass boundaries; higher values bend transmitted rays more strongly.
- Type
number- Default
1.5- Range / values
1–2.5
Separates the red and blue refractive indices to create wavelength-dependent color fringing.
- Type
number- Default
1- Range / values
0–3
Distance from the rear surface to the procedural background; larger values increase visible displacement.
- Type
number- Default
0.7- Range / values
0–2
Softens the procedural color field sampled by rays passing through the glass.
- Type
number- Default
1- Range / values
0–2.5
Dark endpoint of the procedural field behind the glass.
- Type
string- Default
"#131315"
Bright endpoint of the procedural field behind the glass.
- Type
string- Default
"#5867D3"
Color retained as light travels through the glass; longer paths receive more tint.
- Type
string- Default
"#E4E8FF"
Strength of Beer-Lambert attenuation along the internal ray path.
- Type
number- Default
0.15- Range / values
0–2
Direction of the primary light around the glass silhouette.
- Type
number- Default
300- Range / values
0–360
Height of the primary light above the front glass surface.
- Type
number- Default
2- Range / values
0.1–5
Brightness of the GGX specular reflection.
- Type
number- Default
1.5- Range / values
0–5
Microfacet roughness of the front glass surface.
- Type
number- Default
0.18- Range / values
0.04–1
Stops the render loop while keeping the current frame visible.
- Type
boolean- Default
false
Enables pointer-driven effects when the shader supports them.
- Type
boolean- Default
false
Caps render resolution independently from the element size.
- Type
number- Default
2- Range / values
1–3
Scales GPU resolution without changing layout dimensions.
- Type
number- Default
1- Range / values
0.25–1
Runs after the shader is mounted successfully, including a WebGL fallback.
- Type
(backend: ShaderBackend) => void- Range / values
webgpu, webgl
Runs when automatic initialization changes the requested WebGPU backend to WebGL.
- Type
(backend: ShaderBackend, reason: string) => void- Range / values
webgl
Reports source-loading or renderer failures so the host application can decide how to recover.
- Type
(error: Error) => void
Exposes the imperative component lifecycle methods.
- Type
Component public instance- Range / values
pause, resume, reset, resize, destroy
Types below match the selected React component.
Additional classes for the parent-sized root element.
- Type
string
Inline SVG markup, an SVG URL, or a data URL used as the physical glass silhouette.
- Type
string- Range / values
Inline SVG, URL, or data URL
Animation speed of the color field seen through the glass.
- Type
number- Default
1- Range / values
0–2
Size of the SVG glass solid within its container.
- Type
number- Default
1- Range / values
0.2–2
Horizontal position in normalized container units.
- Type
number- Default
0- Range / values
-0.5–0.5
Vertical position in normalized container units.
- Type
number- Default
0- Range / values
-0.5–0.5
Clockwise rotation of the glass silhouette in degrees.
- Type
number- Default
0- Range / values
-180–180
Width of the sloped front edge, measured inward from the SVG outline.
- Type
number- Default
0.04- Range / values
0.01–0.5
Rise from the outer edge to the central face; higher values make the bevel steeper and bend light more strongly.
- Type
number- Default
0.05- Range / values
0–0.25
Controls how quickly the bevel flattens toward the center; higher values concentrate the bend near the edge.
- Type
number- Default
0.5- Range / values
0.25–6
Radius used to average the distance-field gradient around corners and internal ridges.
- Type
number- Default
0.01- Range / values
0.0005–0.04
Distance between the beveled front surface and flat rear surface; thicker glass increases the optical path.
- Type
number- Default
0.35- Range / values
0.01–1
Refractive index used at both air-glass boundaries; higher values bend transmitted rays more strongly.
- Type
number- Default
1.5- Range / values
1–2.5
Separates the red and blue refractive indices to create wavelength-dependent color fringing.
- Type
number- Default
1- Range / values
0–3
Distance from the rear surface to the procedural background; larger values increase visible displacement.
- Type
number- Default
0.7- Range / values
0–2
Softens the procedural color field sampled by rays passing through the glass.
- Type
number- Default
1- Range / values
0–2.5
Dark endpoint of the procedural field behind the glass.
- Type
string- Default
"#131315"
Bright endpoint of the procedural field behind the glass.
- Type
string- Default
"#5867D3"
Color retained as light travels through the glass; longer paths receive more tint.
- Type
string- Default
"#E4E8FF"
Strength of Beer-Lambert attenuation along the internal ray path.
- Type
number- Default
0.15- Range / values
0–2
Direction of the primary light around the glass silhouette.
- Type
number- Default
300- Range / values
0–360
Height of the primary light above the front glass surface.
- Type
number- Default
2- Range / values
0.1–5
Brightness of the GGX specular reflection.
- Type
number- Default
1.5- Range / values
0–5
Microfacet roughness of the front glass surface.
- Type
number- Default
0.18- Range / values
0.04–1
Stops the render loop while keeping the current frame visible.
- Type
boolean- Default
false
Enables pointer-driven effects when the shader supports them.
- Type
boolean- Default
false
Caps render resolution independently from the element size.
- Type
number- Default
2- Range / values
1–3
Scales GPU resolution without changing layout dimensions.
- Type
number- Default
1- Range / values
0.25–1
Runs after the shader is mounted successfully, including a WebGL fallback.
- Type
(backend: ShaderBackend) => void- Range / values
webgpu, webgl
Runs when automatic initialization changes the requested WebGPU backend to WebGL.
- Type
(backend: ShaderBackend, reason: string) => void- Range / values
webgl
Reports source-loading or renderer failures so the host application can decide how to recover.
- Type
(error: Error) => void
Exposes the imperative component lifecycle methods.
- Type
PhysicalGlassLogoHandle- Range / values
pause, resume, reset, resize, destroy
Types below match the selected Vue component.
Additional classes for the parent-sized root element.
- Type
string
Inline SVG markup, an SVG URL, or a data URL used as the physical glass silhouette.
- Type
string- Range / values
Inline SVG, URL, or data URL
Animation speed of the color field seen through the glass.
- Type
number- Default
1- Range / values
0–2
Size of the SVG glass solid within its container.
- Type
number- Default
1- Range / values
0.2–2
Horizontal position in normalized container units.
- Type
number- Default
0- Range / values
-0.5–0.5
Vertical position in normalized container units.
- Type
number- Default
0- Range / values
-0.5–0.5
Clockwise rotation of the glass silhouette in degrees.
- Type
number- Default
0- Range / values
-180–180
Width of the sloped front edge, measured inward from the SVG outline.
- Type
number- Default
0.04- Range / values
0.01–0.5
Rise from the outer edge to the central face; higher values make the bevel steeper and bend light more strongly.
- Type
number- Default
0.05- Range / values
0–0.25
Controls how quickly the bevel flattens toward the center; higher values concentrate the bend near the edge.
- Type
number- Default
0.5- Range / values
0.25–6
Radius used to average the distance-field gradient around corners and internal ridges.
- Type
number- Default
0.01- Range / values
0.0005–0.04
Distance between the beveled front surface and flat rear surface; thicker glass increases the optical path.
- Type
number- Default
0.35- Range / values
0.01–1
Refractive index used at both air-glass boundaries; higher values bend transmitted rays more strongly.
- Type
number- Default
1.5- Range / values
1–2.5
Separates the red and blue refractive indices to create wavelength-dependent color fringing.
- Type
number- Default
1- Range / values
0–3
Distance from the rear surface to the procedural background; larger values increase visible displacement.
- Type
number- Default
0.7- Range / values
0–2
Softens the procedural color field sampled by rays passing through the glass.
- Type
number- Default
1- Range / values
0–2.5
Dark endpoint of the procedural field behind the glass.
- Type
string- Default
"#131315"
Bright endpoint of the procedural field behind the glass.
- Type
string- Default
"#5867D3"
Color retained as light travels through the glass; longer paths receive more tint.
- Type
string- Default
"#E4E8FF"
Strength of Beer-Lambert attenuation along the internal ray path.
- Type
number- Default
0.15- Range / values
0–2
Direction of the primary light around the glass silhouette.
- Type
number- Default
300- Range / values
0–360
Height of the primary light above the front glass surface.
- Type
number- Default
2- Range / values
0.1–5
Brightness of the GGX specular reflection.
- Type
number- Default
1.5- Range / values
0–5
Microfacet roughness of the front glass surface.
- Type
number- Default
0.18- Range / values
0.04–1
Stops the render loop while keeping the current frame visible.
- Type
boolean- Default
false
Enables pointer-driven effects when the shader supports them.
- Type
boolean- Default
false
Caps render resolution independently from the element size.
- Type
number- Default
2- Range / values
1–3
Scales GPU resolution without changing layout dimensions.
- Type
number- Default
1- Range / values
0.25–1
Runs after the shader is mounted successfully, including a WebGL fallback.
- Type
(backend: ShaderBackend) => void- Range / values
webgpu, webgl
Runs when automatic initialization changes the requested WebGPU backend to WebGL.
- Type
(backend: ShaderBackend, reason: string) => void- Range / values
webgl
Reports source-loading or renderer failures so the host application can decide how to recover.
- Type
(error: Error) => void
Exposes the imperative component lifecycle methods.
- Type
Component public instance- Range / values
pause, resume, reset, resize, destroy