Skip to content

Commit 6709138

Browse files
committed
Added emission
1 parent fd1230a commit 6709138

16 files changed

Lines changed: 28 additions & 319 deletions

File tree

Engine/Shaders/DecalPipeline/fragment.glsl

Lines changed: 0 additions & 52 deletions
This file was deleted.

Engine/Shaders/DecalPipeline/vertex.glsl

Lines changed: 0 additions & 40 deletions
This file was deleted.

Engine/Shaders/DeferredForwardPipeline/fragment.glsl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ struct StatusData
2424
int DispersionSampleCount;
2525
float metalness;
2626
float roughness;
27-
vec2 padding;
27+
float emission;
28+
float padding;
2829
};
2930

3031
readonly buffer statusData{
@@ -107,7 +108,7 @@ void main()
107108
// also store the per-fragment normals into the gbuffer
108109
gNormal.rgb = normalize(outTBN*normalize(tangentNormal * 2.0 - 1.0));
109110

110-
gAlbedoSpec.rgb = diffuse.rgb;
111+
gAlbedoSpec.rgb = diffuse.rgb*statusData_data[outDrawId].emission;
111112

112113
gAlbedoSpec.a= metallic;
113114
gNormal.a = roughness;

Engine/Shaders/ForwardPipeline/fragment.glsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void main()
4343
metallic = clamp(metallic+statusData_data[outDrawId].metalness,0,1);
4444
roughness = clamp(roughness+statusData_data[outDrawId].roughness,0,1);
4545

46-
vec3 color = pbrCalculation(outFragPos, worldNormal, vec3(diffuse), vec4(1.0), roughness, metallic,1);
46+
vec3 color = pbrCalculation(outFragPos, worldNormal, vec3(diffuse)*statusData_data[outDrawId].emission, vec4(1.0), roughness, metallic,1);
4747

4848
FragColor = vec4(color,1);
4949
}

Engine/Shaders/ForwardPipeline/fragment1.glsl

Lines changed: 0 additions & 52 deletions
This file was deleted.

Engine/Shaders/ForwardPipeline/fragment_transparent.glsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void main()
4949
metallic = metallic+statusData_data[outDrawId].metalness;
5050
roughness = roughness+statusData_data[outDrawId].roughness;
5151

52-
vec3 color = pbrCalculation(outFragPos, worldNormal, vec3(diffuse), vec4(1.0), roughness, metallic,1);
52+
vec3 color = pbrCalculation(outFragPos, worldNormal, vec3(diffuse)*statusData_data[outDrawId].emission, vec4(1.0), roughness, metallic,1);
5353
float weight = clamp(pow(min(1.0, diffuse.a * 10.0) + 0.01, 3.0) * 1e8 * pow(1.0 - gl_FragCoord.z * 0.9, 3.0), 1e-2, 3e3);
5454

5555
reveal = diffuse.a;

Engine/Shaders/ForwardPipeline/vertex1.glsl

Lines changed: 0 additions & 40 deletions
This file was deleted.

Engine/Shaders/PbrHeaderPipeline/pbr_calculation.glsl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ struct StatusData
2626
int DispersionSampleCount;
2727
float metalness;
2828
float roughness;
29-
vec2 padding;
29+
float emission;
30+
float padding;
3031
};
3132

3233
const float PI = 3.14159265359;

Engine/Shaders/RayTracingPipeline/constants.hlsl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ struct StatusData
5353
unsigned int DispersionSampleCount; // 1..16
5454
float metalness;
5555
float roughness;
56-
float2 padding;
56+
float emission;
57+
float padding;
5758
};
5859

5960
#define NUM_LIGHTS 2

Engine/Shaders/RayTracingPipeline/hit.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void main(inout PrimaryRayPayload payload, in BuiltInTriangleIntersectionAttribu
9090
metallic = saturate(metallic + statusData[InstanceID()].metalness);
9191
roughness = saturate(roughness + statusData[InstanceID()].roughness);
9292
// Sample texturing. Ray tracing shaders don't support LOD calculation, so we must specify LOD and apply filtering.
93-
payload.Color = diffuseTexture[NonUniformResourceIndex(InstanceID())].SampleLevel(g_SamLinearWrap, uv, 0).xyz;
93+
payload.Color = diffuseTexture[NonUniformResourceIndex(InstanceID())].SampleLevel(g_SamLinearWrap, uv, 0).xyz * float3(statusData[InstanceID()].emission, statusData[InstanceID()].emission, statusData[InstanceID()].emission);
9494

9595
payload.Depth = RayTCurrent();
9696

0 commit comments

Comments
 (0)