vanilladocs
vanillapunch.com
API / graphics3d/humanskinrenderer

graphics3d/humanskinrenderer

인체 피부 렌더러. (원본 graphics3d/humanskinrenderer.js)

  • SkinnedModelRenderer 의 스키닝/모프 버텍스 경로 위에 피부 / 눈 / 머리카락 셰이딩 템플릿을 세운다.
  • 선형 HDR 로 조도 / 알베도 / 스펙큘러 / 노멀을 MRT 로 나눠 출력하고, 합성은 SubsurfaceScatteringEffect 이후 호출자가 한다.
  • 머티리얼마다 셰이딩 모드를 등록한다(set_material_shading). 불투명 패스(draw)는 피부 / 눈 / 머리카락 컷아웃, 블렌드 패스(draw_blended)는 머리카락 프린지 / 차폐 / 유체를 그린다. (호출자가 블렌드 상태를 잡는다)
  • 환경 상태: 조명 3개(0번 = 키 라이트, 섀도우 수신), 3색 반구 앰비언트, 노멀, 디테일, 러프니스, 스펙큘러, 주름, 마이크로, 눈, 머리카락 파라미터.
  • GLSL 은 원본과 같다. 원본 템플릿 문자열의 ${WRINKLE_CHANNEL_COUNT} / ${SHADOW_SAMPLE_COUNT} / ${SKIN_SHADING_*} 는 숫자로, ${MORPH_GLSL} 은 생성할 때 MORPH_GLSL 을 이어 붙여 옮겼다. (시험이 숫자가 상수와 같은지 본다)
  • 텍스처 유닛: 0 = base_color, 1 = 섀도우 맵, 2 ~ 8 = 머티리얼 슬롯, 9 ~ 14 = 피부 추가 슬롯, 15 = 모프 타깃 텍스처.
  • 원본과 다른 것:
  • 원본은 SkinnedModelRenderer 를 상속한다. 러스트 판은 SkinnedModelRenderer 를 품고 Deref / DerefMut 로 기반 함수 (draw_wireframe, apply_morph_uniforms, set_sun_direction, get_shader_program ...)를 그대로 부르게 한다. 원본이 다시 정의한 draw / draw_depth / set_shadow_map / set_shadow_strength 는 이 타입의 함수가 먼저 불린다. SkinnedModel::load_from_bytes(gl, bytes, &human_skin_renderer) 처럼 기반 렌더러 자리에 그대로 넘길 수 있다. (Deref 강제 변환)
  • 그리기 함수는 기반 렌더러처럼 gl 과 &mut SkinnedModel 을 받고, 바뀐 모프 타깃 업로드를 먼저 한다.
  • 머티리얼 셰이딩 모드 표는 원본 Map<Material, number> 처럼 머티리얼 인스턴스(Rc 포인터)를 열쇠로 든다.
  • set_ambient_colors / set_hair_parameters 는 원본 배열 대신 고정 길이 배열을 받는다. set_shadow_sample_count 는 정수를 받아 원본의 Math.floor 없이 1 ~ 24 로 자른다.
  • set_shadow_map 은 기반 렌더러처럼 행렬 16개를 복사해 둔다. 생성은 셰이더 컴파일 실패를 오류(Result)로 돌려준다.

Human skin renderer. (the original graphics3d/humanskinrenderer.js)

  • 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 (set_material_shading). The opaque pass (draw) draws skin / eye / hair cutout, and the blend pass (draw_blended) 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.
  • The GLSL is the same as the original. ${WRINKLE_CHANNEL_COUNT} / ${SHADOW_SAMPLE_COUNT} / ${SKIN_SHADING_*} in the original template strings became numbers, and ${MORPH_GLSL} became MORPH_GLSL concatenated at construction. (a test checks that the numbers match the constants)
  • Texture units: 0 = base_color, 1 = shadow map, 2 ~ 8 = material slots, 9 ~ 14 = extra skin slots, 15 = morph target texture.
  • Differences from the original:
  • The original inherits from SkinnedModelRenderer. The Rust version embeds a SkinnedModelRenderer and uses Deref / DerefMut so the base functions (draw_wireframe, apply_morph_uniforms, set_sun_direction, get_shader_program ...) can be called as is. draw / draw_depth / set_shadow_map / set_shadow_strength, which the original redefines, call this type's functions first. It can be passed as is in place of the base renderer, as in SkinnedModel::load_from_bytes(gl, bytes, &human_skin_renderer). (Deref coercion)
  • The draw functions take gl and &mut SkinnedModel like the base renderer, and upload changed morph targets first.
  • The material shading mode table is keyed by material instance (Rc pointer), like the original Map<Material, number>.
  • set_ambient_colors / set_hair_parameters take fixed-length arrays instead of the original arrays. set_shadow_sample_count takes an integer and clamps it to 1 ~ 24 without the original Math.floor.
  • set_shadow_map copies the 16 matrix values like the base renderer. Construction returns shader compile failures as an error (Result).

HumanSkinRendererstruct traits Deref, DerefMut

짝Counterpart: vanilla.js HumanSkinRenderer소스source

인체 피부 렌더러.

  • 출력은 MRT 넷이다. (0 확산 조도 + 산란 마스크, 1 선형 알베도 + 커버리지, 2 스펙큘러, 3 월드 노멀)

Human skin renderer.

  • The output is four MRT targets. (0 diffuse irradiance + scattering mask, 1 linear albedo + coverage, 2 specular, 3 world normal)
예제Example머티리얼 이름으로 셰이딩 모드를 고르고 MRT 판에 불투명, 블렌드 두 패스로 그리기Pick shading modes by material name and draw to MRT targets in two passes, opaque and blend
use vanilla::{HumanSkinRenderer, Matrix4, RenderTarget, RenderTargetOptions, SkinnedModel, Vector3, SKIN_SHADING_EYE, SKIN_SHADING_HAIR};

fn create_head(gl: &vanilla::GlContext, glb_bytes: &[u8]) -> Result<(HumanSkinRenderer, SkinnedModel, RenderTarget), String> {
	let mut human_skin_renderer = HumanSkinRenderer::new(gl)?;
	let mut skinned_model = SkinnedModel::load_from_bytes(gl, glb_bytes, &human_skin_renderer)?;
	for drawable in skinned_model.get_drawable_list() {
		if drawable.material_name.contains("eyeball") {
			human_skin_renderer.set_material_shading(&drawable.material, SKIN_SHADING_EYE);
		}
		else if drawable.material_name.contains("hair") {
			human_skin_renderer.set_material_shading(&drawable.material, SKIN_SHADING_HAIR);
		}
	}
	skinned_model.update(0.0);
	let options = RenderTargetOptions { color_attachment_count: 4, use_float_color: true, use_depth_texture: true, ..RenderTargetOptions::default() };
	let scene_render_target = RenderTarget::new(gl, 1280, 720, true, Some(options))?;
	Ok((human_skin_renderer, skinned_model, scene_render_target))
}

fn render_head(gl: &vanilla::GlContext, human_skin_renderer: &HumanSkinRenderer, skinned_model: &mut SkinnedModel, scene_render_target: &RenderTarget) {
	let aspect_ratio = scene_render_target.get_width() as f64 / scene_render_target.get_height() as f64;
	let camera_position = Vector3::create(0.0, 1.6, 0.6);
	let view_matrix = Matrix4::create_look_at(camera_position, Vector3::create(0.0, 1.6, 0.0), Vector3::up());
	let mut view_projection_matrix = Matrix4::create_perspective(0.5, aspect_ratio, 0.05, 10.0);
	view_projection_matrix.multiply(&view_matrix);
	let model_matrix = Matrix4::create_identity();

	scene_render_target.bind(gl);
	unsafe {
		gl.clear_color(0.0, 0.0, 0.0, 0.0);
		gl.depth_mask(true);
		gl.clear(glow::COLOR_BUFFER_BIT | glow::DEPTH_BUFFER_BIT);
		gl.enable(glow::DEPTH_TEST);
	}
	human_skin_renderer.draw(gl, skinned_model, view_projection_matrix.get_elements(), model_matrix.get_elements(), camera_position.x, camera_position.y, camera_position.z);
	unsafe {
		gl.enable(glow::BLEND);
		gl.blend_func_separate(glow::SRC_ALPHA, glow::ONE_MINUS_SRC_ALPHA, glow::ZERO, glow::ONE);
		gl.depth_mask(false);
	}
	human_skin_renderer.draw_blended(gl, skinned_model, view_projection_matrix.get_elements(), model_matrix.get_elements(), camera_position.x, camera_position.y, camera_position.z);
	unsafe {
		gl.depth_mask(true);
		gl.disable(glow::BLEND);
	}
}
Pick shading modes by material name and draw to MRT targets in two passes, opaque and blend
생성자constructorpub fn new(gl: &GlContext) -> Result<HumanSkinRenderer, String>#0.4.0 부터since 0.4.0소스source

생성. (피부 셰이더를 주입한 기반 렌더러 + 컷아웃 깊이 셰이더, 기본 3점 조명)

Constructor. (base renderer with the skin shader injected + cutout depth shader, default 3-point lighting)

gl&GlContext
GL 컨텍스트. (Graphic::get_gl 로 꺼낸다)GL context. (taken out with Graphic::get_gl)

반환ReturnsResult<HumanSkinRenderer, String> 새 피부 렌더러. (기본 3점 조명, 그림자 강도 0, 그림자 표본 12, 머리카락 프린지 켜짐, 주름 맵 꺼짐) 셰이더 컴파일에 실패하면 Err(오류 글).New skin renderer. (default 3-point lighting, shadow strength 0, 12 shadow samples, hair fringe on, wrinkle maps off) Err(error message) if shader compilation fails.

짝Counterpart: vanilla.js HumanSkinRenderer.constructor

메서드methodpub fn draw(&self, gl: &GlContext, skinned_model: &mut SkinnedModel, view_projection_elements: &[f32; 16], model_matrix_elements: &[f32; 16], camera_x: f64, camera_y: f64, camera_z: f64)#0.4.0 부터since 0.4.0소스source

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

  • 차폐, 유체 셰이딩 머티리얼은 건너뛴다. 깊이 시험과 쓰기는 부르는 쪽이 켠다.

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

  • Occlusion and fluid shading materials are skipped. The caller turns on depth test and writes.
gl&GlContext
GL 컨텍스트.GL context.
skinned_model&mut SkinnedModel
그릴 모델. (바뀐 모프 타깃을 먼저 올린다)Model to draw. (changed morph targets are uploaded first)
view_projection_elements&[f32; 16]
투영 x 보기 행렬 원소. (열 우선 4x4)Projection x view matrix elements. (column-major 4x4)
model_matrix_elements&[f32; 16]
모델 행렬 원소. (열 우선 4x4)Model matrix elements. (column-major 4x4)
camera_xf64
카메라 월드 x. (스펙큘러와 시선 셈)Camera world x. (for specular and view direction computation)
camera_yf64
카메라 월드 y.Camera world y.
camera_zf64
카메라 월드 z.Camera world z.

짝Counterpart: vanilla.js HumanSkinRenderer.draw

메서드methodpub fn draw_blended(&self, gl: &GlContext, skinned_model: &mut SkinnedModel, view_projection_elements: &[f32; 16], model_matrix_elements: &[f32; 16], camera_x: f64, camera_y: f64, camera_z: f64)#0.4.0 부터since 0.4.0소스source

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

  • 머리카락과 얼굴 털(프린지를 켰을 때), 차폐, 유체 머티리얼만 그린다.

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

  • Draws only hair and facial hair (when the fringe is on), occlusion and fluid materials.
gl&GlContext
GL 컨텍스트.GL context.
skinned_model&mut SkinnedModel
그릴 모델. (바뀐 모프 타깃을 먼저 올린다)Model to draw. (changed morph targets are uploaded first)
view_projection_elements&[f32; 16]
투영 x 보기 행렬 원소. (열 우선 4x4)Projection x view matrix elements. (column-major 4x4)
model_matrix_elements&[f32; 16]
모델 행렬 원소. (열 우선 4x4)Model matrix elements. (column-major 4x4)
camera_xf64
카메라 월드 x. (스펙큘러와 시선 셈)Camera world x. (for specular and view direction computation)
camera_yf64
카메라 월드 y.Camera world y.
camera_zf64
카메라 월드 z.Camera world z.

짝Counterpart: vanilla.js HumanSkinRenderer.drawBlended

예제Example어태치먼트마다 알파 섞기를 켜고 깊이 쓰기를 끈 뒤 블렌드 패스 그리기Enable alpha blending per attachment, disable depth writes, then draw the blend pass
use vanilla::{HumanSkinRenderer, SkinnedModel};

fn render_blended(gl: &vanilla::GlContext, human_skin_renderer: &HumanSkinRenderer, skinned_model: &mut SkinnedModel, view_projection_elements: &[f32; 16], model_matrix_elements: &[f32; 16]) {
	unsafe {
		gl.enable(glow::BLEND);
		gl.blend_func_separate(glow::SRC_ALPHA, glow::ONE_MINUS_SRC_ALPHA, glow::ZERO, glow::ONE);
		gl.depth_mask(false);
	}
	human_skin_renderer.draw_blended(gl, skinned_model, view_projection_elements, model_matrix_elements, 0.0, 1.6, 0.6);
	unsafe {
		gl.depth_mask(true);
		gl.disable(glow::BLEND);
	}
}
메서드methodpub fn draw_pass(&self, gl: &GlContext, skinned_model: &mut SkinnedModel, view_projection_elements: &[f32; 16], model_matrix_elements: &[f32; 16], camera_x: f64, camera_y: f64, camera_z: f64, pass_mode: i32)#0.4.0 부터since 0.4.0소스source

패스 출력. (공통 유니폼 → 드로어블 순회, 패스에 맞는 셰이딩 모드만, pass_mode 0 = 불투명, 1 = 블렌드)

Draws a pass. (common uniforms → iterate drawables, only the shading modes matching the pass, pass_mode 0 = opaque, 1 = blend)

gl&GlContext
GL 컨텍스트.GL context.
skinned_model&mut SkinnedModel
그릴 모델. (바뀐 모프 타깃을 먼저 올린다)Model to draw. (changed morph targets are uploaded first)
view_projection_elements&[f32; 16]
투영 x 보기 행렬 원소. (열 우선 4x4)Projection x view matrix elements. (column-major 4x4)
model_matrix_elements&[f32; 16]
모델 행렬 원소. (열 우선 4x4)Model matrix elements. (column-major 4x4)
camera_xf64
카메라 월드 x. (스펙큘러와 시선 셈)Camera world x. (for specular and view direction computation)
camera_yf64
카메라 월드 y.Camera world y.
camera_zf64
카메라 월드 z.Camera world z.
pass_modei32
패스. (0 = 불투명, 1 = 블렌드)Pass. (0 = opaque, 1 = blend)

짝Counterpart: vanilla.js HumanSkinRenderer.drawPass

메서드methodpub fn draw_depth(&self, gl: &GlContext, skinned_model: &mut SkinnedModel, light_view_projection_elements: &[f32; 16], model_matrix_elements: &[f32; 16])#0.4.0 부터since 0.4.0소스source

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

  • 부르기 전에 ShadowMap::begin_render 로 깊이 판을 묶는다. 컷아웃 패스는 0 번 유닛에 커버리지 텍스처를 묶는다.

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

  • Bind the depth target with ShadowMap::begin_render before calling. The cutout pass binds the coverage texture to unit 0.
gl&GlContext
GL 컨텍스트.GL context.
skinned_model&mut SkinnedModel
그릴 모델. (바뀐 모프 타깃을 먼저 올린다)Model to draw. (changed morph targets are uploaded first)
light_view_projection_elements&[f32; 16]
광원 뷰 투영 행렬 원소. (ShadowMap::get_light_view_projection_matrix 의 원소)Light view-projection matrix elements. (elements of ShadowMap::get_light_view_projection_matrix)
model_matrix_elements&[f32; 16]
모델 행렬 원소. (열 우선 4x4)Model matrix elements. (column-major 4x4)

짝Counterpart: vanilla.js HumanSkinRenderer.drawDepth

예제Example키 라이트 섀도우 맵에 깊이를 그리고 본 패스에서 받게 하기Draw depth into the key light shadow map and receive it in the main pass
use vanilla::{HumanSkinRenderer, Matrix4, ShadowMap, SkinnedModel, Vector3};

fn render_shadow(gl: &vanilla::GlContext, human_skin_renderer: &mut HumanSkinRenderer, shadow_map: &mut ShadowMap, skinned_model: &mut SkinnedModel) {
	shadow_map.update_light_matrix(Vector3::create(0.0, 1.6, 0.0), Vector3::create(-0.45, -0.6, -0.65), 0.45, 0.2, 4.0);
	let light_view_projection_elements = *shadow_map.get_light_view_projection_matrix().get_elements();
	let model_matrix = Matrix4::create_identity();
	shadow_map.begin_render(gl);
	human_skin_renderer.draw_depth(gl, skinned_model, &light_view_projection_elements, model_matrix.get_elements());
	let texel_size = 1.0 / shadow_map.get_resolution() as f64;
	human_skin_renderer.set_shadow_map(Some(shadow_map.get_depth_texture()), Some(&light_view_projection_elements), texel_size);
	human_skin_renderer.set_shadow_strength(0.85);
}
메서드methodpub fn apply_environment_uniforms(&self, gl: &GlContext, shader_program: &ShaderProgram)#0.4.0 부터since 0.4.0소스source

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

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

gl&GlContext
GL 컨텍스트.GL context.
shader_program&ShaderProgram
유니폼을 걸 셰이더. (지금 쓰는 프로그램이어야 한다)Shader to set the uniforms on. (must be the program currently in use)

짝Counterpart: vanilla.js HumanSkinRenderer.applyEnvironmentUniforms

메서드methodpub fn apply_shadow_uniforms(&self, gl: &GlContext, shader_program: &ShaderProgram)#0.4.0 부터since 0.4.0소스source

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

  • 섀도우 맵과 광원 행렬이 둘 다 있으면 설정한 강도를 쓰고, 아니면 강도 0 과 빈 섀도우 텍스처를 묶는다.

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

  • If both the shadow map and the light matrix exist, the set strength is used, otherwise strength 0 and an empty shadow texture are bound.
gl&GlContext
GL 컨텍스트.GL context.
shader_program&ShaderProgram
유니폼을 걸 셰이더. (지금 쓰는 프로그램이어야 한다)Shader to set the uniforms on. (must be the program currently in use)

짝Counterpart: vanilla.js HumanSkinRenderer.applyShadowUniforms

메서드methodpub fn set_shadow_map(&mut self, shadow_map_texture: Option<GlTexture>, light_view_projection_elements: Option<&[f32; 16]>, texel_size: f64)#0.4.0 부터since 0.4.0소스source

섀도우 맵 설정. (본 패스에서 그림자 수신, 기반 렌더러에도 전달, 행렬은 복사해 둔다)

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

shadow_map_textureOption<GlTexture>
섀도우 깊이 텍스처. (None 이면 그림자를 받지 않는다)Shadow depth texture. (no shadows are received when None)
light_view_projection_elementsOption<&[f32; 16]>
광원 뷰 투영 행렬 원소. (None 이면 그림자를 받지 않는다)Elements of the light view-projection matrix. (no shadows are received when None)
texel_sizef64
섀도우 텍셀 크기. (1 / 섀도우 맵 해상도)Shadow texel size. (1 / shadow map resolution)

짝Counterpart: vanilla.js HumanSkinRenderer.setShadowMap

메서드methodpub fn set_shadow_strength(&mut self, shadow_strength: f64)#0.4.0 부터since 0.4.0소스source

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

Sets the shadow strength. (0 = no receiving)

shadow_strengthf64
그림자 강도. (0 이면 받지 않고 1 이면 다 받는다, 기본 0)Shadow strength. (0 receives none and 1 receives all, default 0)

짝Counterpart: vanilla.js HumanSkinRenderer.setShadowStrength

메서드methodpub fn set_shadow_softness(&mut self, shadow_softness: f64)#0.4.0 부터since 0.4.0소스source

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

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

shadow_softnessf64
포아송 표본을 흩는 반경. (섀도우 텍셀 단위, 기본 2.5)Radius for scattering Poisson samples. (in shadow texels, default 2.5)

짝Counterpart: vanilla.js HumanSkinRenderer.setShadowSoftness

메서드methodpub fn set_shadow_sample_count(&mut self, shadow_sample_count: i32)#0.4.0 부터since 0.4.0소스source

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

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

shadow_sample_counti32
표본 수. (1 ~ 24 로 자른다, 기본 12)Sample count. (clamped to 1 ~ 24, default 12)

짝Counterpart: vanilla.js HumanSkinRenderer.setShadowSampleCount

메서드methodpub fn set_hair_sway(&mut self, amplitude: f64, time: f64, frequency: f64)#0.4.0 부터since 0.4.0소스source

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

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

amplitudef64
진폭. (미터, 가닥 끝일수록 크게, 0 이면 흔들지 않음, 기본 0)Amplitude. (meters, larger toward strand tips, no sway at 0, default 0)
timef64
시간. (초, 프레임마다 흐른 시간을 넣는다)Time. (seconds, give the elapsed time every frame)
frequencyf64
주파수. (기본 1.5)Frequency. (default 1.5)

짝Counterpart: vanilla.js HumanSkinRenderer.setHairSway

예제Example프레임마다 흐른 시간으로 머리카락 흔들기Sway the hair with the time elapsed every frame
use vanilla::HumanSkinRenderer;

fn update_hair(human_skin_renderer: &mut HumanSkinRenderer, elapsed_seconds: f64) {
	human_skin_renderer.set_hair_sway(0.003, elapsed_seconds, 1.6);
}
메서드methodpub fn set_hair_fringe(&mut self, use_hair_fringe: bool)#0.4.0 부터since 0.4.0소스source

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

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

use_hair_fringebool
true 면 블렌드 패스에서 머리카락과 얼굴 털 프린지를 그린다. (기본 true)If true, the hair and facial hair fringe is drawn in the blend pass. (default true)

짝Counterpart: vanilla.js HumanSkinRenderer.setHairFringe

메서드methodpub fn set_material_shading(&mut self, material: &Rc<Material>, shading_mode: i32)#0.4.0 부터since 0.4.0소스source

머티리얼 셰이딩 모드 등록. (등록하지 않은 머티리얼은 피부, 같은 인스턴스는 값만 바꾼다)

Registers a material shading mode. (unregistered materials are skin, the same instance only has its value changed)

material&Rc<Material>
드로어블이 든 머티리얼. (Rc 포인터로 인스턴스를 가린다)Material held by the drawable. (the instance is identified by its Rc pointer)
shading_modei32
셰이딩 모드. (SKIN_SHADING_SKIN, SKIN_SHADING_EYE 같은 상수)Shading mode. (constants such as SKIN_SHADING_SKIN, SKIN_SHADING_EYE)

짝Counterpart: vanilla.js HumanSkinRenderer.setMaterialShading

메서드methodpub fn get_material_shading_mode(&self, material: &Material) -> i32#0.4.0 부터since 0.4.0소스source

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

Returns the material shading mode.

material&Material
볼 머티리얼.Material to look up.

반환Returnsi32 등록한 셰이딩 모드. 등록하지 않은 머티리얼이면 SKIN_SHADING_SKIN.Registered shading mode. SKIN_SHADING_SKIN for an unregistered material.

짝Counterpart: vanilla.js HumanSkinRenderer.getMaterialShadingMode

메서드methodpub fn set_light(&mut self, light_index: usize, direction_x: f64, direction_y: f64, direction_z: f64, red: f64, green: f64, blue: f64, intensity: f64)#0.4.0 부터since 0.4.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)

light_indexusize
조명 번호. (0 = 키, 1 = 필, 2 = 림, 3 이상은 무시)Light index. (0 = key, 1 = fill, 2 = rim, 3 or more is ignored)
direction_xf64
표면에서 빛을 향하는 방향의 x. (길이는 상관없고 정규화한다)x of the direction from the surface toward the light. (any length, normalized)
direction_yf64
방향의 y.y of the direction.
direction_zf64
방향의 z.z of the direction.
redf64
빛 색의 빨강. (선형)Red of the light color. (linear)
greenf64
빛 색의 초록. (선형)Green of the light color. (linear)
bluef64
빛 색의 파랑. (선형)Blue of the light color. (linear)
intensityf64
세기. (색에 곱한다)Intensity. (multiplied into the color)

짝Counterpart: vanilla.js HumanSkinRenderer.setLight

예제Example위 앞에서 비추는 따뜻한 키 라이트와 뒤에서 비추는 흰 림 라이트A warm key light shining from above in front and a white rim light shining from behind
use vanilla::HumanSkinRenderer;

fn set_portrait_lights(human_skin_renderer: &mut HumanSkinRenderer) {
	human_skin_renderer.set_light(0, 0.45, 0.6, 0.65, 1.0, 0.93, 0.85, 3.2);
	human_skin_renderer.set_light(2, 0.5, 0.4, -0.75, 0.9, 0.95, 1.0, 2.2);
}
메서드methodpub fn set_ambient_colors(&mut self, sky_color: [f64; 3], horizon_color: [f64; 3], ground_color: [f64; 3])#0.4.0 부터since 0.4.0소스source

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

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

sky_color[f64; 3]
위를 향한 면의 색. (선형 rgb, 기본 (0.34, 0.36, 0.42))Color of upward-facing surfaces. (linear rgb, default (0.34, 0.36, 0.42))
horizon_color[f64; 3]
옆을 향한 면의 색. (선형 rgb, 기본 (0.16, 0.15, 0.16))Color of sideways-facing surfaces. (linear rgb, default (0.16, 0.15, 0.16))
ground_color[f64; 3]
아래를 향한 면의 색. (선형 rgb, 기본 (0.05, 0.04, 0.045))Color of downward-facing surfaces. (linear rgb, default (0.05, 0.04, 0.045))

짝Counterpart: vanilla.js HumanSkinRenderer.setAmbientColors

메서드methodpub fn set_normal_strength(&mut self, normal_strength: f64)#0.4.0 부터since 0.4.0소스source

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

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

normal_strengthf64
노멀 맵 xy 배율. (1 = 원본, 기본 1)Normal map xy multiplier. (1 = unchanged, default 1)

짝Counterpart: vanilla.js HumanSkinRenderer.setNormalStrength

메서드methodpub fn set_detail_strength(&mut self, detail_strength: f64)#0.4.0 부터since 0.4.0소스source

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

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

detail_strengthf64
높이 디테일 노멀 강도. (0 이면 없음, 기본 6)Height detail normal strength. (none at 0, default 6)

짝Counterpart: vanilla.js HumanSkinRenderer.setDetailStrength

메서드methodpub fn set_detail_texel_size(&mut self, detail_texel_size: f64)#0.4.0 부터since 0.4.0소스source

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

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

detail_texel_sizef64
높이 맵 한 텍셀의 UV 크기. (1 / 높이 맵 해상도, 기본 1 / 4096)UV size of one height map texel. (1 / height map resolution, default 1 / 4096)

짝Counterpart: vanilla.js HumanSkinRenderer.setDetailTexelSize

메서드methodpub fn set_cavity_strength(&mut self, cavity_strength: f64)#0.4.0 부터since 0.4.0소스source

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

Sets the cavity strength. (0 = no occlusion)

cavity_strengthf64
캐비티 강도. (높이 맵의 오목한 곳을 어둡게, 0 이면 없음, 기본 6)Cavity strength. (darkens concave areas of the height map, none at 0, default 6)

짝Counterpart: vanilla.js HumanSkinRenderer.setCavityStrength

메서드methodpub fn set_roughness_range(&mut self, minimum_roughness: f64, maximum_roughness: f64)#0.4.0 부터since 0.4.0소스source

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

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

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

짝Counterpart: vanilla.js HumanSkinRenderer.setRoughnessRange

메서드methodpub fn set_specular_strength(&mut self, specular_strength: f64)#0.4.0 부터since 0.4.0소스source

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

Sets the specular strength. (skin F0 multiplier)

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

짝Counterpart: vanilla.js HumanSkinRenderer.setSpecularStrength

메서드methodpub fn set_sheen_strength(&mut self, sheen_strength: f64)#0.4.0 부터since 0.4.0소스source

잔털 산란 강도 설정.

Sets the vellus hair scattering strength.

sheen_strengthf64
잔털 산란 강도. (비스듬한 가장자리의 밝기, 기본 0.35)Peach fuzz scattering strength. (brightness at grazing edges, default 0.35)

짝Counterpart: vanilla.js HumanSkinRenderer.setSheenStrength

메서드methodpub fn set_subsurface_amount(&mut self, subsurface_amount: f64)#0.4.0 부터since 0.4.0소스source

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

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

subsurface_amountf64
SSS 마스크 강도. (머티리얼의 서브서피스 팩터와 곱해 조도 출력 알파로, 기본 1)SSS mask strength. (multiplied by the material's subsurface factor into the irradiance output alpha, default 1)

짝Counterpart: vanilla.js HumanSkinRenderer.setSubsurfaceAmount

메서드methodpub fn set_micro_detail(&mut self, micro_tiling: f64, micro_strength: f64)#0.4.0 부터since 0.4.0소스source

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

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

micro_tilingf64
마이크로 텍스처 UV 반복 횟수. (기본 0)Micro texture UV repeat count. (default 0)
micro_strengthf64
마이크로 노멀과 캐비티 강도. (0 이면 없음, 기본 0)Micro normal and cavity strength. (none at 0, default 0)

짝Counterpart: vanilla.js HumanSkinRenderer.setMicroDetail

메서드methodpub fn set_wrinkle_maps(&mut self, use_wrinkle_maps: bool, normal_strength: f64, color_strength: f64)#0.4.0 부터since 0.4.0소스source

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

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

use_wrinkle_mapsbool
주름 맵을 쓸지. (기본 false)Whether to use wrinkle maps. (default false)
normal_strengthf64
주름 노멀 강도. (기본 1)Wrinkle normal strength. (default 1)
color_strengthf64
주름 색 강도. (기본 1)Wrinkle color strength. (default 1)

짝Counterpart: vanilla.js HumanSkinRenderer.setWrinkleMaps

메서드methodpub fn set_wrinkle_channel_weight(&mut self, channel_index: usize, weight1: f64, weight2: f64, weight3: f64)#0.4.0 부터since 0.4.0소스source

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

  • 다 넣은 뒤 finish_wrinkle_channel_weights 를 불러야 셰이더가 가중치가 생긴 타일을 읽는다.

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

  • After setting them all, call finish_wrinkle_channel_weights so the shader reads the tiles that got weights.
channel_indexusize
채널 번호. (0 ~ 63, 64 이상은 무시)Channel index. (0 ~ 63, 64 or more is ignored)
weight1f64
주름 맵 1 의 기여 가중치.Contribution weight of wrinkle map 1.
weight2f64
주름 맵 2 의 기여 가중치.Contribution weight of wrinkle map 2.
weight3f64
주름 맵 3 의 기여 가중치.Contribution weight of wrinkle map 3.

짝Counterpart: vanilla.js HumanSkinRenderer.setWrinkleChannelWeight

예제Example첫 타일 네 채널에 주름 맵 1 을 반쯤 걸고 마무리하기Apply wrinkle map 1 at about half to the four channels of the first tile and finish
use vanilla::HumanSkinRenderer;

fn apply_expression(human_skin_renderer: &mut HumanSkinRenderer) {
	human_skin_renderer.set_wrinkle_maps(true, 1.0, 0.45);
	for channel_index in 0..4 {
		human_skin_renderer.set_wrinkle_channel_weight(channel_index, 0.5, 0.0, 0.0);
	}
	human_skin_renderer.finish_wrinkle_channel_weights();
}
메서드methodpub fn finish_wrinkle_channel_weights(&mut self)#0.4.0 부터since 0.4.0소스source

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

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

짝Counterpart: vanilla.js HumanSkinRenderer.finishWrinkleChannelWeights

메서드methodpub fn set_eye_parameters(&mut self, iris_radius: f64, pupil_radius: f64, iris_depth: f64)#0.4.0 부터since 0.4.0소스source

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

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

iris_radiusf64
홍채 반경. (UV 단위, 기본 0.133)Iris radius. (UV units, default 0.133)
pupil_radiusf64
동공 반경. (UV 단위, 기본 0.04)Pupil radius. (UV units, default 0.04)
iris_depthf64
홍채 평면 깊이. (각막 굴절 시차의 크기, 기본 0.05)Iris plane depth. (amount of corneal refraction parallax, default 0.05)

짝Counterpart: vanilla.js HumanSkinRenderer.setEyeParameters

메서드methodpub fn set_eye_closure(&mut self, eye_closure: f64)#0.4.0 부터since 0.4.0소스source

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

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

eye_closuref64
감김 정도. (0 = 뜬 눈, 1 = 감은 눈, 0 ~ 1 로 자른다)Closure amount. (0 = open eye, 1 = closed eye, clamped to 0 ~ 1)

짝Counterpart: vanilla.js HumanSkinRenderer.setEyeClosure

메서드methodpub fn set_hair_parameters(&mut self, specular_shift: [f64; 2], specular_power: [f64; 2], specular_intensity: [f64; 3], root_shade: f64)#0.4.0 부터since 0.4.0소스source

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

  • specular_shift: [1차, 2차], specular_power: [1차, 2차], specular_intensity: [1차, 2차, 투과]

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

  • specular_shift: [primary, secondary], specular_power: [primary, secondary], specular_intensity: [primary, secondary, transmission]
specular_shift[f64; 2]
1차, 2차 로브 시프트. (기본 [-0.12, 0.14])Primary and secondary lobe shift. (default [-0.12, 0.14])
specular_power[f64; 2]
1차, 2차 로브 지수. (기본 [180.0, 28.0])Primary and secondary lobe exponent. (default [180.0, 28.0])
specular_intensity[f64; 3]
1차, 2차 로브 강도와 투과 강도. (기본 [0.35, 0.5, 0.25])Primary and secondary lobe strength and transmission strength. (default [0.35, 0.5, 0.25])
root_shadef64
뿌리 차폐. (0 이면 없음, 기본 0.45)Root occlusion. (none at 0, default 0.45)

짝Counterpart: vanilla.js HumanSkinRenderer.setHairParameters

메서드methodpub fn get_cutout_depth_shader_program(&self) -> &ShaderProgram#0.4.0 부터since 0.4.0소스source

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

Returns the cutout depth shader program.

반환Returns&ShaderProgram 컷아웃 깊이 셰이더 프로그램. (머리카락, 알파 컷아웃 머티리얼의 섀도우 깊이 패스)Cutout depth shader program. (shadow depth pass for hair and alpha cutout materials)

짝Counterpart: vanilla.js HumanSkinRenderer.getCutoutDepthShaderProgram

함수Functions

함수functionpub fn create_skin_vertex_shader_source() -> String#0.4.0 부터since 0.4.0소스source

피부 버텍스 셰이더 소스 만들기. (원본 SKIN_VERTEXSHADER_SOURCE, 모프 GLSL 을 가운데 넣는다)

Builds the skin vertex shader source. (the original SKIN_VERTEXSHADER_SOURCE, with the morph GLSL inserted in the middle)

반환ReturnsString 피부 버텍스 셰이더 GLSL. (앞부분 + MORPH_GLSL + 뒷부분, #version 300 es 로 시작)Skin vertex shader GLSL. (first part + MORPH_GLSL + last part, starts with #version 300 es)

함수functionpub fn create_cutout_depth_vertex_shader_source() -> String#0.4.0 부터since 0.4.0소스source

컷아웃 깊이 버텍스 셰이더 소스 만들기. (원본 CUTOUT_DEPTH_VERTEXSHADER_SOURCE)

Builds the cutout depth vertex shader source. (the original CUTOUT_DEPTH_VERTEXSHADER_SOURCE)

반환ReturnsString 컷아웃 깊이 버텍스 셰이더 GLSL. (앞부분 + MORPH_GLSL + 뒷부분, #version 300 es 로 시작)Cutout depth vertex shader GLSL. (first part + MORPH_GLSL + last part, starts with #version 300 es)

상수Constants

상수constantpub const SKIN_SHADING_SKIN: i32 = 0#0.4.0 부터since 0.4.0소스source

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

Shading mode. (set per material with set_material_shading, branches within the same shader)

반환Returnsi32

짝Counterpart: vanilla.js SKIN_SHADING_SKIN

상수constantpub const SKIN_SHADING_EYE: i32 = 1#0.4.0 부터since 0.4.0소스source

눈. (각막 굴절 시차로 홍채를 읽고, 공막, 동공, 각막 하이라이트)

Eye. (reads the iris with corneal refraction parallax, sclera, pupil, corneal highlights)

반환Returnsi32

짝Counterpart: vanilla.js SKIN_SHADING_EYE

상수constantpub const SKIN_SHADING_HAIR: i32 = 2#0.4.0 부터since 0.4.0소스source

머리카락. (카드 탄젠트 이방성 하이라이트, 컷아웃과 프린지 블렌드 두 패스, 흔들림 적용)

Hair. (card tangent anisotropic highlights, two passes of cutout and fringe blend, sway applied)

반환Returnsi32

짝Counterpart: vanilla.js SKIN_SHADING_HAIR

상수constantpub const SKIN_SHADING_OCCLUSION: i32 = 3#0.4.0 부터since 0.4.0소스source

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

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

반환Returnsi32

짝Counterpart: vanilla.js SKIN_SHADING_OCCLUSION

상수constantpub const SKIN_SHADING_FLUID: i32 = 4#0.4.0 부터since 0.4.0소스source

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

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

반환Returnsi32

짝Counterpart: vanilla.js SKIN_SHADING_FLUID

상수constantpub const SKIN_SHADING_FACIALHAIR: i32 = 5#0.4.0 부터since 0.4.0소스source

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

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

반환Returnsi32

짝Counterpart: vanilla.js SKIN_SHADING_FACIALHAIR

상수constantpub const SKIN_TEXTURE_UNIT_DETAILHEIGHT: u32 = 9#0.4.0 부터since 0.4.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)

반환Returnsu32

짝Counterpart: vanilla.js SKIN_TEXTURE_UNIT_DETAILHEIGHT

상수constantpub const SKIN_TEXTURE_UNIT_MICRO: u32 = 10#0.4.0 부터since 0.4.0소스source

마이크로 노멀(rgb) + 캐비티(a) 유닛. (유니폼 microTexture, set_micro_detail 의 횟수만큼 반복)

Micro normal (rgb) + cavity (a) unit. (uniform microTexture, repeated set_micro_detail times)

반환Returnsu32

짝Counterpart: vanilla.js SKIN_TEXTURE_UNIT_MICRO

상수constantpub const SKIN_TEXTURE_UNIT_MASKATLAS: u32 = 11#0.4.0 부터since 0.4.0소스source

주름 마스크 아틀라스 유닛. (유니폼 maskAtlasTexture, 4x4 타일 x RGBA = 64 채널)

Wrinkle mask atlas unit. (uniform maskAtlasTexture, 4x4 tiles x RGBA = 64 channels)

반환Returnsu32

짝Counterpart: vanilla.js SKIN_TEXTURE_UNIT_MASKATLAS

상수constantpub const SKIN_TEXTURE_UNIT_LAYERNORMAL: u32 = 12#0.4.0 부터since 0.4.0소스source

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

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

반환Returnsu32

짝Counterpart: vanilla.js SKIN_TEXTURE_UNIT_LAYERNORMAL

상수constantpub const SKIN_TEXTURE_UNIT_LAYERCOLOR: u32 = 13#0.4.0 부터since 0.4.0소스source

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

Layer color unit. (uniform layerColorTexture, wrinkle color atlas 2x2 for skin, iris color for eyes)

반환Returnsu32

짝Counterpart: vanilla.js SKIN_TEXTURE_UNIT_LAYERCOLOR

상수constantpub const SKIN_TEXTURE_UNIT_AUXILIARY: u32 = 14#0.4.0 부터since 0.4.0소스source

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

Auxiliary unit. (uniform auxiliaryTexture, declared in the shader but never read)

반환Returnsu32

짝Counterpart: vanilla.js SKIN_TEXTURE_UNIT_AUXILIARY

상수constantpub const WRINKLE_CHANNEL_COUNT: usize = 64#0.4.0 부터since 0.4.0소스source

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

Wrinkle mask channel count. (4x4 atlas x RGBA, a vec3 of wrinkle map 1 / 2 / 3 contribution weights per channel)

반환Returnsusize

짝Counterpart: vanilla.js WRINKLE_CHANNEL_COUNT

상수constantpub const SKIN_FRAGMENTSHADER_SOURCE: &str#0.4.0 부터since 0.4.0소스source

인체 피부 프래그먼트 셰이더. (선형 HDR, 화면 공간 SSS 를 위해 조도 / 알베도 / 스펙큘러를 분리 출력)

  • 조명: 방향광 3개(0번은 섀도우 맵 수신) + 3색 반구 앰비언트 + 조명 방향의 소프트박스 반사 환경.
  • 피부: 노멀 맵 + 표정 주름 맵(마스크 아틀라스 가중 혼합) + 타일링 마이크로 노멀 / 캐비티 + 높이 미분 디테일, 이중 로브 GGX, 잔털.
  • 눈: 각막 굴절 시차로 홍채를 샘플링, 홍채 노멀 / 림버스 / 동공, 각막 유리 하이라이트 + 환경 반사, 공막 정맥 노멀.
  • 머리카락: 카드 탄젠트 아틀라스로 Kajiya-Kay 이중 로브 이방성 하이라이트, 뿌리 차폐, 투과 역광, 컷아웃 + 프린지 블렌드 2패스.
  • 차폐 / 유체: 블렌드 패스 전용, 눈꺼풀 차폐 메시는 조도만 어둡게, 눈물선 / 침은 스펙큘러만 얹는다.
  • 얼굴 털(눈썹 / 수염): 머리카락과 같은 셰이딩이지만 흔들림은 적용하지 않는다.
  • 출력 0: 확산 조도(rgb) + SSS 마스크(a) / 1: 선형 알베도(rgb) + 커버리지(a) / 2: 스펙큘러(rgb) / 3: 월드 노멀(rgb).

Human skin fragment shader. (linear HDR, outputs irradiance / albedo / specular separately for screen-space SSS)

  • Lighting: 3 directional lights (0 receives the shadow map) + 3-color hemisphere ambient + softbox reflection environment in the light directions.
  • Skin: normal map + expression wrinkle maps (weighted blend of the mask atlas) + tiling micro normal / cavity + height derivative detail, dual-lobe GGX, peach fuzz.
  • Eyes: samples the iris with corneal refraction parallax, iris normal / limbus / pupil, corneal glass highlights + environment reflection, scleral vein normals.
  • Hair: Kajiya-Kay dual-lobe anisotropic highlights from the card tangent atlas, root occlusion, transmitted backlight, 2 passes of cutout + fringe blend.
  • Occlusion / fluid: blend pass only, the eyelid occlusion mesh only darkens irradiance, tear lines / saliva only add specular.
  • Facial hair (eyebrows / beard): the same shading as hair but without sway.
  • Output 0: diffuse irradiance (rgb) + SSS mask (a) / 1: linear albedo (rgb) + coverage (a) / 2: specular (rgb) / 3: world normal (rgb).

반환Returns&str