엠보싱·디보싱

Emboss

아래 콘텐츠의 윤곽에 빛과 그림자를 더해 양각 또는 음각처럼 보이게 합니다.

다른 이름: EmbossEmboss / debossRelief

WebGPU 를 지원하는 브라우저에서 움직입니다

이 기기에서는 데모를 그리지 못해 정지 화면을 보여 줍니다

React
// WebGPU 를 지원하는 브라우저에서만 그립니다.
// /samples/… 는 이 사이트의 샘플 파일입니다. 내 프로젝트의 이미지·영상 경로로 바꾸세요.
import { Shader, Emboss, ImageTexture } from 'shaders/react'

export default function ShaderEffect() {
  return (
    <Shader style={{ width: '100%', height: 320 }} disableTelemetry>
      <ImageTexture
        objectFit="cover"
        url="/samples/poster.jpg" />
      <Emboss />
    </Shader>
  )
}
Vue
<!-- WebGPU 를 지원하는 브라우저에서만 그립니다. -->
<!-- /samples/… 는 이 사이트의 샘플 파일입니다. 내 프로젝트의 이미지·영상 경로로 바꾸세요. -->
<script setup lang="ts">
import { Shader, Emboss, ImageTexture } from 'shaders/vue'
</script>

<template>
  <Shader style="width: 100%; height: 320px" :disable-telemetry="true">
    <ImageTexture
      object-fit="cover"
      url="/samples/poster.jpg"/>
    <Emboss/>
  </Shader>
</template>
Svelte
<!-- WebGPU 를 지원하는 브라우저에서만 그립니다. -->
<!-- /samples/… 는 이 사이트의 샘플 파일입니다. 내 프로젝트의 이미지·영상 경로로 바꾸세요. -->
<script>
  import { Shader, Emboss, ImageTexture } from 'shaders/svelte'
</script>

<Shader style="width: 100%; height: 320px" disableTelemetry>
  <ImageTexture
    objectFit="cover"
    url="/samples/poster.jpg" />
  <Emboss />
</Shader>
Solid
// WebGPU 를 지원하는 브라우저에서만 그립니다.
// /samples/… 는 이 사이트의 샘플 파일입니다. 내 프로젝트의 이미지·영상 경로로 바꾸세요.
import { Shader, Emboss, ImageTexture } from 'shaders/solid'

export default function ShaderEffect() {
  return (
    <Shader style={{ width: '100%', height: '320px' }} disableTelemetry>
      <ImageTexture
        objectFit="cover"
        url="/samples/poster.jpg" />
      <Emboss />
    </Shader>
  )
}
JavaScript
// WebGPU 를 지원하는 브라우저에서만 그립니다.
// /samples/… 는 이 사이트의 샘플 파일입니다. 내 프로젝트의 이미지·영상 경로로 바꾸세요.
// <canvas id="canvas" style="width:100%;height:320px"></canvas> 가 페이지에 있어야 한다
import { createShader } from 'shaders/js'

const shader = await createShader(document.getElementById("canvas"), {
  components: [
    {
      type: 'ImageTexture',
      props: {
        objectFit: 'cover',
        url: '/samples/poster.jpg',
      },
    },
    {
      type: 'Emboss',
    }
  ]
}, { disableTelemetry: true })

속성(props) · Emboss

값을 바꾸면 위 데모와 코드 탭에 바로 반영됩니다. 설명은 라이브러리 레지스트리의 영어 원문(MIT)입니다.

이름값기본값범위·선택지설명(원문)
originOrigin코드에서 지정center—Reference edge the center position is measured from (center default). Lets you pin the shape relative to a corner or the canvas centre.
centerCenter
x0.5y0.5
{"x":0.5,"y":0.5}x, y: 0 – 1Center position of the embossed shape
scaleScale10.1 – 3 (step 0.01)Scale of the embossed shape (1 = default size)
rotationRotation00 – 360 (step 1)Rotation of the embossed shape in degrees
depthDepth-0.5-1 – 1 (step 0.01)Relief depth — negative = inset (debossed), positive = raised (embossed)
lightAngleLight Angle2600 – 360 (step 1)Directional light angle in degrees — controls highlight and shadow direction
lightIntensityLight Intensity0.60 – 2 (step 0.01)Strength of the directional edge highlights and shadows
shadowIntensityShadow Intensity0.30 – 1 (step 0.01)Darkness of the relief shadow
shapeShape코드에서 지정{"type":"sphere3D","radius":0.35}—Serialized shape configuration (JSON)
shapeSdfUrlshapeSdfUrl코드에서 지정—URL to a pre-generated SDF .bin file — when non-empty, activates SVG mode and triggers a shader recompile
shapeTypeshapeType코드에서 지정—Active SDF shape type — triggers recompile when shape is switched. When empty, derived from shape JSON at mount time.

모든 컴포넌트 공통: blendMode · opacity · visible · maskSource/maskType · boundingBox · id

종이에 글자를 눌러 찍거나 도드라지게 만든 것처럼, 가장자리의 밝은 면과 그림자가 높낮이를 만듭니다.

`depth`가 양수면 양각, 음수면 음각 방향으로 바뀝니다. `lightAngle`은 밝은 면과 그림자가 생기는 방향을, `lightIntensity`는 그 대비의 강도를 조절합니다. `shadowIntensity`를 높이면 눌린 부분의 그림자가 더 짙어집니다.

빛과 그림자를 입힐 이미지나 도형을 아래에 먼저 둬야 합니다. 단색 표면과 충분한 명암 차이를 주면 요철이 잘 보이고, 대비가 낮은 작은 문구에 적용하면 형태가 흐려질 수 있습니다.

언제 쓰나

엠보싱 로고, 눌러 찍은 종이 라벨, 입체 버튼 표면에 어울립니다. 대비가 낮은 작은 글자나 명암만으로 상태를 전달하는 컨트롤에는 피하세요.

페이지로 열기 ↗