DarkRuin Projection
- Exposure: public
- UE Version: 5.6
ctrl + v
1 comment
-
-----SelectUVs-----
//modified from https://ryandowlingsoka.com/unreal/triplanar-dither-biplanar/ //further reading https://therobotseven.com/devlog/triplanar-texturing-derivative-maps/ int index = trunc(selection + 0.01f);
float2 uv_choices[3] = {uvX, uvY, uvZ}; float2 deriv_choiceX[3] = {-dPdx.yz, float2(dPdx.x, -dPdx.z), dPdx.xy}; float2 deriv_choiceY[3] = {-dPdy.yz, float2(dPdy.x, -dPdy.z), dPdy.xy};
float2 flip = float2(1.f,signs[index]);
float3 tanDir[3] = { float3(0.f, -1.f, 0.f), float3(1.f, 0.f, 0.f), float3(1.f, 0.f, 0.f) };
float3 Tangent = tanDir[index] * signs[index];
//Parameters.TangentToWorld[2] == vertexNormal Tangent += Parameters.TangentToWorld[2] ( -1.f dot( Tangent, Parameters.TangentToWorld[2]) );
//return is triplanar UVs return uv_choices[index] signs[index] flip;
-----TriplanarSelection----
//modified from https://ryandowlingsoka.com/unreal/triplanar-dither-biplanar/ blend = saturate(blend); const float ditherx = blend.x - dither; const float ditherz = blend.z - dither;
int index = 0; index = max(ditherx, ditherz) > blend.y ? 0 : 1; index = ditherz > max(blend.x, blend.y) ? 2 : index;
return index;
DharmaBum
November 9, 2025, 7:05 pm