diff --git a/CMakeLists.txt b/CMakeLists.txt index 89f6b2d..c89a8a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,10 @@ project(dirtchamber) -cmake_minimum_required(VERSION 2.8 FATAL_ERROR) +cmake_minimum_required(VERSION 3.1 FATAL_ERROR) set(CMAKE_MODULE_PATH - ${CMAKE_SOURCE_DIR}/cmake - ${CMAKE_MODULE_PATH}) + ${CMAKE_SOURCE_DIR}/cmake + ${CMAKE_MODULE_PATH}) find_package(Boost REQUIRED) find_package(Assimp REQUIRED) @@ -17,22 +17,22 @@ find_package(WMF) # configure set(D3D_LIBS - ${D3D_D3D11_LIBRARY} - ${D3D_D3DCompiler_LIBRARY} - ${WINDOWS_SDK_USP10_LIBRARY} - ${DXUT_LIBRARIES}) + ${D3D_D3D11_LIBRARY} + ${D3D_D3DCompiler_LIBRARY} + ${WINDOWS_SDK_USP10_LIBRARY} + ${DXUT_LIBRARIES}) include_directories( - ${Boost_INCLUDE_DIR} - ${D3D_INCLUDE_DIR} + ${Boost_INCLUDE_DIR} + ${D3D_INCLUDE_DIR} ${WINDOWS_SDK_INCLUDE_DIR} - ${DXUT_INCLUDE_DIRS} - ${Assimp_INCLUDE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/src) - + ${DXUT_INCLUDE_DIRS} + ${Assimp_INCLUDE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/src) + if(KINECTSDK_FOUND) - add_definitions(-D MICROSOFT_KINECT_SDK) - include_directories(${KinectSDK_INCLUDE_DIR}) + add_definitions(-D MICROSOFT_KINECT_SDK) + include_directories(${KinectSDK_INCLUDE_DIR}) endif() if (OPENCV_FOUND) @@ -54,81 +54,88 @@ option(BUILD_WITH_WMF "Build with Windows Media Foundation support" ON) set(dune_dir ${CMAKE_CURRENT_SOURCE_DIR}/src/dune) if (NOT BUILD_WITH_WMF) - list(REMOVE_ITEM dune_src - ${dune_dir}/video_gbuffer.h - ${dune_dir}/video_gbuffer.cpp) + list(REMOVE_ITEM dune_src + ${dune_dir}/video_gbuffer.h + ${dune_dir}/video_gbuffer.cpp) endif() if (NOT KINECTSDK_FOUND) - list(REMOVE_ITEM dune_src - ${dune_dir}/kinect_gbuffer.cpp - ${dune_dir}/kinect_gbuffer.h) + list(REMOVE_ITEM dune_src + ${dune_dir}/kinect_gbuffer.cpp + ${dune_dir}/kinect_gbuffer.h) endif() if (NOT OPENCV_FOUND) - list(REMOVE_ITEM dune_src - ${dune_dir}/tracker.cpp - ${dune_dir}/tracker.h) + list(REMOVE_ITEM dune_src + ${dune_dir}/tracker.cpp + ${dune_dir}/tracker.h) endif() list(REMOVE_ITEM dune_src - ${dune_dir}/sdk_mesh.cpp - ${dune_dir}/sdk_mesh.h) + ${dune_dir}/sdk_mesh.cpp + ${dune_dir}/sdk_mesh.h) add_library(dune ${dune_src}) -# shader +# shaders file(GLOB hlsl_src shader/*.hlsl shader/common.h) source_group("Shader Files" FILES ${hlsl_src}) +set_source_files_properties(${hlsl_src} HEADER_FILE_ONLY TRUE EXTERNAL_OBJECT TRUE) + +set(cso_dir ${CMAKE_BINARY_DIR}/cso) +file(MAKE_DIRECTORY ${cso_dir}) + +add_custom_target(cso + COMMAND ${CMAKE_SOURCE_DIR}/shader/compile.bat ${cso_dir} + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/shader + DEPENDS ${cso_dir}) + +add_custom_target(shaders + COMMAND ${CMAKE_SOURCE_DIR}/shader/compile.bat ${cso_dir} + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/shader + SOURCES ${hlsl_src}) # common files set(common_src src/pppipe.cpp src/pppipe.h src/common_gui.cpp src/common_gui.h src/common_renderer.cpp src/common_renderer.h src/common_dxut.cpp src/common_dxut.h) # lpv -add_executable(lpv WIN32 src/main_gi.cpp src/skydome.h ${common_src} ${hlsl_src}) +add_executable(lpv WIN32 src/main_gi.cpp src/skydome.h ${common_src}) set_target_properties (lpv PROPERTIES COMPILE_DEFINITIONS "LPV") target_link_libraries(lpv dune - ${D3D_LIBS} - ${Assimp_LIBRARY} - comctl32.lib) - -if(BUILD_WITH_WMF) - target_link_libraries(lpv ${WMF_LIBRARIES}) -endif() - + ${D3D_LIBS} + ${Assimp_LIBRARY} + comctl32.lib) # vct -add_executable(vct WIN32 src/main_gi.cpp src/skydome.h ${common_src} ${hlsl_src}) +add_executable(vct WIN32 src/main_gi.cpp src/skydome.h ${common_src}) target_link_libraries(vct dune - ${D3D_LIBS} - ${Assimp_LIBRARY} - comctl32.lib) - - + ${D3D_LIBS} + ${Assimp_LIBRARY} + comctl32.lib) if(OPENCV_FOUND) # dlpv kinect - add_executable(delta_lpv WIN32 src/main_gi_mr.cpp ${common_src} ${hlsl_src}) - set_target_properties (delta_lpv PROPERTIES COMPILE_DEFINITIONS "DLPV") - target_link_libraries(delta_lpv - dune - ${D3D_LIBS} - ${Assimp_LIBRARY} - ${OpenCV_LIBRARIES} - comctl32.lib) + add_executable(delta_lpv WIN32 src/main_gi_mr.cpp ${common_src}) + set_target_properties (delta_lpv PROPERTIES COMPILE_DEFINITIONS "DLPV") + target_link_libraries(delta_lpv + dune + ${D3D_LIBS} + ${Assimp_LIBRARY} + ${OpenCV_LIBRARIES} + comctl32.lib) # dvct kinect - add_executable(delta_vct WIN32 src/main_gi_mr.cpp ${common_src} ${hlsl_src}) - target_link_libraries(delta_vct - dune - ${D3D_LIBS} - ${Assimp_LIBRARY} - ${OpenCV_LIBRARIES} - comctl32.lib) - + add_executable(delta_vct WIN32 src/main_gi_mr.cpp ${common_src}) + target_link_libraries(delta_vct + dune + ${D3D_LIBS} + ${Assimp_LIBRARY} + ${OpenCV_LIBRARIES} + comctl32.lib) + if(BUILD_WITH_WMF) target_link_libraries(delta_vct ${WMF_LIBRARIES}) target_link_libraries(delta_lpv ${WMF_LIBRARIES}) @@ -139,4 +146,35 @@ if(OPENCV_FOUND) target_link_libraries(delta_lpv ${KinectSDK_LIBRARY}) endif() -endif() \ No newline at end of file +endif() + +# documentation +add_custom_target(doc + COMMAND doxygen + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/doc) + +# install +install(TARGETS lpv vct + DESTINATION bin/release) + +install(CODE "execute_process(COMMAND \"${CMAKE_COMMAND}\" --build \"${CMAKE_BINARY_DIR}\" --target cso)") +install(DIRECTORY ${cso_dir} + DESTINATION shader) + +install(FILES ${Assimp_BINARY_RELEASE} + DESTINATION bin/release) + +install(DIRECTORY data + DESTINATION . + PATTERN "log.txt" EXCLUDE) + +install(DIRECTORY UI + DESTINATION .) + +if(OPENCV_FOUND) + install(TARGETS delta_lpv delta_vct + DESTINATION bin/release) +endif() + +# create package +include(cmake/cpack/Package.cmake) \ No newline at end of file diff --git a/cmake/FindAssimp.cmake b/cmake/FindAssimp.cmake index 022bd92..512176a 100644 --- a/cmake/FindAssimp.cmake +++ b/cmake/FindAssimp.cmake @@ -1,32 +1,29 @@ -# - Find KinectSDK -# Find the Microsoft Kinect SDK -# -# This module defines the following variables: -# KINECTSDK_FOUND -# KINECTSDK_INCLUDE_DIR -# KINECTSDK_LIBRARY -# +# Find the Open Asset Import Library include(FindPackageHandleStandardArgs) find_path(Assimp_INCLUDE_DIR - NAMES assimp.h) + NAMES assimp.h) +find_file(Assimp_BINARY_RELEASE + NAMES assimp.dll + PATHS ${Assimp_INCLUDE_DIR}/../bin) + find_library(Assimp_LIBRARY_RELEASE - NAMES assimp - PATHS ${Assimp_INCLUDE_DIR}/../lib) - + NAMES assimp + PATHS ${Assimp_INCLUDE_DIR}/../lib) + find_library(Assimp_LIBRARY_DEBUG - NAMES assimpD - PATHS ${Assimp_INCLUDE_DIR}/../lib) - + NAMES assimpD + PATHS ${Assimp_INCLUDE_DIR}/../lib) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(Assimp - DEFAULT_MSG - Assimp_INCLUDE_DIR - Assimp_LIBRARY_RELEASE - Assimp_LIBRARY_DEBUG) - + DEFAULT_MSG + Assimp_INCLUDE_DIR + Assimp_LIBRARY_RELEASE + Assimp_LIBRARY_DEBUG) + if(ASSIMP_FOUND) - set(Assimp_LIBRARY optimized ${Assimp_LIBRARY_RELEASE} debug ${Assimp_LIBRARY_DEBUG} CACHE STRING "") - mark_as_advanced(Assimp_LIBRARY_RELEASE Assimp_LIBRARY_DEBUG) + set(Assimp_LIBRARY optimized ${Assimp_LIBRARY_RELEASE} debug ${Assimp_LIBRARY_DEBUG} CACHE STRING "") + mark_as_advanced(Assimp_LIBRARY_RELEASE Assimp_LIBRARY_DEBUG Assimp_BINARY_RELEASE) endif() \ No newline at end of file diff --git a/cmake/FindDXUT.cmake b/cmake/FindDXUT.cmake index d4a440f..00749e6 100644 --- a/cmake/FindDXUT.cmake +++ b/cmake/FindDXUT.cmake @@ -3,45 +3,45 @@ include(FindPackageHandleStandardArgs) if (CMAKE_CL_64) - set(DXUTARCH "x64") + set(DXUTARCH "x64") else() - set(DXUTARCH "Win32") + set(DXUTARCH "Win32") endif() find_path(DXUT_SDK_PATH - NAMES Core/DXUT.h) - + NAMES Core/DXUT.h) + find_library(DXUT_LIBRARY_RELEASE - NAMES DXUT - PATHS ${DXUT_SDK_PATH}/Core/Bin/*/${DXUTARCH}/Release) + NAMES DXUT + PATHS ${DXUT_SDK_PATH}/Core/Bin/*/${DXUTARCH}/Release) find_library(DXUT_LIBRARY_DEBUG - NAMES DXUT - PATHS ${DXUT_SDK_PATH}/Core/Bin/*/${DXUTARCH}/Debug) - + NAMES DXUT + PATHS ${DXUT_SDK_PATH}/Core/Bin/*/${DXUTARCH}/Debug) + find_library(DXUT_Opt_LIBRARY_RELEASE - NAMES DXUTOpt - PATHS ${DXUT_SDK_PATH}/Optional/Bin/*/${DXUTARCH}/Release) + NAMES DXUTOpt + PATHS ${DXUT_SDK_PATH}/Optional/Bin/*/${DXUTARCH}/Release) find_library(DXUT_Opt_LIBRARY_DEBUG - NAMES DXUTOpt - PATHS ${DXUT_SDK_PATH}/Optional/Bin/*/${DXUTARCH}/Debug) - + NAMES DXUTOpt + PATHS ${DXUT_SDK_PATH}/Optional/Bin/*/${DXUTARCH}/Debug) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(DXUT - DEFAULT_MSG - DXUT_LIBRARY_RELEASE - DXUT_Opt_LIBRARY_RELEASE - DXUT_SDK_PATH) - + DEFAULT_MSG + DXUT_LIBRARY_RELEASE + DXUT_Opt_LIBRARY_RELEASE + DXUT_SDK_PATH) + if(DXUT_FOUND) - mark_as_advanced(DXUT_SDK_PATH DXUT_LIBRARY_RELEAE DXUT_LIBRARY_DEBUG DXUT_Opt_LIBRARY_RELEASE DXUT_Opt_LIBRARY_DEBUG) - set(DXUT_INCLUDE_DIRS - ${DXUT_SDK_PATH}/Core - ${DXUT_SDK_PATH}/Optional - CACHE STRING "") - - set(DXUT_LIBRARIES - optimized ${DXUT_LIBRARY_RELEASE} optimized ${DXUT_Opt_LIBRARY_RELEASE} - debug ${DXUT_LIBRARY_DEBUG} debug ${DXUT_Opt_LIBRARY_DEBUG} - CACHE STRING "") + mark_as_advanced(DXUT_SDK_PATH DXUT_LIBRARY_RELEAE DXUT_LIBRARY_DEBUG DXUT_Opt_LIBRARY_RELEASE DXUT_Opt_LIBRARY_DEBUG) + set(DXUT_INCLUDE_DIRS + ${DXUT_SDK_PATH}/Core + ${DXUT_SDK_PATH}/Optional + CACHE STRING "") + + set(DXUT_LIBRARIES + optimized ${DXUT_LIBRARY_RELEASE} optimized ${DXUT_Opt_LIBRARY_RELEASE} + debug ${DXUT_LIBRARY_DEBUG} debug ${DXUT_Opt_LIBRARY_DEBUG} + CACHE STRING "") endif() \ No newline at end of file diff --git a/cmake/FindKinectSDK.cmake b/cmake/FindKinectSDK.cmake index 0adb0a8..784382e 100644 --- a/cmake/FindKinectSDK.cmake +++ b/cmake/FindKinectSDK.cmake @@ -1,31 +1,24 @@ -# - Find KinectSDK # Find the Microsoft Kinect SDK -# -# This module defines the following variables: -# KINECTSDK_FOUND -# KINECTSDK_INCLUDE_DIR -# KINECTSDK_LIBRARY -# include(FindPackageHandleStandardArgs) if (CMAKE_CL_64) - set(LIBPATH "amd64;lib/amd64") + set(LIBPATH "amd64;lib/amd64") else() - set(LIBPATH "x86;lib/x86") + set(LIBPATH "x86;lib/x86") endif() find_library(KinectSDK_LIBRARY NAMES Kinect10 PATHS $ENV{KINECTSDK10_DIR}/lib - PATH_SUFFIXES ${LIBPATH}) + PATH_SUFFIXES ${LIBPATH}) find_path(KinectSDK_INCLUDE_DIR NAMES NuiApi.h PATHS $ENV{KINECTSDK10_DIR}/inc - PATH_SUFFIXES inc) - + PATH_SUFFIXES inc) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(KinectSDK - DEFAULT_MSG - KinectSDK_LIBRARY - KinectSDK_INCLUDE_DIR) + DEFAULT_MSG + KinectSDK_LIBRARY + KinectSDK_INCLUDE_DIR) diff --git a/cmake/FindOpenCV.cmake b/cmake/FindOpenCV.cmake index e1bdd7c..95adbb0 100644 --- a/cmake/FindOpenCV.cmake +++ b/cmake/FindOpenCV.cmake @@ -1,11 +1,4 @@ -# - Find OpenCV # Find OpenCV -# -# This module defines the following variables: -# OPENCV_FOUND -# OPENCV_INCLUDE_DIR -# OPENCV_LIBRARIES -# include(FindPackageHandleStandardArgs) @@ -43,7 +36,7 @@ if(OpenCV_DIR) set(OpenCV_${slib}_LIBRARY optimized ${OpenCV_${slib}_LIBRARY_RELEASE} #debug ${OpenCV_${slib}_LIBRARY_DEBUG} # don't add debug - CACHE FILE "OpenCV ${slib} component") + CACHE FILE "OpenCV ${slib} component") mark_as_advanced(OpenCV_${slib}_LIBRARY) diff --git a/cmake/FindWMF.cmake b/cmake/FindWMF.cmake index d76f438..a2a74f8 100644 --- a/cmake/FindWMF.cmake +++ b/cmake/FindWMF.cmake @@ -1,10 +1,3 @@ -# - Find KinectSDK -# Find the Microsoft Kinect SDK -# -# This module defines the following variables: -# KINECTSDK_FOUND -# KINECTSDK_INCLUDE_DIR -# KINECTSDK_LIBRARY -# +# Find WMF set(WMF_LIBRARIES "mf.lib;mfplat.lib;mfuuid.lib;Mfreadwrite.lib;shlwapi.lib" CACHE STRING "") diff --git a/cmake/cpack/Package.cmake b/cmake/cpack/Package.cmake new file mode 100644 index 0000000..e411dff --- /dev/null +++ b/cmake/cpack/Package.cmake @@ -0,0 +1,37 @@ +set(DIRTCHAMBER_BINARY_DIR "bin/release") + +# install redist package +set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION ${DIRTCHAMBER_BINARY_DIR}) +include(InstallRequiredSystemLibraries) + +# common config +set(CPACK_PACKAGE_NAME "Dirtchamber") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Dirtchamber") +set(CPACK_PACKAGE_VENDOR "Tobias Alexander Franke") +set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/Readme.md") +set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/Readme.md") +set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_SOURCE_DIR}/Readme.md") +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/cmake/cpack/license.txt") +set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/doc/logo.png") +set(CPACK_PACKAGE_VERSION_MAJOR "1") +set(CPACK_PACKAGE_VERSION_MINOR "0") +set(CPACK_PACKAGE_VERSION_PATCH "0") +set(CPACK_PACKAGE_INSTALL_DIRECTORY "Dirtchamber") + +set(CPACK_PACKAGE_EXECUTABLES vct "Voxel Cone Tracer" + lpv "Light Propagation Volume Renderer") + +if(OPENCV_FOUND) + set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} + delta_vct "DVCT Viewer" + delta_lpv "DLPV Viewer") +endif() + +# WiX +set(CPACK_WIX_UPGRADE_GUID "00B776BF-6115-489E-85CD-49AF8559A7F8") +set(CPACK_WIX_UI_BANNER "${CMAKE_SOURCE_DIR}/cmake/cpack/banner.png") +set(CPACK_WIX_UI_DIALOG "${CMAKE_SOURCE_DIR}/cmake/cpack/dialog.png") +set(CPACK_WIX_PROPERTY_ARPURLINFOABOUT "http://www.tobias-franke.eu/projects/dirtchamber") +set(CPACK_WIX_PROPERTY_ARPHELPLINK "http://tobias-franke.eu/projects/dirtchamber/doc") + +include(CPack) \ No newline at end of file diff --git a/cmake/cpack/banner.png b/cmake/cpack/banner.png new file mode 100644 index 0000000..3cf97c9 Binary files /dev/null and b/cmake/cpack/banner.png differ diff --git a/cmake/cpack/dialog.png b/cmake/cpack/dialog.png new file mode 100644 index 0000000..83eacbb Binary files /dev/null and b/cmake/cpack/dialog.png differ diff --git a/cmake/cpack/license.txt b/cmake/cpack/license.txt new file mode 100644 index 0000000..0f5f478 --- /dev/null +++ b/cmake/cpack/license.txt @@ -0,0 +1,10 @@ +The Dirtchamber + +Copyright (c) 2014 Tobias Alexander Franke +http://www.tobias-franke.eu + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/shader/brdf.hlsl b/shader/brdf.hlsl index ea157b5..e2e3601 100644 --- a/shader/brdf.hlsl +++ b/shader/brdf.hlsl @@ -3,7 +3,9 @@ * For copyright and license see LICENSE * http://www.tobias-franke.eu */ - + +#include "common.h" + #ifndef BRDF_HLSL #define BRDF_HLSL diff --git a/shader/compile.bat b/shader/compile.bat index 3e4fc25..b48b1f6 100644 --- a/shader/compile.bat +++ b/shader/compile.bat @@ -3,9 +3,11 @@ if "%PROCESSOR_ARCHITECTURE%"=="x86" set FXC="%ProgramFiles%\Windows Kits\8.1\bin\x86\fxc.exe" if "%PROCESSOR_ARCHITECTURE%"=="AMD64" set FXC="%ProgramFiles(x86)%\Windows Kits\8.1\bin\x64\fxc.exe" -set OUTDIR="cso" +set OUTDIR=%1 -md cso +if "%OUTDIR%"=="" set OUTDIR="cso" + +md %OUTDIR% %FXC% /O3 /T ps_5_0 /E ps_lpv /Fo %OUTDIR%/ps_lpv.cso deferred_lpv.hlsl %FXC% /O3 /T ps_5_0 /E ps_vct /Fo %OUTDIR%/ps_vct.cso deferred_vct.hlsl diff --git a/shader/deferred_vct.hlsl b/shader/deferred_vct.hlsl index 861eb9a..24da6bb 100644 --- a/shader/deferred_vct.hlsl +++ b/shader/deferred_vct.hlsl @@ -19,8 +19,8 @@ cbuffer gi_parameters_ps : register(b3) float3 gi_from_vct(in float2 tc, in float3 P, in float3 N, in float3 V, in float3 diffuse, in float3 specular, in float roughness) { roughness += glossiness / 10.f; - return diffuse_from_vct(tc, P, N, V) * diffuse + - specular_from_vct(P, N, V, roughness) * specular; + return diffuse_from_vct(tc, P, N, V).rgb * diffuse + + specular_from_vct(P, N, V, roughness).rgb * specular; } float4 ps_vct(in PS_INPUT inp) : SV_Target diff --git a/shader/pp_crt.hlsl b/shader/pp_crt.hlsl index dbc8841..e649cc8 100644 --- a/shader/pp_crt.hlsl +++ b/shader/pp_crt.hlsl @@ -18,10 +18,10 @@ float4 scanline(in float2 coord, in float4 screen) float4 texture_chromatic_distort(in float2 coord) { float4 frag; - frag.r = frontbuffer.Sample(StandardFilter, float2(coord.x - 0.003 * sin(time), coord.y)).r; - frag.g = frontbuffer.Sample(StandardFilter, float2(coord.x, coord.y)).g; - frag.b = frontbuffer.Sample(StandardFilter, float2(coord.x + 0.003 * sin(time), coord.y)).b; - frag.a = frontbuffer.Sample(StandardFilter, float2(coord.x, coord.y)).a; + frag.r = frontbuffer.SampleLevel(StandardFilter, float2(coord.x - 0.003 * sin(time), coord.y), 0.0).r; + frag.g = frontbuffer.SampleLevel(StandardFilter, float2(coord.x, coord.y), 0.0).g; + frag.b = frontbuffer.SampleLevel(StandardFilter, float2(coord.x + 0.003 * sin(time), coord.y), 0.0).b; + frag.a = frontbuffer.SampleLevel(StandardFilter, float2(coord.x, coord.y), 0.0).a; return frag; } @@ -48,8 +48,8 @@ float vignette(in float2 uv) float noise(in float2 uv) { - float a = noise_tex.Sample(StandardFilter, float3(uv + time*6.0, 0.0)).r; - float b = noise_tex.Sample(StandardFilter, float3(uv + time*4.0, 0.5)).r; + float a = noise_tex.SampleLevel(StandardFilter, float3(uv + time*6.0, 0.0), 0.0).r; + float b = noise_tex.SampleLevel(StandardFilter, float3(uv + time*4.0, 0.5), 0.0).r; return clamp(a + b, 0.94, 1.0); }