|
24 | 24 | #include "./brdf.glsl" |
25 | 25 |
|
26 | 26 | uniform float maxProbeDrawDistance; |
| 27 | +uniform int isCapturing; |
27 | 28 |
|
28 | 29 | #ifndef TORQUE_SHADERGEN |
29 | 30 | #line 27 |
@@ -54,10 +55,6 @@ uniform vec4 albedo; |
54 | 55 |
|
55 | 56 | #define MAX_FORWARD_LIGHT 4 |
56 | 57 |
|
57 | | -#ifndef CAPTURING |
58 | | -#define CAPTURING 0 |
59 | | -#endif |
60 | | - |
61 | 58 | #ifndef DEBUGVIZ_ATTENUATION |
62 | 59 | #define DEBUGVIZ_ATTENUATION 0 |
63 | 60 | #endif |
@@ -237,44 +234,39 @@ vec3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight) |
237 | 234 | float D = D_GGX(surfaceToLight.NdotH, surface.linearRoughnessSq); |
238 | 235 | vec3 Fr = D * F * Vis; |
239 | 236 |
|
240 | | -#if CAPTURING == 1 |
241 | | - return mix(Fd + Fr, surface.baseColor.rgb, surface.metalness); |
242 | | -#else |
243 | | - return Fd + Fr; |
244 | | -#endif |
245 | | - |
| 237 | + if(isCapturing == 1) |
| 238 | + return mix(Fd + Fr, surface.baseColor.rgb, surface.metalness); |
| 239 | + else |
| 240 | + return Fd + Fr; |
246 | 241 | } |
247 | 242 |
|
248 | 243 | vec3 getDirectionalLight(Surface surface, SurfaceToLight surfaceToLight, vec3 lightColor, float lightIntensity, float shadow) |
249 | 244 | { |
250 | | -#if CAPTURING == 1 |
251 | 245 | float lightfloor = CAPTURE_LIGHT_FLOOR; |
252 | | -#else |
253 | | - float lightfloor = 0.0; |
254 | | -#endif |
| 246 | + if(isCapturing != 1) |
| 247 | + lightfloor = 0.0; |
| 248 | + |
255 | 249 | vec3 factor = lightColor * max(surfaceToLight.NdotL * shadow * lightIntensity, lightfloor); |
256 | 250 | return evaluateStandardBRDF(surface,surfaceToLight) * factor; |
257 | 251 | } |
258 | 252 |
|
259 | 253 | vec3 getPunctualLight(Surface surface, SurfaceToLight surfaceToLight, vec3 lightColor, float lightIntensity, float radius, float shadow) |
260 | 254 | { |
261 | | -#if CAPTURING == 1 |
262 | 255 | float lightfloor = CAPTURE_LIGHT_FLOOR; |
263 | | -#else |
264 | | - float lightfloor = 0.0; |
265 | | -#endif |
| 256 | + if(isCapturing != 1) |
| 257 | + lightfloor = 0.0; |
| 258 | + |
266 | 259 | float attenuation = getDistanceAtt(surfaceToLight.Lu, radius); |
267 | 260 | vec3 factor = lightColor * max(surfaceToLight.NdotL * shadow * lightIntensity * attenuation, lightfloor); |
268 | 261 | return evaluateStandardBRDF(surface,surfaceToLight) * factor; |
269 | 262 | } |
270 | 263 |
|
271 | 264 | vec3 getSpotlight(Surface surface, SurfaceToLight surfaceToLight, vec3 lightColor, float lightIntensity, float radius, vec3 lightDir, vec2 lightSpotParams, float shadow) |
272 | 265 | { |
273 | | -#if CAPTURING == 1 |
274 | 266 | float lightfloor = CAPTURE_LIGHT_FLOOR; |
275 | | -#else |
276 | | - float lightfloor = 0.0; |
277 | | -#endif |
| 267 | + if(isCapturing != 1) |
| 268 | + lightfloor = 0.0; |
| 269 | + |
278 | 270 | float attenuation = 1.0f; |
279 | 271 | attenuation *= getDistanceAtt(surfaceToLight.Lu, radius); |
280 | 272 | attenuation *= getSpotAngleAtt(-surfaceToLight.L, lightDir, lightSpotParams.xy); |
@@ -567,11 +559,11 @@ vec4 computeForwardProbes(Surface surface, |
567 | 559 | float horizonOcclusion = 1.3; |
568 | 560 | float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N)); |
569 | 561 | horizon *= horizon; |
570 | | -#if CAPTURING == 1 |
571 | | - return vec4(mix((irradiance + specular* horizon),surface.baseColor.rgb,surface.metalness),0); |
572 | | -#else |
573 | | - return vec4((irradiance + specular* horizon) , 0);//alpha writes disabled |
574 | | -#endif |
| 562 | + |
| 563 | + if(isCapturing == 1) |
| 564 | + return vec4(mix((irradiance + specular* horizon),surface.baseColor.rgb,surface.metalness),0); |
| 565 | + else |
| 566 | + return vec4((irradiance + specular* horizon) , 0);//alpha writes disabled |
575 | 567 | } |
576 | 568 |
|
577 | 569 | vec4 debugVizForwardProbes(Surface surface, |
|
0 commit comments