From 3602c8826312e864ed5cb145145357fe4ef660f7 Mon Sep 17 00:00:00 2001 From: turanszkij Date: Sun, 5 Jun 2016 20:35:23 +0200 Subject: [PATCH] redo lighting final part --- WickedEngine/objectHF.hlsli | 3 ++- WickedEngine/waterPS.hlsl | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/WickedEngine/objectHF.hlsli b/WickedEngine/objectHF.hlsli index 3f22ced6e..ee3fccecd 100644 --- a/WickedEngine/objectHF.hlsli +++ b/WickedEngine/objectHF.hlsli @@ -69,9 +69,10 @@ struct GBUFFEROutputType inline void NormalMapping(in float2 UV, in float3 V, inout float3 N, inout float3 bumpColor) { - float3 nortex = xNormalMap.Sample(sampler_aniso_wrap, UV).rgb; + float4 nortex = xNormalMap.Sample(sampler_aniso_wrap, UV); float3x3 tangentFrame = compute_tangent_frame(N, V, -UV); bumpColor = 2.0f * nortex.rgb - 1.0f; + bumpColor *= nortex.a; N = normalize(lerp(N, mul(bumpColor, tangentFrame), g_xMat_normalMapStrength)); } diff --git a/WickedEngine/waterPS.hlsl b/WickedEngine/waterPS.hlsl index a243e0dcb..887e6d307 100644 --- a/WickedEngine/waterPS.hlsl +++ b/WickedEngine/waterPS.hlsl @@ -23,8 +23,8 @@ float4 main(PixelInputType input) : SV_TARGET bumpColor1 = 2.0f * xNormalMap.Sample(sampler_aniso_wrap,input.tex + g_xMat_texMulAdd.zw).rg - 1.0f; bumpColor2 = xWaterRipples.Sample(sampler_aniso_wrap,ScreenCoord).rg; bumpColor= float3( bumpColor0+bumpColor1+bumpColor2,1 ) * g_xMat_refractionIndex; - N = normalize(mul(normalize(bumpColor), tangentFrame)); - + N = normalize(lerp(N, mul(normalize(bumpColor), tangentFrame), g_xMat_normalMapStrength)); + bumpColor *= g_xMat_normalMapStrength; //REFLECTION float2 RefTex = float2(1, -1)*input.ReflectionMapSamplingPos.xy / input.ReflectionMapSamplingPos.w / 2.0f + 0.5f; @@ -42,7 +42,7 @@ float4 main(PixelInputType input) : SV_TARGET //FRESNEL TERM float3 fresnelTerm = F_Fresnel(f0, NdotV); - albedo.rgb = lerp(reflectiveColor.rgb, refractiveColor, fresnelTerm); + albedo.rgb = lerp(refractiveColor, reflectiveColor.rgb, fresnelTerm); //DULL COLOR albedo.rgb = lerp(albedo.rgb, g_xMat_baseColor.rgb, 0.16);