32. // Interpolation means normals may not be unit length.
normal = normalize(normal);
// Squaring a unit vector makes the components add to one.
float3 blendWeights = abs(normal * normal);
// For each axis, sample the texture and multiply by the
blend weights.
float4 colorMapValueYZ =
tex2D(colorMapX, worldPos.yz) * blendWeights.x;
float4 colorMapValueXZ =
tex2D(colorMapY, worldPos.xz) * blendWeights.y;
float4 colorMapValueXY =
tex2D(colorMapZ, worldPos.xy) * blendWeights.z;
// Combine the results
float4 colorMapValue =
colorMapValueXY + colorMapValueYZ + colorMapValueXZ;
33. Triplanar texturing
• 자연물 잘 표현
– rock, grass, …
• 인공물 잘 표현 못함
– 날카로운 모서리
– 높은 디테일
35. Using Multiple Materials
• non-uniform 영역 초기화
– black으로 setting
• uniform triangles 렌더링
– blending mode : set
• non-uniform 영역
– blending mode : additively
– material 간 부드러운 전환