feat: wire canvas HSL and spider editors, face support and lens repair (validation pending)

这个提交包含在:
mac 于 2026-11-05 01:28:18 +08:00 提交
1 父节点 e2aa0bd9a1
当前提交 a3bd2ceb26
19 个文件已更改
+245 -43

没有与搜索条件相匹配的文件

+11 -1
查看文件
@@ -145,7 +145,7 @@ inline float dyToolCoverage(float2 uv,float3 source,device const DYToolMaskEntry
float a=dyToolMask(x,y,source,masks[i].mask);
if(!found){coverage=masks[i].combine==1?1-a:a;found=true;}
else if(masks[i].combine==1)coverage*=1-a;else if(masks[i].combine==2)coverage*=a;else coverage=1-(1-coverage)*(1-a);
}return clamp(coverage,0.f,1.f);
}if(section==3&&h.faceOnly){float face=0;for(uint i=0;i<h.count;i++)if(masks[i].section==-100)face=1-(1-face)*(1-dyToolMask(x,y,source,masks[i].mask));for(uint i=0;i<h.count;i++)if(masks[i].section==-101)face*=1-dyToolMask(x,y,source,masks[i].mask);coverage*=face;}return clamp(coverage,0.f,1.f);
}
fragment half4 dyMaskedFragment(DYRaster in [[stage_in]],
@@ -339,3 +339,13 @@ fragment half4 dyToolCopyFragment(DYRaster in [[stage_in]],texture2d<half> sourc
#include "DYFilmKernels.inc.h"
#include "DYManagedKernels.inc.h"
#include "DYPrimaryKernels.inc.h"
// Inverse radial sampling; alpha stays premultiplied through interpolation.
kernel void dyLensRepair(texture2d<float> source [[texture(0)]],texture2d<float,access::write> output [[texture(1)]],constant DYUniforms& u [[buffer(0)]],constant float& aspect [[buffer(1)]],uint2 p [[thread_position_in_grid]]){
if(p.x>=output.get_width()||p.y>=output.get_height())return;float2 uv=(float2(p)+.5f)/float2(output.get_width(),output.get_height()),center=float2(u.lensCenterX,u.lensCenterY);float2 q=(uv-center)/max(1.f,u.lensScale),metric=q*float2(aspect,1);float2 corner=max(center,1-center)*float2(aspect,1);float radius=dot(metric,metric)/max(1e-6f,dot(corner,corner));float2 sample=center+q*(1+clamp(u.lensStrength,-100.f,100.f)*.0025f*radius);
constexpr sampler f(coord::normalized,address::clamp_to_zero,filter::linear);output.write(source.sample(f,sample),p);
}
extern "C" float dy_skinWeight(float3 color,float3 reference,constant DYUniforms& uniforms);
kernel void dySkinOverlay(texture2d<float,access::read> source [[texture(0)]],texture2d<float,access::read> graded [[texture(1)]],texture2d<float,access::write> output [[texture(2)]],device const DYToolMaskEntry* masks [[buffer(0)]],constant DYToolMaskHeader& h [[buffer(1)]],constant DYUniforms& u [[buffer(2)]],uint2 p [[thread_position_in_grid]]){
if(p.x>=output.get_width()||p.y>=output.get_height())return;float4 a=source.read(p),b=graded.read(p);float3 encoded=dyToolEncode(a.a>0?a.rgb/a.a:float3(0));float2 uv=(float2(p)+.5f)/float2(output.get_width(),output.get_height());float weight=dy_skinWeight(encoded,encoded,u)*dyToolCoverage(uv,encoded,masks,h,3)*clamp(u.skinProtection.y*.01f,0.f,1.f);float gray=dot(b.a>0?b.rgb/b.a:float3(0),float3(.2126,.7152,.0722));float3 color=mix(float3(gray*.3f),float3(1,.15f,.04f),weight*.85f);output.write(float4(color*b.a,b.a),p);
}