diff --git a/cmake/macros/AutoScribeShader.cmake b/cmake/macros/AutoScribeShader.cmake index 63f7c0c7d6..f0f1fe1d05 100755 --- a/cmake/macros/AutoScribeShader.cmake +++ b/cmake/macros/AutoScribeShader.cmake @@ -319,6 +319,7 @@ macro(AUTOSCRIBE_SHADER_LIB) unset(SHADER_FILE) unset(SHADER_FILE CACHE) find_file(SHADER_FILE "${VERTEX_NAME}.slv" PATHS "${PROGRAM_FOLDER}" PATH_SUFFIXES "..") + message("boop ${SHADER_FILE} ${VERTEX_NAME} ${PROGRAM_FOLDER}") AUTOSCRIBE_SHADER(${ALL_SHADER_HEADERS}) string(CONCAT VERTEX_ENUMS "${VERTEX_ENUMS}" "${SHADER_LIST}") else() @@ -337,6 +338,7 @@ macro(AUTOSCRIBE_SHADER_LIB) unset(SHADER_FILE) unset(SHADER_FILE CACHE) find_file(SHADER_FILE "${FRAGMENT_NAME}.slf" PATHS "${PROGRAM_FOLDER}" PATH_SUFFIXES "..") + message("boop2 ${SHADER_FILE} ${FRAGMENT_NAME} ${PROGRAM_FOLDER}") AUTOSCRIBE_SHADER(${ALL_SHADER_HEADERS}) string(CONCAT FRAGMENT_ENUMS "${FRAGMENT_ENUMS}" "${SHADER_LIST}") else() diff --git a/libraries/graphics/src/graphics/skybox.slf b/libraries/graphics/src/graphics/skybox.slf index 0dea1d7882..4ae53a657f 100755 --- a/libraries/graphics/src/graphics/skybox.slf +++ b/libraries/graphics/src/graphics/skybox.slf @@ -12,6 +12,12 @@ <@include graphics/ShaderConstants.h@> <@if HIFI_USE_FORWARD@> + <@include gpu/Transform.slh@> + <$declareStandardCameraTransform()$> + + <@include graphics/Light.slh@> + <$declareLightBuffer()$> + <@include graphics/Haze.slh@> <@endif@> @@ -35,13 +41,28 @@ void main(void) { // mix(skyboxColor, skyboxTexel, skybox.color.a) // and the blend factor should be user controlled - vec3 skyboxTexel = texture(cubeMap, normalize(_normal)).rgb; + vec3 normal = normalize(_normal); + vec3 skyboxTexel = texture(cubeMap, normal).rgb; vec3 skyboxColor = skybox.color.rgb; _fragColor = vec4(mix(vec3(1.0), skyboxTexel, float(skybox.color.a > 0.0)) * mix(vec3(1.0), skyboxColor, float(skybox.color.a < 1.0)), 1.0); <@if HIFI_USE_FORWARD@> - _fragColor = vec4(hazeParams.hazeColor, 1); + // FIXME: either move this elsewhere or give it access to isHazeEnabled() (which is in render-utils/LightingModel.slh) + if (/*(isHazeEnabled() > 0.0) && */(hazeParams.hazeMode & HAZE_MODE_IS_ACTIVE) == HAZE_MODE_IS_ACTIVE) { + TransformCamera cam = getTransformCamera(); + vec4 eyePositionWS = cam._viewInverse[3]; + // We choose an arbitrary large number > BLEND_DISTANCE in Haze.slh + const float SKYBOX_DISTANCE = 32000.0; + vec4 fragPositionWS = eyePositionWS + SKYBOX_DISTANCE * vec4(normal, 0.0); + vec4 fragPositionES = cam._view * fragPositionWS; + + Light light = getKeyLight(); + vec3 lightDirectionWS = getLightDirection(light); + + vec4 hazeColor = computeHazeColor(fragPositionES.xyz, fragPositionWS.xyz, eyePositionWS.xyz, lightDirectionWS); + _fragColor.rgb = mix(_fragColor.rgb, hazeColor.rgb, hazeColor.a); + } <@endif@> } diff --git a/libraries/render-utils/src/Haze.slf b/libraries/render-utils/src/Haze.slf index 951841ad49..899f36b8eb 100644 --- a/libraries/render-utils/src/Haze.slf +++ b/libraries/render-utils/src/Haze.slf @@ -15,9 +15,9 @@ <$declareDeferredFrameTransform()$> <@include graphics/Light.slh@> +<$declareLightBuffer()$> <@include LightingModel.slh@> -<$declareLightBuffer()$> <@include graphics/Haze.slh@>