ODOShader

ODOS丨Mapping&Bumping

by ERIN.Z, 2022-03-01


Snipaste_2022-03-02_00-33-06.png

Planar-Mapping

vec2 texuv = p.xy*.5+.5;
diffusecol = texture(iChannel0,texuv).rgb;

OneSide

Tri-PlanarMapping

vec3 texn = pow(abs(n),vec3(8));
texn /= texn.x+texn.y+texn.z;
vec3 colxz = texture(iChannel0,p.xz*.5+.5).rgb;
vec3 colyz = texture(iChannel0,p.yz*.5+.5).rgb;
vec3 colxy = texture(iChannel0,p.xy*.5+.5).rgb;
diffusecol = colxz*texn.y+colyz*texn.x+colxy*texn.z;

TriSide pow()用来加强三个面直接的分化程度,乘完别忘记保证xyz分量的加和为1,这里abs(n)过亮了就是因为少了这一步~ TriSide

PolarMapping

vec2 texuv = vec2(atan(p.x,p.z)/2./PI,p.y);
vec4 cat = texture(iChannel1,texuv);
diffusecol = mix(diffusecol,vec3(cat.rgb),cat.w);

Polar

Bumping

利用PolarMapping可以在SDF函数里采样一个高度图加在d上,就可以实现—— Snipaste_2022-03-02_00-33-06.png

by ERIN.Z

2024 © typecho & elise