Improve channel viewing in 2D view

This commit is contained in:
luboslenco
2020-01-10 20:01:56 +01:00
parent 93aa57497b
commit 20ec554ff0
15 changed files with 66 additions and 10 deletions
+16 -1
View File
@@ -1,8 +1,23 @@
#version 330
uniform sampler2D tex;
uniform int channel;
in vec2 texCoord;
in vec4 color;
out vec4 FragColor;
void main() {
FragColor = textureLod(tex, texCoord, 0) * color;
if (channel == 1) {
FragColor = textureLod(tex, texCoord, 0).rrra * color;
}
else if (channel == 2) {
FragColor = textureLod(tex, texCoord, 0).ggga * color;
}
else if (channel == 3) {
FragColor = textureLod(tex, texCoord, 0).bbba * color;
}
else if (channel == 4) {
FragColor = textureLod(tex, texCoord, 0).aaaa * color;
}
else {
FragColor = textureLod(tex, texCoord, 0).rgba * color;
}
}
Binary file not shown.
Binary file not shown.
+7
View File
@@ -0,0 +1,7 @@
..\..\..\bin\hlslbin.exe cursor.vert.hlsl ..\cursor.vert.glsl vs_5_0 -i nor -i pos -i tex
..\..\..\bin\hlslbin.exe cursor.frag.hlsl ..\cursor.frag.glsl ps_5_0
..\..\..\bin\hlslbin.exe layer_view.vert.hlsl ..\layer_view.vert.glsl vs_5_0 -i col -i pos -i tex
..\..\..\bin\hlslbin.exe layer_view.frag.hlsl ..\layer_view.frag.glsl ps_5_0
..\..\..\bin\hlslbin.exe layer_merge.vert.hlsl ..\layer_merge.vert.glsl vs_5_0 -i col -i pos -i tex
..\..\..\bin\hlslbin.exe layer_merge.frag.hlsl ..\layer_merge.frag.glsl ps_5_0
..\..\..\bin\hlslbin.exe mask_merge.frag.hlsl ..\mask_merge.frag.glsl ps_5_0
+16 -1
View File
@@ -1,5 +1,20 @@
Texture2D<float4> tex;
SamplerState _tex_sampler;
uniform int channel;
float4 main(float4 color : TEXCOORD0, float2 texCoord : TEXCOORD1) : SV_Target0 {
return tex.SampleLevel(_tex_sampler, texCoord, 0) * color;
if (channel == 1) {
return tex.SampleLevel(_tex_sampler, texCoord, 0).rrra * color;
}
else if (channel == 2) {
return tex.SampleLevel(_tex_sampler, texCoord, 0).ggga * color;
}
else if (channel == 3) {
return tex.SampleLevel(_tex_sampler, texCoord, 0).bbba * color;
}
else if (channel == 4) {
return tex.SampleLevel(_tex_sampler, texCoord, 0).aaaa * color;
}
else {
return tex.SampleLevel(_tex_sampler, texCoord, 0).rgba * color;
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -77,7 +77,7 @@ void raygeneration() {
float b = 1.0 - a;
color = color * b + accum.xyz * a;
}
render_target[DispatchRaysIndex().xy] = float4(color.xyz, 0.0f);
render_target[DispatchRaysIndex().xy] = float4(color.xyz, 1.0f);
}
[shader("closesthit")]
+1 -1
View File
@@ -79,7 +79,7 @@ void raygeneration() {
float b = 1.0 - a;
color = color * b + accum.xyz * a;
}
render_target[DispatchRaysIndex().xy] = float4(color.xyz, 0.0f);
render_target[DispatchRaysIndex().xy] = float4(color.xyz, 1.0f);
}
[shader("closesthit")]
@@ -81,7 +81,7 @@ void raygeneration() {
float b = 1.0 - a;
color = color * b + accum.xyz * a;
}
render_target[DispatchRaysIndex().xy] = float4(color.xyz, 0.0f);
render_target[DispatchRaysIndex().xy] = float4(color.xyz, 1.0f);
}
[shader("closesthit")]
@@ -78,7 +78,7 @@ void raygeneration() {
float b = 1.0 - a;
color = color * b + accum.xyz * a;
}
render_target[DispatchRaysIndex().xy] = float4(color.xyz, 0.0f);
render_target[DispatchRaysIndex().xy] = float4(color.xyz, 1.0f);
}
[shader("closesthit")]