Skip to content

Commit

Permalink
terrain shader fix
Browse files Browse the repository at this point in the history
  • Loading branch information
turanszkij committed Oct 18, 2020
1 parent e944f9e commit fb71fd6
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 99 deletions.
10 changes: 10 additions & 0 deletions Content.vcxitems
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
</None>
<None Include="$(MSBuildThisFileDirectory)models\blend_instancing_test.wiscene">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
</None>
<None Include="$(MSBuildThisFileDirectory)models\cameras.wiscene">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
Expand Down
3 changes: 3 additions & 0 deletions Content.vcxitems.filters
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@
<None Include="$(MSBuildThisFileDirectory)Documentation\WickedEngine-Documentation.md">
<Filter>Documentation</Filter>
</None>
<None Include="$(MSBuildThisFileDirectory)models\blend_instancing_test.wiscene">
<Filter>models</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Image Include="$(MSBuildThisFileDirectory)models\Sponza\textures\background.png">
Expand Down
47 changes: 0 additions & 47 deletions Editor/Editor_UWP.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -444,53 +444,6 @@
<ItemGroup>
<Font Include="..\WickedEngine\fonts\arial.ttf" />
</ItemGroup>
<ItemGroup>
<FxCompile Update="C:\PROJECTS\WickedEngine\WickedEngine\hairparticlePS.hlsl">
<FileType>Document</FileType>
</FxCompile>
<FxCompile Update="C:\PROJECTS\WickedEngine\WickedEngine\hairparticlePS_transparent.hlsl">
<FileType>Document</FileType>
</FxCompile>
<FxCompile Update="C:\PROJECTS\WickedEngine\WickedEngine\impostorPS.hlsl">
<FileType>Document</FileType>
</FxCompile>
<FxCompile Update="C:\PROJECTS\WickedEngine\WickedEngine\objectPS.hlsl">
<FileType>Document</FileType>
</FxCompile>
<FxCompile Update="C:\PROJECTS\WickedEngine\WickedEngine\objectPS_planarreflection.hlsl">
<FileType>Document</FileType>
</FxCompile>
<FxCompile Update="C:\PROJECTS\WickedEngine\WickedEngine\objectPS_pom.hlsl">
<FileType>Document</FileType>
</FxCompile>
<FxCompile Update="C:\PROJECTS\WickedEngine\WickedEngine\objectPS_terrain.hlsl">
<FileType>Document</FileType>
</FxCompile>
<FxCompile Update="C:\PROJECTS\WickedEngine\WickedEngine\objectPS_transparent.hlsl">
<FileType>Document</FileType>
</FxCompile>
<FxCompile Update="C:\PROJECTS\WickedEngine\WickedEngine\objectPS_transparent_planarreflection.hlsl">
<FileType>Document</FileType>
</FxCompile>
<FxCompile Update="C:\PROJECTS\WickedEngine\WickedEngine\objectPS_transparent_pom.hlsl">
<FileType>Document</FileType>
</FxCompile>
<FxCompile Update="C:\PROJECTS\WickedEngine\WickedEngine\objectPS_water.hlsl">
<FileType>Document</FileType>
</FxCompile>
<FxCompile Update="C:\PROJECTS\WickedEngine\WickedEngine\rtaoLIB.hlsl">
<FileType>Document</FileType>
</FxCompile>
<FxCompile Update="C:\PROJECTS\WickedEngine\WickedEngine\rtao_denoise_blurCS.hlsl">
<FileType>Document</FileType>
</FxCompile>
<FxCompile Update="C:\PROJECTS\WickedEngine\WickedEngine\rtao_denoise_temporalCS.hlsl">
<FileType>Document</FileType>
</FxCompile>
<FxCompile Update="C:\PROJECTS\WickedEngine\WickedEngine\shadingRateClassificationCS.hlsl">
<FileType>Document</FileType>
</FxCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\ImageContentTask.targets" />
Expand Down
47 changes: 0 additions & 47 deletions Template_UWP/Template_UWP.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -474,53 +474,6 @@
<ItemGroup>
<Font Include="..\WickedEngine\fonts\arial.ttf" />
</ItemGroup>
<ItemGroup>
<FxCompile Update="C:\PROJECTS\WickedEngine\WickedEngine\hairparticlePS.hlsl">
<FileType>Document</FileType>
</FxCompile>
<FxCompile Update="C:\PROJECTS\WickedEngine\WickedEngine\hairparticlePS_transparent.hlsl">
<FileType>Document</FileType>
</FxCompile>
<FxCompile Update="C:\PROJECTS\WickedEngine\WickedEngine\impostorPS.hlsl">
<FileType>Document</FileType>
</FxCompile>
<FxCompile Update="C:\PROJECTS\WickedEngine\WickedEngine\objectPS.hlsl">
<FileType>Document</FileType>
</FxCompile>
<FxCompile Update="C:\PROJECTS\WickedEngine\WickedEngine\objectPS_planarreflection.hlsl">
<FileType>Document</FileType>
</FxCompile>
<FxCompile Update="C:\PROJECTS\WickedEngine\WickedEngine\objectPS_pom.hlsl">
<FileType>Document</FileType>
</FxCompile>
<FxCompile Update="C:\PROJECTS\WickedEngine\WickedEngine\objectPS_terrain.hlsl">
<FileType>Document</FileType>
</FxCompile>
<FxCompile Update="C:\PROJECTS\WickedEngine\WickedEngine\objectPS_transparent.hlsl">
<FileType>Document</FileType>
</FxCompile>
<FxCompile Update="C:\PROJECTS\WickedEngine\WickedEngine\objectPS_transparent_planarreflection.hlsl">
<FileType>Document</FileType>
</FxCompile>
<FxCompile Update="C:\PROJECTS\WickedEngine\WickedEngine\objectPS_transparent_pom.hlsl">
<FileType>Document</FileType>
</FxCompile>
<FxCompile Update="C:\PROJECTS\WickedEngine\WickedEngine\objectPS_water.hlsl">
<FileType>Document</FileType>
</FxCompile>
<FxCompile Update="C:\PROJECTS\WickedEngine\WickedEngine\rtaoLIB.hlsl">
<FileType>Document</FileType>
</FxCompile>
<FxCompile Update="C:\PROJECTS\WickedEngine\WickedEngine\rtao_denoise_blurCS.hlsl">
<FileType>Document</FileType>
</FxCompile>
<FxCompile Update="C:\PROJECTS\WickedEngine\WickedEngine\rtao_denoise_temporalCS.hlsl">
<FileType>Document</FileType>
</FxCompile>
<FxCompile Update="C:\PROJECTS\WickedEngine\WickedEngine\shadingRateClassificationCS.hlsl">
<FileType>Document</FileType>
</FxCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\ImageContentTask.targets" />
Expand Down
10 changes: 6 additions & 4 deletions WickedEngine/objectHF.hlsli
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,8 @@ GBUFFEROutputType main(PIXELINPUT input)
float4 blend_weights = input.color;
blend_weights /= blend_weights.x + blend_weights.y + blend_weights.z + blend_weights.w;
float4 sam;
float3 baseN = normalize(input.nor);
surface.N = 0;

[branch]
if (blend_weights.x > 0)
Expand Down Expand Up @@ -867,7 +869,7 @@ GBUFFEROutputType main(PIXELINPUT input)
float2 uv = g_xMaterial.uvset_normalMap == 0 ? input.uvsets.xy : input.uvsets.zw;
sam.rgb = texture_normalmap.Sample(sampler_objectshader, uv);
sam.rgb = sam.rgb * 2 - 1;
surface.N += lerp(surface.N, mul(sam.rgb, TBN), g_xMaterial.normalMapStrength) * blend_weights.x;
surface.N += lerp(baseN, mul(sam.rgb, TBN), g_xMaterial.normalMapStrength) * blend_weights.x;
}

[branch]
Expand Down Expand Up @@ -914,7 +916,7 @@ GBUFFEROutputType main(PIXELINPUT input)
float2 uv = g_xMaterial_blend1.uvset_normalMap == 0 ? input.uvsets.xy : input.uvsets.zw;
sam.rgb = texture_blend1_normalmap.Sample(sampler_objectshader, uv);
sam.rgb = sam.rgb * 2 - 1;
surface.N += lerp(surface.N, mul(sam.rgb, TBN), g_xMaterial_blend1.normalMapStrength) * blend_weights.y;
surface.N += lerp(baseN, mul(sam.rgb, TBN), g_xMaterial_blend1.normalMapStrength) * blend_weights.y;
}

[branch]
Expand Down Expand Up @@ -961,7 +963,7 @@ GBUFFEROutputType main(PIXELINPUT input)
float2 uv = g_xMaterial_blend2.uvset_normalMap == 0 ? input.uvsets.xy : input.uvsets.zw;
sam.rgb = texture_blend2_normalmap.Sample(sampler_objectshader, uv);
sam.rgb = sam.rgb * 2 - 1;
surface.N += lerp(surface.N, mul(sam.rgb, TBN), g_xMaterial_blend2.normalMapStrength) * blend_weights.z;
surface.N += lerp(baseN, mul(sam.rgb, TBN), g_xMaterial_blend2.normalMapStrength) * blend_weights.z;
}

[branch]
Expand Down Expand Up @@ -1008,7 +1010,7 @@ GBUFFEROutputType main(PIXELINPUT input)
float2 uv = g_xMaterial_blend3.uvset_normalMap == 0 ? input.uvsets.xy : input.uvsets.zw;
sam.rgb = texture_blend3_normalmap.Sample(sampler_objectshader, uv);
sam.rgb = sam.rgb * 2 - 1;
surface.N += lerp(surface.N, mul(sam.rgb, TBN), g_xMaterial_blend3.normalMapStrength) * blend_weights.w;
surface.N += lerp(baseN, mul(sam.rgb, TBN), g_xMaterial_blend3.normalMapStrength) * blend_weights.w;
}

[branch]
Expand Down
2 changes: 1 addition & 1 deletion WickedEngine/wiVersion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace wiVersion
// minor features, major updates, breaking API changes
const int minor = 49;
// minor bug fixes, alterations, refactors, updates
const int revision = 0;
const int revision = 1;

const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);

Expand Down

0 comments on commit fb71fd6

Please sign in to comment.