Terrain Texture: ORM map not applied properly
lukaspj opened this issue · 2 comments
lukaspj commented
There is some bad math in the calculation of the ORM map, only the first layer with ORM is applied properly:
// Composite Matinfo map 0
float3 matinfoCol0 = lerp(float3(1.0,1.0,0.0),ormMapArray.Sample(ormMapSampler, float3(IN.detCoord0.xy,detailIdStrengthParallax[0].x)).rgb, detailBlend0);
OUT.col2 = float4(0.0,matinfoCol0);
// Composite Matinfo map 1
float3 matinfoCol1 = ormMapArray.Sample(ormMapSampler, float3(IN.detCoord1.xy, detailIdStrengthParallax[1].x)).rgb*detailBlend1;
OUT.col2.gba += matinfoCol1;
Wouldn't that set it to (1,1,0) after the first composite map, and then when you add the second composite map, those would get above 1 since you add it?
lukaspj commented
I tried changing it to:
// Composite Matinfo map 0
OUT.col2 = float4(0.0, 1.0, 1.0, 0.0);
float3 matinfoCol0 = lerp(OUT.col2.gba, ormConfigMapTex0.Sample(ormConfigMap0, IN.detCoord0.xy).rgb, detailBlend0);
OUT.col2.gba = matinfoCol0;
// Composite Matinfo map 1
float3 matinfoCol1 = lerp(OUT.col2.gba, ormConfigMapTex1.Sample(ormConfigMap1, IN.detCoord1.xy).rgb, detailBlend1);
OUT.col2.gba = matinfoCol1;
But there is still several oddities around the ORM map.