#pragma kernel FgFiltDist //float4x4 Transform; //float Xmin; //float Xmax; //float Ymin; //float Ymax; //float Zmin; //float Zmax; float4 _PosMin; float4 _PosMaxX; float4 _PosMaxY; float4 _PosMaxZ; float4 _PosDot; RWTexture2D VertexTex; [numthreads(8, 8, 1)] void FgFiltDist(uint3 id : SV_DispatchThreadID) { float4 vertex = VertexTex[id.xy]; float3 vpos = (float3)vertex; // mul(Transform, vertex).xyz; bool mask = (vertex.a != 0); // && (vpos.y >= 0); //bool isInside = vpos.x >= Xmin && vpos.x <= Xmax && vpos.y >= Ymin && vpos.y <= Ymax && vpos.z >= Zmin && vpos.z <= Zmax; //mask = mask && isInside; float3 pmin = (float3)_PosMin; float3 pv = vpos - pmin; float3 px = (float3)_PosMaxX; float3 py = (float3)_PosMaxY; float3 pz = (float3)_PosMaxZ; float3 pdot = (float3)_PosDot; float dx = dot(pv, px); bool bx = dx >= 0.0 && dx <= pdot.x; float dy = dot(pv, py); bool by = dy >= 0.0 && dy <= pdot.y; float dz = dot(pv, pz); bool bz = dz >= 0.0 && dz <= pdot.z; mask = mask && bx && by && bz; VertexTex[id.xy] = float4(mask, mask, mask, mask); }