-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hydrogent: improved selection outline; added desaturation of the non-…
…selected area
- Loading branch information
1 parent
b78f2b8
commit 9e18569
Showing
12 changed files
with
155 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#ifndef _HN_POST_PROCESS_STRUCTURES_FXH_ | ||
#define _HN_POST_PROCESS_STRUCTURES_FXH_ | ||
|
||
struct PostProcessAttribs | ||
{ | ||
float4 SelectionOutlineColor; | ||
|
||
float NonselectionDesaturationFactor; | ||
float Padding0; | ||
float Padding1; | ||
float Padding2; | ||
}; | ||
|
||
#endif // _HN_POST_PROCESS_STRUCTURES_FXH_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
"#include \"HnPostProcessStructures.fxh\"\n" | ||
"\n" | ||
"struct PSInput\n" | ||
"{\n" | ||
" float4 Pos : SV_POSITION;\n" | ||
"};\n" | ||
"\n" | ||
"cbuffer cbPostProcessAttribs\n" | ||
"{\n" | ||
" PostProcessAttribs g_Attribs;\n" | ||
"}\n" | ||
"\n" | ||
"Texture2D g_ColorBuffer;\n" | ||
"Texture2D g_MeshId;\n" | ||
"\n" | ||
"void main(in PSInput PSIn,\n" | ||
" out float4 Color : SV_Target0)\n" | ||
"{\n" | ||
" Color = g_ColorBuffer.Load(int3(PSIn.Pos.xy, 0));\n" | ||
"\n" | ||
" float IsSelected0 = g_MeshId.Load(int3(PSIn.Pos.xy + float2(-1.0, -1.0), 0)).r < 0.0 ? -1.0 : +1.0;\n" | ||
" float IsSelected1 = g_MeshId.Load(int3(PSIn.Pos.xy + float2( 0.0, -1.0), 0)).r < 0.0 ? -1.0 : +1.0;\n" | ||
" float IsSelected2 = g_MeshId.Load(int3(PSIn.Pos.xy + float2(+1.0, -1.0), 0)).r < 0.0 ? -1.0 : +1.0;\n" | ||
"\n" | ||
" float IsSelected3 = g_MeshId.Load(int3(PSIn.Pos.xy + float2(-1.0, 0.0), 0)).r < 0.0 ? -1.0 : +1.0;\n" | ||
" float IsSelected4 = g_MeshId.Load(int3(PSIn.Pos.xy + float2( 0.0, 0.0), 0)).r < 0.0 ? -1.0 : +1.0;\n" | ||
" float IsSelected5 = g_MeshId.Load(int3(PSIn.Pos.xy + float2(+1.0, 0.0), 0)).r < 0.0 ? -1.0 : +1.0;\n" | ||
"\n" | ||
" float IsSelected6 = g_MeshId.Load(int3(PSIn.Pos.xy + float2(-1.0, +1.0), 0)).r < 0.0 ? -1.0 : +1.0;\n" | ||
" float IsSelected7 = g_MeshId.Load(int3(PSIn.Pos.xy + float2( 0.0, +1.0), 0)).r < 0.0 ? -1.0 : +1.0;\n" | ||
" float IsSelected8 = g_MeshId.Load(int3(PSIn.Pos.xy + float2(+1.0, +1.0), 0)).r < 0.0 ? -1.0 : +1.0;\n" | ||
"\n" | ||
" float Outline = IsSelected0 + IsSelected1 + IsSelected2 + IsSelected3 + IsSelected4 + IsSelected5 + IsSelected6 + IsSelected7 + IsSelected8;\n" | ||
" //Outline = (9.0 - Outline) * (Outline > 0.0 ? 1.0 / 8.0 : 0.0);\n" | ||
" Outline = (Outline > 0.0 && Outline < 9.0) ? 1.0 : 0.0;\n" | ||
"\n" | ||
" float DesatFactor = g_Attribs.NonselectionDesaturationFactor * saturate(IsSelected4);\n" | ||
" float Luminance = dot(Color.rgb, float3(0.2126, 0.7152, 0.0722));\n" | ||
" Color.rgb = lerp(Color.rgb, float3(Luminance, Luminance, Luminance), DesatFactor);\n" | ||
"\n" | ||
" Color.rgb = lerp(Color.rgb, g_Attribs.SelectionOutlineColor.rgb, Outline);\n" | ||
"\n" | ||
"#if CONVERT_OUTPUT_TO_SRGB\n" | ||
" Color.rgb = pow(Color.rgb, float3(1.0/2.2, 1.0/2.2, 1.0/2.2));\n" | ||
"#endif\n" | ||
"}\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
"struct PSInput\n" | ||
"{\n" | ||
" float4 Pos : SV_POSITION;\n" | ||
"};\n" | ||
"void main(in uint VertID : SV_VertexID,\n" | ||
" out PSInput PSIn)\n" | ||
"{\n" | ||
" float2 ClipXY[3];\n" | ||
" ClipXY[0] = float2(-1.0, -1.0);\n" | ||
" ClipXY[1] = float2(-1.0, 3.0);\n" | ||
" ClipXY[2] = float2( 3.0, -1.0);\n" | ||
"\n" | ||
" PSIn.Pos = float4(ClipXY[VertID], 0.0, 1.0);\n" | ||
"}\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
"#ifndef _HN_POST_PROCESS_STRUCTURES_FXH_\n" | ||
"#define _HN_POST_PROCESS_STRUCTURES_FXH_\n" | ||
"\n" | ||
"struct PostProcessAttribs\n" | ||
"{\n" | ||
" float4 SelectionOutlineColor;\n" | ||
"\n" | ||
" float NonselectionDesaturationFactor;\n" | ||
" float Padding0;\n" | ||
" float Padding1;\n" | ||
" float Padding2;\n" | ||
"};\n" | ||
"\n" | ||
"#endif // _HN_POST_PROCESS_STRUCTURES_FXH_\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
static const MemoryShaderSourceFileInfo g_Shaders[] = | ||
{ | ||
{ | ||
"PostProcess.psh", | ||
#include "PostProcess.psh.h" | ||
"HnPostProcess.psh", | ||
#include "HnPostProcess.psh.h" | ||
}, | ||
{ | ||
"PostProcess.vsh", | ||
#include "PostProcess.vsh.h" | ||
"HnPostProcess.vsh", | ||
#include "HnPostProcess.vsh.h" | ||
}, | ||
{ | ||
"HnPostProcessStructures.fxh", | ||
#include "HnPostProcessStructures.fxh.h" | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters