vanilladocs
vanillapunch.com
API / graphics3d/humanskinrenderer

graphics3d/humanskinrenderer

인체 피부 렌더러. (SkinnedModelRenderer 의 스키닝/모프 버텍스 경로 위에 피부 / 눈 / 머리카락 셰이딩 템플릿을 세운다)

Human skin renderer. (builds skin / eye / hair shading templates on top of the SkinnedModelRenderer skinning/morph vertex path)

HumanSkinRendererextends SkinnedModelRenderer

짝Counterpart: vanilla-engine HumanSkinRenderer

인체 피부 렌더러. (SkinnedModelRenderer 의 스키닝/모프 버텍스 경로 위에 피부 / 눈 / 머리카락 셰이딩 템플릿을 세운다)

  • 선형 HDR 로 조도 / 알베도 / 스펙큘러 / 노멀을 MRT 로 나눠 출력하고, 합성은 SubsurfaceScatteringEffect 이후 호출자가 한다.
  • 머티리얼마다 셰이딩 모드를 등록한다(setMaterialShading). 불투명 패스(draw)는 피부 / 눈 / 머리카락 컷아웃, 블렌드 패스(drawBlended)는 머리카락 프린지 / 차폐 / 유체를 그린다 (호출자가 블렌드 상태를 잡는다).
  • 환경 상태: 조명 3개(0번 = 키 라이트, 섀도우 수신) / 3색 반구 앰비언트 / 노멀, 디테일, 러프니스, 스펙큘러, 주름, 마이크로, 눈, 머리카락 파라미터.

Human skin renderer. (builds skin / eye / hair shading templates on top of the SkinnedModelRenderer skinning/morph vertex path)

  • Outputs irradiance / albedo / specular / normal split into MRT in linear HDR, and compositing is done by the caller after SubsurfaceScatteringEffect.
  • Registers a shading mode per material (setMaterialShading). The opaque pass (draw) draws skin / eye / hair cutout, the blend pass (drawBlended) draws hair fringe / occlusion / fluid (the caller sets the blend state).
  • Environment state: 3 lights (0 = key light, receives shadows) / 3-color hemisphere ambient / normal, detail, roughness, specular, wrinkle, micro, eye, hair parameters.
예제Example불투명 패스와 블렌드 패스를 MRT 렌더 타겟에 그리기Draw the opaque and blend passes into an MRT render target
import { HumanSkinRenderer, SkinnedModel, RenderTarget, Camera3D, Matrix4, Vector3, SKIN_SHADING_SKIN } from "./build/vanilla.js";

const width = 640;
const height = 360;
const canvas = document.createElement("canvas");
const webGL2RenderingContext = canvas.getContext("webgl2");
const humanSkinRenderer = new HumanSkinRenderer(webGL2RenderingContext);
humanSkinRenderer.setLight(0, 0.4, 0.7, 0.6, 1.0, 0.95, 0.9, 3.0);
humanSkinRenderer.setAmbientColors([0.3, 0.32, 0.38], [0.15, 0.14, 0.15], [0.05, 0.04, 0.04]);
const skinnedModel = await SkinnedModel.loadFromUrl(webGL2RenderingContext, "examples/ancientmountain/assets/fox.glb", humanSkinRenderer);
const drawableList = skinnedModel.getDrawableList();
for (const drawable of drawableList) {
	humanSkinRenderer.setMaterialShading(drawable.material, SKIN_SHADING_SKIN);
}
skinnedModel.update(0);

const geometryRenderTarget = new RenderTarget(webGL2RenderingContext, width, height, true, { colorAttachmentCount: 4, useFloatColor: true, useDepthTexture: true });
geometryRenderTarget.bind();
webGL2RenderingContext.enable(webGL2RenderingContext.DEPTH_TEST);
webGL2RenderingContext.clearColor(0, 0, 0, 0);
webGL2RenderingContext.clear(webGL2RenderingContext.COLOR_BUFFER_BIT | webGL2RenderingContext.DEPTH_BUFFER_BIT);
const cameraX = 0;
const cameraY = 60;
const cameraZ = 200;
const camera = new Camera3D();
camera.setPerspective(0.8, 1, 1000);
camera.setAspectRatio(width / height);
const eyePosition = Vector3.create(cameraX, cameraY, cameraZ);
const targetPosition = Vector3.create(0, 40, 0);
camera.lookAt(eyePosition, targetPosition);
const viewProjectionMatrix = camera.getViewProjectionMatrix();
const viewProjectionElements = viewProjectionMatrix.getElements();
const modelMatrix = Matrix4.createIdentity();
const modelMatrixElements = modelMatrix.getElements();
humanSkinRenderer.draw(skinnedModel, viewProjectionElements, modelMatrixElements, cameraX, cameraY, cameraZ);

webGL2RenderingContext.enable(webGL2RenderingContext.BLEND);
webGL2RenderingContext.blendFunc(webGL2RenderingContext.SRC_ALPHA, webGL2RenderingContext.ONE_MINUS_SRC_ALPHA);
webGL2RenderingContext.depthMask(false);
humanSkinRenderer.drawBlended(skinnedModel, viewProjectionElements, modelMatrixElements, cameraX, cameraY, cameraZ);
webGL2RenderingContext.depthMask(true);
webGL2RenderingContext.disable(webGL2RenderingContext.BLEND);
const irradianceTexture = geometryRenderTarget.getColorTexture(0);
const albedoTexture = geometryRenderTarget.getColorTexture(1);
console.log(irradianceTexture !== null, albedoTexture !== null);
Draw the opaque and blend passes into an MRT render target
생성자constructorconstructor(webGL2RenderingContext)#0.3.0 부터since 0.3.0소스source

생성.

Constructor.

webGL2RenderingContextWebGL2RenderingContext
WebGL2 렌더링 컨텍스트.WebGL2 rendering context.

짝Counterpart: vanilla-engine HumanSkinRenderer.new

메서드methoddraw(skinnedModel, viewProjectionElements, modelMatrixElements, cameraX, cameraY, cameraZ)#0.3.0 부터since 0.3.0소스source

불투명 패스 출력. (피부 / 눈 / 머리카락 컷아웃, 깊이 쓰기)

Draws the opaque pass. (skin / eye / hair cutout, writes depth)

skinnedModelSkinnedModel
그릴 모델. (update 로 포즈를 셈한 뒤)Model to draw. (after its pose is computed with update)
viewProjectionElementsFloat32Array
보기와 투영을 곱한 행렬 원소. (열 우선 4x4)Elements of the combined view and projection matrix. (column-major 4x4)
modelMatrixElementsFloat32Array
모델 월드 행렬 원소. (열 우선 4x4)Elements of the model world matrix. (column-major 4x4)
cameraXnumber
카메라 월드 X.Camera world X.
cameraYnumber
카메라 월드 Y.Camera world Y.
cameraZnumber
카메라 월드 Z.Camera world Z.

짝Counterpart: vanilla-engine HumanSkinRenderer.draw

메서드methoddrawBlended(skinnedModel, viewProjectionElements, modelMatrixElements, cameraX, cameraY, cameraZ)#0.3.0 부터since 0.3.0소스source

블렌드 패스 출력. (머리카락 프린지 / 차폐 / 유체, 호출자가 블렌드 켜고 깊이 쓰기를 끈 뒤 호출)

Draws the blend pass. (hair fringe / occlusion / fluid, called after the caller enables blending and disables depth writes)

skinnedModelSkinnedModel
그릴 모델. (update 로 포즈를 셈한 뒤)Model to draw. (after its pose is computed with update)
viewProjectionElementsFloat32Array
보기와 투영을 곱한 행렬 원소. (열 우선 4x4)Elements of the combined view and projection matrix. (column-major 4x4)
modelMatrixElementsFloat32Array
모델 월드 행렬 원소. (열 우선 4x4)Elements of the model world matrix. (column-major 4x4)
cameraXnumber
카메라 월드 X.Camera world X.
cameraYnumber
카메라 월드 Y.Camera world Y.
cameraZnumber
카메라 월드 Z.Camera world Z.

짝Counterpart: vanilla-engine HumanSkinRenderer.draw_blended

메서드methoddrawPass(skinnedModel, viewProjectionElements, modelMatrixElements, cameraX, cameraY, cameraZ, passMode)#0.3.0 부터since 0.3.0소스source

패스 출력. (공통 유니폼 → 드로어블 순회, 패스에 맞는 셰이딩 모드만)

Draws a pass. (common uniforms → iterate drawables, only the shading modes matching the pass)

skinnedModelSkinnedModel
그릴 모델. (update 로 포즈를 셈한 뒤)Model to draw. (after its pose is computed with update)
viewProjectionElementsFloat32Array
보기와 투영을 곱한 행렬 원소. (열 우선 4x4)Elements of the combined view and projection matrix. (column-major 4x4)
modelMatrixElementsFloat32Array
모델 월드 행렬 원소. (열 우선 4x4)Elements of the model world matrix. (column-major 4x4)
cameraXnumber
카메라 월드 X.Camera world X.
cameraYnumber
카메라 월드 Y.Camera world Y.
cameraZnumber
카메라 월드 Z.Camera world Z.
passModenumber
0 = 불투명, 1 = 블렌드.0 = opaque, 1 = blend.

짝Counterpart: vanilla-engine HumanSkinRenderer.draw_pass

메서드methoddrawDepth(skinnedModel, lightViewProjectionElements, modelMatrixElements)#0.3.0 부터since 0.3.0소스source

깊이 패스 출력. (섀도우 맵 캐스팅, 컷아웃 / 머리카락 머티리얼은 커버리지 텍스처로 투명 영역 제거, 차폐 / 유체는 제외)

Draws the depth pass. (shadow map casting, cutout / hair materials remove transparent areas with the coverage texture, occlusion / fluid excluded)

skinnedModelSkinnedModel
그림자를 드리울 모델.Model that casts the shadow.
lightViewProjectionElementsFloat32Array
광원 뷰 투영 행렬 원소. (열 우선 4x4)Elements of the light view-projection matrix. (column-major 4x4)
modelMatrixElementsFloat32Array
모델 월드 행렬 원소. (열 우선 4x4)Elements of the model world matrix. (column-major 4x4)

짝Counterpart: vanilla-engine HumanSkinRenderer.draw_depth

메서드methodapplyEnvironmentUniforms(shaderProgram)#0.3.0 부터since 0.3.0소스source

환경 유니폼 적용. (조명 / 앰비언트 / 피부 / 주름 / 마이크로 / 눈 / 머리카락 파라미터)

Applies the environment uniforms. (light / ambient / skin / wrinkle / micro / eye / hair parameters)

shaderProgramShaderProgram
유니폼을 넣을 셰이더 프로그램. (use 한 뒤)Shader program to set uniforms on. (after use)

짝Counterpart: vanilla-engine HumanSkinRenderer.apply_environment_uniforms

메서드methodapplyShadowUniforms(shaderProgram)#0.3.0 부터since 0.3.0소스source

섀도우 유니폼 적용. (섀도우 샘플러 타입 불일치로 드로우가 무효화되지 않도록 강도와 무관하게 항상 바인드)

Applies the shadow uniforms. (always bound regardless of strength so draws are not invalidated by a shadow sampler type mismatch)

shaderProgramShaderProgram
유니폼을 넣을 셰이더 프로그램. (use 한 뒤)Shader program to set uniforms on. (after use)

짝Counterpart: vanilla-engine HumanSkinRenderer.apply_shadow_uniforms

메서드methodsetShadowMap(shadowMapTexture, lightViewProjectionElements, texelSize)#0.3.0 부터since 0.3.0소스source

섀도우 맵 설정. (본 패스에서 그림자 수신, 기반 렌더러에도 전달)

Sets the shadow map. (receives shadows in the main pass, also passed to the base renderer)

shadowMapTextureWebGLTexture | null
섀도우 맵 깊이 텍스처. (비교 샘플링, null 이면 그림자를 받지 않는다)Shadow map depth texture. (comparison sampling, no shadows are received when null)
lightViewProjectionElementsFloat32Array | null
광원 뷰 투영 행렬 원소. (null 이면 그림자를 받지 않는다)Elements of the light view-projection matrix. (no shadows are received when null)
texelSizenumber
섀도우 맵 한 텍셀의 텍스처 좌표 크기. (1 / 해상도, 표본 간격)Size of one shadow map texel in texture coordinates. (1 / resolution, the sample spacing)

짝Counterpart: vanilla-engine HumanSkinRenderer.set_shadow_map

메서드methodsetShadowStrength(shadowStrength)#0.3.0 부터since 0.3.0소스source

그림자 강도 설정. (0 = 수신 안 함)

Sets the shadow strength. (0 = no receiving)

shadowStrengthnumber
그림자 강도. (0 ~ 1, 기본 0)Shadow strength. (0 ~ 1, default 0)

짝Counterpart: vanilla-engine HumanSkinRenderer.set_shadow_strength

메서드methodsetShadowSoftness(shadowSoftness)#0.3.0 부터since 0.3.0소스source

그림자 부드러움 설정. (포아송 반경, 섀도우 텍셀 단위)

Sets the shadow softness. (Poisson radius, in shadow texels)

shadowSoftnessnumber
포아송 표본 반경. (섀도우 텍셀 단위, 기본 2.5)Poisson sample radius. (in shadow texels, default 2.5)

짝Counterpart: vanilla-engine HumanSkinRenderer.set_shadow_softness

메서드methodsetShadowSampleCount(shadowSampleCount)#0.3.0 부터since 0.3.0소스source

그림자 표본 수 설정. (1 ~ 24, 많을수록 부드럽고 느리다)

Sets the shadow sample count. (1 ~ 24, more is smoother and slower)

shadowSampleCountnumber
표본 수. (소수는 버리고 1 ~ 24 로 자른다, 기본 12)Sample count. (fractions are dropped, clamped to 1 ~ 24, default 12)

짝Counterpart: vanilla-engine HumanSkinRenderer.set_shadow_sample_count

메서드methodsetHairSway(amplitude, time, frequency)#0.3.0 부터since 0.3.0소스source

머리카락 흔들림 설정. (진폭 m / 시간 초 / 주파수, 진폭 0 이면 없음)

Sets the hair sway. (amplitude m / time seconds / frequency, none if amplitude is 0)

amplitudenumber
흔들림 진폭. (미터, 가닥 끝일수록 크고 0 이면 없음, 기본 0)Sway amplitude. (meters, larger toward strand tips, none when 0, default 0)
timenumber
흐른 시간. (초, 매 프레임 넣는다)Elapsed time. (seconds, set every frame)
frequencynumber
흔들림 주파수. (시간에 곱하는 배율, 기본 1.5)Sway frequency. (multiplier on time, default 1.5)

짝Counterpart: vanilla-engine HumanSkinRenderer.set_hair_sway

메서드methodsetHairFringe(useHairFringe)#0.3.0 부터since 0.3.0소스source

머리카락 프린지 블렌드 사용 설정. (false 면 컷아웃만, 성능 위주)

Sets whether hair fringe blending is used. (false means cutout only, performance first)

useHairFringeboolean
참이면 블렌드 패스에서 머리카락을 한 번 더 그린다. (기본 true)When true, hair is drawn once more in the blend pass. (default true)

짝Counterpart: vanilla-engine HumanSkinRenderer.set_hair_fringe

메서드methodsetMaterialShading(material, shadingMode)#0.3.0 부터since 0.3.0소스source

머티리얼 셰이딩 모드 등록. (등록하지 않은 머티리얼은 피부)

Registers a material shading mode. (unregistered materials are skin)

materialMaterial
셰이딩 모드를 정할 머티리얼.Material to set the shading mode for.
shadingModenumber
셰이딩 모드. (SKIN_SHADING_SKIN, EYE, HAIR, OCCLUSION, FLUID, FACIALHAIR)Shading mode. (SKIN_SHADING_SKIN, EYE, HAIR, OCCLUSION, FLUID, FACIALHAIR)

짝Counterpart: vanilla-engine HumanSkinRenderer.set_material_shading

메서드methodgetMaterialShadingMode(material)#0.3.0 부터since 0.3.0소스source

머티리얼 셰이딩 모드 반환.

Returns the material shading mode.

materialMaterial
머티리얼.Material.

반환Returnsnumber 등록한 셰이딩 모드. (등록하지 않았으면 SKIN_SHADING_SKIN)Registered shading mode. (SKIN_SHADING_SKIN when not registered)

짝Counterpart: vanilla-engine HumanSkinRenderer.get_material_shading_mode

메서드methodsetLight(lightIndex, directionX, directionY, directionZ, red, green, blue, intensity)#0.3.0 부터since 0.3.0소스source

조명 설정. (0 = 키 라이트: 섀도우 맵 수신 / 1 = 필 / 2 = 림, 방향은 표면에서 빛을 향하는 벡터)

Sets a light. (0 = key light: receives the shadow map / 1 = fill / 2 = rim, direction is the vector from the surface toward the light)

lightIndexnumber
조명 번호. (0 키, 1 필, 2 림)Light index. (0 key, 1 fill, 2 rim)
directionXnumber
표면에서 빛을 향하는 방향 X. (정규화해 담는다)X of the direction from the surface toward the light. (stored normalized)
directionYnumber
표면에서 빛을 향하는 방향 Y.Y of the direction from the surface toward the light.
directionZnumber
표면에서 빛을 향하는 방향 Z.Z of the direction from the surface toward the light.
rednumber
빛 빨강. (선형)Light red. (linear)
greennumber
빛 초록. (선형)Light green. (linear)
bluenumber
빛 파랑. (선형)Light blue. (linear)
intensitynumber
세기. (색에 곱한다)Intensity. (multiplied into the color)

짝Counterpart: vanilla-engine HumanSkinRenderer.set_light

메서드methodsetAmbientColors(skyColor, horizonColor, groundColor)#0.3.0 부터since 0.3.0소스source

앰비언트 3색 설정. (하늘 / 지평 / 바닥, 선형 색)

Sets the 3-color ambient. (sky / horizon / ground, linear color)

skyColornumber[]
위쪽 하늘 색. ([r, g, b], 선형, 기본 [0.34, 0.36, 0.42])Upper sky color. ([r, g, b], linear, default [0.34, 0.36, 0.42])
horizonColornumber[]
지평 색. ([r, g, b], 선형, 기본 [0.16, 0.15, 0.16])Horizon color. ([r, g, b], linear, default [0.16, 0.15, 0.16])
groundColornumber[]
아래쪽 바닥 색. ([r, g, b], 선형, 기본 [0.05, 0.04, 0.045])Lower ground color. ([r, g, b], linear, default [0.05, 0.04, 0.045])

짝Counterpart: vanilla-engine HumanSkinRenderer.set_ambient_colors

메서드methodsetNormalStrength(normalStrength)#0.3.0 부터since 0.3.0소스source

노멀 맵 강도 설정. (1 = 원본, 크면 주름이 깊어진다)

Sets the normal map strength. (1 = original, larger makes wrinkles deeper)

normalStrengthnumber
노멀 맵 xy 배율. (기본 1)Normal map xy multiplier. (default 1)

짝Counterpart: vanilla-engine HumanSkinRenderer.set_normal_strength

메서드methodsetDetailStrength(detailStrength)#0.3.0 부터since 0.3.0소스source

높이 디테일 강도 설정. (0 = 디테일 노멀 없음)

Sets the height detail strength. (0 = no detail normal)

detailStrengthnumber
높이 미분 디테일 배율. (기본 6)Height derivative detail multiplier. (default 6)

짝Counterpart: vanilla-engine HumanSkinRenderer.set_detail_strength

메서드methodsetDetailTexelSize(detailTexelSize)#0.3.0 부터since 0.3.0소스source

높이 디테일 텍셀 크기 설정. (1 / 높이 맵 해상도)

Sets the height detail texel size. (1 / height map resolution)

detailTexelSizenumber
높이 맵 한 텍셀의 UV 크기. (기본 1 / 4096)UV size of one height map texel. (default 1 / 4096)

짝Counterpart: vanilla-engine HumanSkinRenderer.set_detail_texel_size

메서드methodsetCavityStrength(cavityStrength)#0.3.0 부터since 0.3.0소스source

캐비티 강도 설정. (0 = 차폐 없음)

Sets the cavity strength. (0 = no occlusion)

cavityStrengthnumber
캐비티 배율. (높이와 저역 높이의 차에 곱한다, 기본 6)Cavity multiplier. (multiplied by the difference between height and low-pass height, default 6)

짝Counterpart: vanilla-engine HumanSkinRenderer.set_cavity_strength

메서드methodsetRoughnessRange(minimumRoughness, maximumRoughness)#0.3.0 부터since 0.3.0소스source

러프니스 범위 설정. (스펙큘러 맵 1 → 최소, 0 → 최대)

Sets the roughness range. (specular map 1 → minimum, 0 → maximum)

minimumRoughnessnumber
스펙큘러 맵이 1 인 곳의 러프니스. (기본 0.32)Roughness where the specular map is 1. (default 0.32)
maximumRoughnessnumber
스펙큘러 맵이 0 인 곳의 러프니스. (기본 0.62)Roughness where the specular map is 0. (default 0.62)

짝Counterpart: vanilla-engine HumanSkinRenderer.set_roughness_range

메서드methodsetSpecularStrength(specularStrength)#0.3.0 부터since 0.3.0소스source

스펙큘러 강도 설정. (피부 F0 배율)

Sets the specular strength. (skin F0 multiplier)

specularStrengthnumber
피부 F0 배율. (기본 1)Skin F0 multiplier. (default 1)

짝Counterpart: vanilla-engine HumanSkinRenderer.set_specular_strength

메서드methodsetSheenStrength(sheenStrength)#0.3.0 부터since 0.3.0소스source

잔털 산란 강도 설정.

Sets the vellus hair scattering strength.

sheenStrengthnumber
잔털 산란 세기. (기본 0.35)Peach fuzz scattering strength. (default 0.35)

짝Counterpart: vanilla-engine HumanSkinRenderer.set_sheen_strength

메서드methodsetSubsurfaceAmount(subsurfaceAmount)#0.3.0 부터since 0.3.0소스source

SSS 마스크 강도 설정. (조도 출력 알파, 0 이면 화면 공간 산란에서 제외)

Sets the SSS mask strength. (irradiance output alpha, 0 excludes it from screen-space scattering)

subsurfaceAmountnumber
산란 마스크 세기. (머티리얼의 서브서피스 팩터와 곱해 조도 출력 알파가 된다, 기본 1)Scattering mask strength. (multiplied by the material's subsurface factor to become the irradiance output alpha, default 1)

짝Counterpart: vanilla-engine HumanSkinRenderer.set_subsurface_amount

메서드methodsetMicroDetail(microTiling, microStrength)#0.3.0 부터since 0.3.0소스source

마이크로 노멀 설정. (타일링 횟수 / 강도, 0 이면 사용 안 함)

Sets the micro normal. (tiling count / strength, 0 means unused)

microTilingnumber
마이크로 텍스처 타일링 횟수. (UV 에 곱한다, 기본 0)Micro texture tiling count. (multiplied into the UV, default 0)
microStrengthnumber
마이크로 노멀과 캐비티 세기. (기본 0, 0 이면 쓰지 않는다)Micro normal and cavity strength. (default 0, unused when 0)

짝Counterpart: vanilla-engine HumanSkinRenderer.set_micro_detail

메서드methodsetWrinkleMaps(useWrinkleMaps, normalStrength, colorStrength)#0.3.0 부터since 0.3.0소스source

주름 맵 사용 설정. (마스크 아틀라스 / 주름 노멀 / 색 아틀라스가 머티리얼에 붙어 있어야 한다)

Sets whether the wrinkle map is used. (the mask atlas / wrinkle normal / color atlas must be attached to the material)

useWrinkleMapsboolean
참이면 주름 맵을 쓴다. (기본 false)Uses wrinkle maps when true. (default false)
normalStrengthnumber
주름 노멀 배율. (기본 1)Wrinkle normal multiplier. (default 1)
colorStrengthnumber
주름 색 배율. (기본 1)Wrinkle color multiplier. (default 1)

짝Counterpart: vanilla-engine HumanSkinRenderer.set_wrinkle_maps

메서드methodsetWrinkleChannelWeight(channelIndex, weight1, weight2, weight3)#0.3.0 부터since 0.3.0소스source

주름 채널 가중치 설정. (채널 = 마스크 아틀라스 타일 x 4 + RGBA 순서, 값 = 주름 맵 1 / 2 / 3 기여)

Sets a wrinkle channel weight. (channel = mask atlas tile x 4 + RGBA order, value = wrinkle map 1 / 2 / 3 contribution)

channelIndexnumber
채널 번호. (0 ~ 63, 타일 x 4 + RGBA 차례)Channel index. (0 ~ 63, tile x 4 + RGBA order)
weight1number
주름 맵 1 기여.Contribution to wrinkle map 1.
weight2number
주름 맵 2 기여.Contribution to wrinkle map 2.
weight3number
주름 맵 3 기여.Contribution to wrinkle map 3.

짝Counterpart: vanilla-engine HumanSkinRenderer.set_wrinkle_channel_weight

예제Example표정 채널 가중치를 넣고 마무리하기Set expression channel weights and finish
import { HumanSkinRenderer } from "./build/vanilla.js";

const canvas = document.createElement("canvas");
const webGL2RenderingContext = canvas.getContext("webgl2");
const humanSkinRenderer = new HumanSkinRenderer(webGL2RenderingContext);
humanSkinRenderer.setWrinkleMaps(true, 1.0, 0.8);
const browRaiseWeight = 0.7;
const squintWeight = 0.4;
humanSkinRenderer.setWrinkleChannelWeight(0, browRaiseWeight, 0, 0);
humanSkinRenderer.setWrinkleChannelWeight(5, 0, squintWeight, 0);
humanSkinRenderer.finishWrinkleChannelWeights();
메서드methodfinishWrinkleChannelWeights()#0.3.0 부터since 0.3.0소스source

주름 채널 가중치 적용 마무리. (가중치가 있는 타일만 골라 비트마스크로, 셰이더가 빈 타일을 건너뛴다)

Finishes applying the wrinkle channel weights. (picks only the tiles with weights into a bitmask, the shader skips empty tiles)

짝Counterpart: vanilla-engine HumanSkinRenderer.finish_wrinkle_channel_weights

메서드methodsetEyeParameters(irisRadius, pupilRadius, irisDepth)#0.3.0 부터since 0.3.0소스source

눈 파라미터 설정. (UV 단위, 홍채 반경 / 동공 반경 / 홍채 평면 깊이)

Sets the eye parameters. (in UV units, iris radius / pupil radius / iris plane depth)

irisRadiusnumber
홍채 반경. (UV 단위, 기본 0.133)Iris radius. (UV units, default 0.133)
pupilRadiusnumber
동공 반경. (UV 단위, 기본 0.04)Pupil radius. (UV units, default 0.04)
irisDepthnumber
홍채 평면 깊이. (굴절 시차 세기, 기본 0.05)Iris plane depth. (refraction parallax strength, default 0.05)

짝Counterpart: vanilla-engine HumanSkinRenderer.set_eye_parameters

메서드methodsetEyeClosure(eyeClosure)#0.3.0 부터since 0.3.0소스source

눈꺼풀 감김 정도 설정. (0 = 뜬 눈, 1 = 감은 눈, 눈알을 눈꺼풀 그늘만큼 어둡게)

Sets the eyelid closure. (0 = open eye, 1 = closed eye, darkens the eyeball by the eyelid shadow)

eyeClosurenumber
감긴 정도. (0 ~ 1 로 자른다, 0 뜬 눈, 1 감은 눈)Closure amount. (clamped to 0 ~ 1, 0 open, 1 closed)

짝Counterpart: vanilla-engine HumanSkinRenderer.set_eye_closure

메서드methodsetHairParameters(specularShift, specularPower, specularIntensity, rootShade)#0.3.0 부터since 0.3.0소스source

머리카락 파라미터 설정. (1차 / 2차 로브 시프트, 지수, 강도, 투과 강도, 뿌리 차폐)

Sets the hair parameters. (primary / secondary lobe shift, exponent, strength, transmission strength, root occlusion)

specularShiftnumber[]
[1차, 2차][primary, secondary]
specularPowernumber[]
[1차, 2차][primary, secondary]
specularIntensitynumber[]
[1차, 2차, 투과][primary, secondary, transmission]
rootShadenumber
뿌리 차폐 세기. (0 이면 없음, 기본 0.45)Root occlusion strength. (none when 0, default 0.45)

짝Counterpart: vanilla-engine HumanSkinRenderer.set_hair_parameters

메서드methodgetCutoutDepthShaderProgram()#0.3.0 부터since 0.3.0소스source

컷아웃 깊이 셰이더 프로그램 반환.

Returns the cutout depth shader program.

반환ReturnsShaderProgram 컷아웃 깊이 셰이더 프로그램.Cutout depth shader program.

짝Counterpart: vanilla-engine HumanSkinRenderer.get_cutout_depth_shader_program

상수Constants

상수constantSKIN_SHADING_SKIN = 0#0.3.0 부터since 0.3.0소스source

셰이딩 모드. (머티리얼마다 setMaterialShading 으로 지정, 같은 셰이더 안에서 분기)

Shading mode. (specified per material with setMaterialShading, branches inside the same shader)

반환Returnsnumber

짝Counterpart: vanilla-engine SKIN_SHADING_SKIN

상수constantSKIN_SHADING_EYE = 1#0.3.0 부터since 0.3.0소스source

눈. (각막 굴절, 홍채, 공막)

Eye. (corneal refraction, iris, sclera)

반환Returnsnumber

짝Counterpart: vanilla-engine SKIN_SHADING_EYE

상수constantSKIN_SHADING_HAIR = 2#0.3.0 부터since 0.3.0소스source

머리카락. (이방성 하이라이트, 컷아웃과 프린지 블렌드, 흔들림)

Hair. (anisotropic highlights, cutout and fringe blend, sway)

반환Returnsnumber

짝Counterpart: vanilla-engine SKIN_SHADING_HAIR

상수constantSKIN_SHADING_OCCLUSION = 3#0.3.0 부터since 0.3.0소스source

눈꺼풀 차폐 메시. (블렌드 패스, 조도만 어둡게)

Eyelid occlusion mesh. (blend pass, darkens only the irradiance)

반환Returnsnumber

짝Counterpart: vanilla-engine SKIN_SHADING_OCCLUSION

상수constantSKIN_SHADING_FLUID = 4#0.3.0 부터since 0.3.0소스source

눈물선, 침 같은 유체. (블렌드 패스, 스펙큘러만 얹는다)

Fluids such as tear lines and saliva. (blend pass, adds only specular)

반환Returnsnumber

짝Counterpart: vanilla-engine SKIN_SHADING_FLUID

상수constantSKIN_SHADING_FACIALHAIR = 5#0.3.0 부터since 0.3.0소스source

눈썹, 수염 같은 얼굴 털. (머리카락 셰이딩, 흔들림 없음)

Facial hair such as eyebrows and beards. (hair shading, no sway)

반환Returnsnumber

짝Counterpart: vanilla-engine SKIN_SHADING_FACIALHAIR

상수constantSKIN_TEXTURE_UNIT_DETAILHEIGHT = 9#0.3.0 부터since 0.3.0소스source

추가 텍스처 유닛. (머티리얼 기본 슬롯 0 / 2~8 과 섀도우 1, 모프 15 를 피한 9~14)

  • 피부: 9 높이 디테일, 10 마이크로(노멀 rgb + 캐비티 a), 11 주름 마스크 아틀라스(4x4), 12 주름 노멀 아틀라스(2x2), 13 주름 색 아틀라스(2x2)
  • 눈: 12 홍채 노멀, 13 홍채 색 / 머리카락: 12 카드 탄젠트(rgb) + 가닥 좌표(a)

Extra texture units. (9 to 14, avoiding the material base slots 0 / 2 to 8, shadow 1, and morph 15)

  • Skin: 9 detail height, 10 micro (normal rgb + cavity a), 11 wrinkle mask atlas (4x4), 12 wrinkle normal atlas (2x2), 13 wrinkle color atlas (2x2)
  • Eye: 12 iris normal, 13 iris color / Hair: 12 card tangent (rgb) + strand coordinate (a)

반환Returnsnumber

짝Counterpart: vanilla-engine SKIN_TEXTURE_UNIT_DETAILHEIGHT

상수constantSKIN_TEXTURE_UNIT_MICRO = 10#0.3.0 부터since 0.3.0소스source

유니폼 microTexture 의 유닛. (마이크로 노멀 rgb + 캐비티 a, 타일링)

Unit for the microTexture uniform. (micro normal rgb + cavity a, tiled)

반환Returnsnumber

짝Counterpart: vanilla-engine SKIN_TEXTURE_UNIT_MICRO

상수constantSKIN_TEXTURE_UNIT_MASKATLAS = 11#0.3.0 부터since 0.3.0소스source

유니폼 maskAtlasTexture 의 유닛. (주름 마스크 아틀라스 4x4)

Unit for the maskAtlasTexture uniform. (wrinkle mask atlas 4x4)

반환Returnsnumber

짝Counterpart: vanilla-engine SKIN_TEXTURE_UNIT_MASKATLAS

상수constantSKIN_TEXTURE_UNIT_LAYERNORMAL = 12#0.3.0 부터since 0.3.0소스source

유니폼 layerNormalTexture 의 유닛. (피부는 주름 노멀 아틀라스 2x2, 눈은 홍채 노멀, 머리카락은 카드 탄젠트 rgb + 가닥 좌표 a)

Unit for the layerNormalTexture uniform. (wrinkle normal atlas 2x2 for skin, iris normal for eyes, card tangent rgb + strand coordinate a for hair)

반환Returnsnumber

짝Counterpart: vanilla-engine SKIN_TEXTURE_UNIT_LAYERNORMAL

상수constantSKIN_TEXTURE_UNIT_LAYERCOLOR = 13#0.3.0 부터since 0.3.0소스source

유니폼 layerColorTexture 의 유닛. (피부는 주름 색 아틀라스 2x2, 눈은 홍채 색)

Unit for the layerColorTexture uniform. (wrinkle color atlas 2x2 for skin, iris color for eyes)

반환Returnsnumber

짝Counterpart: vanilla-engine SKIN_TEXTURE_UNIT_LAYERCOLOR

상수constantSKIN_TEXTURE_UNIT_AUXILIARY = 14#0.3.0 부터since 0.3.0소스source

유니폼 auxiliaryTexture 의 유닛. (셰이더에 선언만 있고 읽는 곳은 없다)

Unit for the auxiliaryTexture uniform. (declared in the shader but never read)

반환Returnsnumber

짝Counterpart: vanilla-engine SKIN_TEXTURE_UNIT_AUXILIARY

상수constantWRINKLE_CHANNEL_COUNT = 64#0.3.0 부터since 0.3.0소스source

주름 마스크 채널 수. (4x4 아틀라스 x RGBA, 채널마다 주름 맵 1 / 2 / 3 기여 가중치 vec3)

Number of wrinkle mask channels. (4x4 atlas x RGBA, each channel a vec3 of weights for wrinkle maps 1 / 2 / 3)

반환Returnsnumber

짝Counterpart: vanilla-engine WRINKLE_CHANNEL_COUNT