Skip to content

Commit

Permalink
Updated readme and asset paths.
Browse files Browse the repository at this point in the history
  • Loading branch information
diharaw committed Dec 31, 2021
1 parent f90d5ed commit 70cc8f8
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 13 deletions.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,21 @@
# Volumetric Lighting
An OpenGL sample that demonstrates Volumetric Lighting using a frustum-aligned voxel grid and compute shaders.

## Screenshots
![VolumetricLighting](data/screenshot.jpg)

## Usage

1. Download the latest release [here](https://github.com/diharaw/VolumetricLighting/releases/download/1.0.0/VolumetricLighting_1.0.0.zip).
2. Extract archive contents.
3. Run VolumetricLighting.exe.

### Controls

* `W`/`A`/`S`/`D` - camera movement.
* `RMB` - hold to look around.
* `G` - toggle UI.
* `ESC` - close application.

## Building

### Windows
Expand All @@ -22,6 +34,7 @@ mkdir build
cd build
cmake -G "Visual Studio 16 2019" ..
```
Note: To obtain the assets please download the release and copy the *meshes* and *textures* into the folder containing the built executable.

## Dependencies
* [dwSampleFramework](https://github.com/diharaw/dwSampleFramework)
Expand Down
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ file(GLOB_RECURSE SHADER_SOURCES ${PROJECT_SOURCE_DIR}/src/*.glsl)
if (APPLE)
add_executable(VolumetricLighting MACOSX_BUNDLE ${VOLUMETRIC_LIGHTING_SOURCES} ${SHADER_SOURCES} ${ASSET_SOURCES})
set(MACOSX_BUNDLE_BUNDLE_NAME "VolumetricLighting")
set_source_files_properties(${SHADER_SOURCES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/shader)
set_source_files_properties(${SHADER_SOURCES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/shaders)
set_source_files_properties(${ASSET_SOURCES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
else()
add_executable(VolumetricLighting ${VOLUMETRIC_LIGHTING_SOURCES})
Expand All @@ -24,7 +24,7 @@ endif()
target_link_libraries(VolumetricLighting dwSampleFramework)

if (NOT APPLE)
add_custom_command(TARGET VolumetricLighting POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/src/shader $<TARGET_FILE_DIR:VolumetricLighting>/shader)
add_custom_command(TARGET VolumetricLighting POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/src/shaders $<TARGET_FILE_DIR:VolumetricLighting>/shaders)
endif()

if(CLANG_FORMAT_EXE)
Expand Down
20 changes: 10 additions & 10 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,14 @@ class VolumetricLighting : public dw::Application
bool create_shaders()
{
// Create general shaders
m_mesh_vs = dw::gl::Shader::create_from_file(GL_VERTEX_SHADER, "shader/mesh_vs.glsl");
m_mesh_fs = dw::gl::Shader::create_from_file(GL_FRAGMENT_SHADER, "shader/mesh_fs.glsl");
m_skybox_vs = dw::gl::Shader::create_from_file(GL_VERTEX_SHADER, "shader/skybox_vs.glsl");
m_skybox_fs = dw::gl::Shader::create_from_file(GL_FRAGMENT_SHADER, "shader/skybox_fs.glsl");
m_shadow_map_vs = dw::gl::Shader::create_from_file(GL_VERTEX_SHADER, "shader/shadow_map_vs.glsl");
m_shadow_map_fs = dw::gl::Shader::create_from_file(GL_FRAGMENT_SHADER, "shader/shadow_map_fs.glsl");
m_light_injection_cs = dw::gl::Shader::create_from_file(GL_COMPUTE_SHADER, "shader/light_injection_cs.glsl");
m_ray_march_cs = dw::gl::Shader::create_from_file(GL_COMPUTE_SHADER, "shader/ray_march_cs.glsl");
m_mesh_vs = dw::gl::Shader::create_from_file(GL_VERTEX_SHADER, "shaders/mesh_vs.glsl");
m_mesh_fs = dw::gl::Shader::create_from_file(GL_FRAGMENT_SHADER, "shaders/mesh_fs.glsl");
m_skybox_vs = dw::gl::Shader::create_from_file(GL_VERTEX_SHADER, "shaders/skybox_vs.glsl");
m_skybox_fs = dw::gl::Shader::create_from_file(GL_FRAGMENT_SHADER, "shaders/skybox_fs.glsl");
m_shadow_map_vs = dw::gl::Shader::create_from_file(GL_VERTEX_SHADER, "shaders/shadow_map_vs.glsl");
m_shadow_map_fs = dw::gl::Shader::create_from_file(GL_FRAGMENT_SHADER, "shaders/shadow_map_fs.glsl");
m_light_injection_cs = dw::gl::Shader::create_from_file(GL_COMPUTE_SHADER, "shaders/light_injection_cs.glsl");
m_ray_march_cs = dw::gl::Shader::create_from_file(GL_COMPUTE_SHADER, "shaders/ray_march_cs.glsl");

if (!m_mesh_vs || !m_mesh_fs || !m_skybox_vs || !m_skybox_fs || !m_shadow_map_vs || !m_shadow_map_fs || !m_light_injection_cs || !m_ray_march_cs)
{
Expand Down Expand Up @@ -311,7 +311,7 @@ class VolumetricLighting : public dw::Application

for (int i = 0; i < NUM_BLUE_NOISE_TEXTURES; i++)
{
auto texture = dw::gl::Texture2D::create_from_file("texture/blue_noise/LDR_LLL1_" + std::to_string(i) + ".png");
auto texture = dw::gl::Texture2D::create_from_file("textures/blue_noise/LDR_LLL1_" + std::to_string(i) + ".png");

texture->set_min_filter(GL_NEAREST);
texture->set_mag_filter(GL_NEAREST);
Expand Down Expand Up @@ -357,7 +357,7 @@ class VolumetricLighting : public dw::Application

bool load_scene()
{
m_mesh = dw::Mesh::load("mesh/sponza.obj");
m_mesh = dw::Mesh::load("meshes/sponza.obj");

if (!m_mesh)
{
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 70cc8f8

Please sign in to comment.