Rewrote voxelSmoothPS.hlsl to derive a dominant face axis from the smooth normal, then use the exact same neighbor verification as voxelPS.hlsl: faceU/faceV tangent tables, stair-priority getNeighborMat(), face-aligned fractional coords, blendZone 0.25, corner attenuation, bleedMask checks. Added generateDebugSmooth() with 11 isolated test configurations (smooth↔blocky transitions, staircases, surrounded patches, reference blocky pairs). Launch with: BVLEVoxels.exe debugsmooth
35 lines
1.2 KiB
HLSL
35 lines
1.2 KiB
HLSL
// BVLE Voxels - Smooth Surface Nets Vertex Shader (Phase 5.1)
|
|
// Vertex pulling from StructuredBuffer<SmoothVertex>.
|
|
// Passes primaryMat + chunkIndex for per-pixel blending in PS.
|
|
|
|
#include "voxelCommon.hlsli"
|
|
|
|
struct SmoothVtx {
|
|
float3 position; // world-space position (chunk origin already added)
|
|
float3 normal; // face normal
|
|
uint matPacked; // materialID(8) | secondaryMat(8) | blendWeight(8) | pad(8)
|
|
uint chunkIndex; // packed: chunkIndex in low 16 bits
|
|
};
|
|
|
|
StructuredBuffer<SmoothVtx> smoothVertices : register(t6);
|
|
|
|
struct VSOutput {
|
|
float4 position : SV_POSITION;
|
|
float3 worldPos : WORLDPOS;
|
|
float3 normal : NORMAL;
|
|
nointerpolation uint primaryMat : PRIMARYMAT;
|
|
nointerpolation uint chunkIndex : CHUNKINDEX;
|
|
};
|
|
|
|
[RootSignature(VOXEL_ROOTSIG)]
|
|
VSOutput main(uint vertexID : SV_VertexID) {
|
|
SmoothVtx vtx = smoothVertices[vertexID];
|
|
|
|
VSOutput output;
|
|
output.position = mul(viewProjection, float4(vtx.position, 1.0));
|
|
output.worldPos = vtx.position;
|
|
output.normal = vtx.normal;
|
|
output.primaryMat = vtx.matPacked & 0xFF;
|
|
output.chunkIndex = vtx.chunkIndex & 0xFFFF;
|
|
return output;
|
|
}
|