Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,25 +77,27 @@ endif()
# #######################################################################################################################
# # Automatic deployment
# #######################################################################################################################

file(GLOB FEATURE_PATHS LIST_DIRECTORIES true ${CMAKE_SOURCE_DIR}/features/*)

# Automatic deployment to CommunityShaders output directory.
if (AUTO_PLUGIN_DEPLOYMENT)
if(AUTO_PLUGIN_DEPLOYMENT)
foreach(DEPLOY_TARGET $ENV{CommunityShadersOutputDir})
message("Copying package folder with dll/pdb with all features to ${DEPLOY_TARGET}")
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/package "${DEPLOY_TARGET}"
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${PROJECT_NAME}> "${DEPLOY_TARGET}/SKSE/Plugins/"
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_PDB_FILE:${PROJECT_NAME}> "${DEPLOY_TARGET}/SKSE/Plugins/"
)

foreach(FEATURE_PATH ${FEATURE_PATHS})
message("Copying ${FEATURE_PATH} to ${DEPLOY_TARGET}")
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${FEATURE_PATH} "${DEPLOY_TARGET}"
)
endforeach()
endforeach()
if (NOT DEFINED ENV{CommunityShadersOutputDir})

if(NOT DEFINED ENV{CommunityShadersOutputDir})
message("When using AUTO_PLUGIN_DEPLOYMENT option, you need to set environment variable 'CommunityShadersOutputDir'")
endif()
endif()
Expand Down
28 changes: 13 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ SKSE core plugin for community-driven advanced graphics modifications.

## Requirements

- [CMake](https://cmake.org/)
- Add this to your `PATH`
- [PowerShell](https://github.com/PowerShell/PowerShell/releases/latest)
- [Vcpkg](https://github.com/microsoft/vcpkg)
- Add the environment variable `VCPKG_ROOT` with the value as the path to the folder containing vcpkg
- Any terminal of your choice (e.g., PowerShell)
- [Visual Studio Community 2022](https://visualstudio.microsoft.com/)
- Desktop development with C++
- [CommonLibSSENG](https://github.com/alandtse/commonlibvr/tree/ng)
- Add this as as an environment variable `CommonLibSSEPath`
- [CMake](https://cmake.org/)
- Edit the `PATH` environment variable and add the cmake.exe install path as a new value
- Instructions for finding and editing the `PATH` environment variable can be found [here](https://www.java.com/en/download/help/path.html)
- [Git](https://git-scm.com/downloads)
- Edit the `PATH` environment variable and add the Git.exe install path as a new value
- [Vcpkg](https://github.com/microsoft/vcpkg)
- Install vcpkg using the directions in vcpkg's [Quick Start Guide](https://github.com/microsoft/vcpkg#quick-start-windows)
- After install, add a new environment variable named `VCPKG_ROOT` with the value as the path to the folder containing vcpkg

## User Requirements

Expand All @@ -29,17 +31,13 @@ SKSE core plugin for community-driven advanced graphics modifications.
- Run `cmake`
- Close the cmd window

## Building
## Clone and Build
Open terminal (e.g., PowerShell) and run the following commands:

```
git clone https://github.com/doodlum/skyrim-community-shaders.git
git clone https://github.com/doodlum/skyrim-community-shaders.git --recursive
cd skyrim-community-shaders
# pull commonlib /extern to override the path settings
git submodule update --init --recursive
#configure cmake
cmake -S . --preset=ALL
#build dll
cmake --build build --config Release
.\BuildRelease.bat
```

## License
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[Info]
Version = 1-1-0
Version = 1-2-0
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ cbuffer GrassCollisionPerFrame : register(b5)
bool EnableGrassCollision;
float RadiusMultiplier;
float DisplacementMultiplier;
float maxDistance;
}

struct StructuredCollision
Expand All @@ -21,10 +22,10 @@ float3 GetDisplacedPosition(float3 position, float alpha, uint eyeIndex = 0)
float3 worldPosition = mul(World[eyeIndex], float4(position, 1)).xyz;
float3 displacement = 0;

// Player bound culling
// Player bound culling and distance from player culling
{
float dist = distance(boundCentre[eyeIndex].xyz, worldPosition);
if (dist > boundRadius) {
if ((dist > boundRadius) && (dist > maxDistance)) {
return 0;
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/Feature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ const std::vector<Feature*>& Feature::GetFeatureList()
GrassLighting::GetSingleton(),
GrassCollision::GetSingleton(),
ExtendedMaterials::GetSingleton(),
LightLimitFix::GetSingleton()
LightLimitFix::GetSingleton(),
SubsurfaceScattering::GetSingleton()
};

return REL::Module::IsVR() ? featuresVR : features;
Expand Down
51 changes: 40 additions & 11 deletions src/Features/DistantTreeLighting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,64 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(
void DistantTreeLighting::DrawSettings()
{
if (ImGui::TreeNodeEx("Complex Tree LOD", ImGuiTreeNodeFlags_DefaultOpen)) {
ImGui::TextWrapped(
"Enables advanced lighting simulation on tree LOD.\n"
"Requires DynDOLOD.\n"
"See https://dyndolod.info/ for more information.");
ImGui::Checkbox("Enable Complex Tree LOD", (bool*)&settings.EnableComplexTreeLOD);
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
ImGui::Text("Enables advanced lighting simulation on tree LOD.\n");
ImGui::Text("Requires DynDOLOD.\n");
ImGui::Text("See https://dyndolod.info/ for more information.");
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}

ImGui::Spacing();
ImGui::Spacing();
ImGui::TreePop();
}

if (ImGui::TreeNodeEx("Lights", ImGuiTreeNodeFlags_DefaultOpen)) {
ImGui::TextWrapped("Fix for trees not being affected by sunlight scale.");
ImGui::Checkbox("Enable Directional Light Fix", (bool*)&settings.EnableDirLightFix);
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
ImGui::Text("Fix for trees not being affected by sunlight scale.");
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}

ImGui::Spacing();
ImGui::Spacing();
ImGui::TreePop();
}

if (ImGui::TreeNodeEx("Effects", ImGuiTreeNodeFlags_DefaultOpen)) {
ImGui::TextWrapped(
"Soft lighting controls how evenly lit an object is.\n"
"Back lighting illuminates the back face of an object.\n"
"Combined to model the transport of light through the surface.");
ImGui::SliderFloat("Subsurface Scattering Amount", &settings.SubsurfaceScatteringAmount, 0.0f, 1.0f);
ImGui::SliderFloat("SSS Amount", &settings.SubsurfaceScatteringAmount, 0.0f, 1.0f);
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
ImGui::Text("Subsurface Scattering (SSS) amount\n");
ImGui::Text("Soft lighting controls how evenly lit an object is.\n");
ImGui::Text("Back lighting illuminates the back face of an object.\n");
ImGui::Text("Combined to model the transport of light through the surface.");
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}

ImGui::Spacing();
ImGui::Spacing();
ImGui::TreePop();
}

if (ImGui::TreeNodeEx("Vanilla", ImGuiTreeNodeFlags_DefaultOpen)) {
ImGui::TextWrapped("Darkens lighting relative fog strength.");
ImGui::SliderFloat("Fog Dimmer Amount", &settings.FogDimmerAmount, 0.0f, 1.0f);
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
ImGui::Text("Darkens lighting relative fog strength.");
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}

ImGui::TreePop();
}
Expand Down
148 changes: 118 additions & 30 deletions src/Features/ExtendedMaterials.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,59 +14,147 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(
ShadowsStartFade,
ShadowsEndFade)

void ExtendedMaterials::DataLoaded()
{
if (&settings.EnableTerrain) {
if (auto bLandSpecular = RE::INISettingCollection::GetSingleton()->GetSetting("bLandSpecular:Landscape"); bLandSpecular) {
if (!bLandSpecular->data.b) {
logger::info("[CPM] Changing bLandSpecular from {} to {} to support Terrain Parallax", bLandSpecular->data.b, true);
bLandSpecular->data.b = true;
}
}
}
}

void ExtendedMaterials::DrawSettings()
{
if (ImGui::TreeNodeEx("Complex Material", ImGuiTreeNodeFlags_DefaultOpen)) {
ImGui::TextWrapped(
"Enables support for the Complex Material specification which makes use of the environment mask.\n"
"This includes parallax, as well as more realistic metals and specular reflections.\n"
"May lead to some warped textures on modded content which have an invalid alpha channel in their environment mask.");
ImGui::Checkbox("Enable Complex Material", (bool*)&settings.EnableComplexMaterial);

if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
ImGui::Text("Enables support for the Complex Material specification which makes use of the environment mask.\n");
ImGui::Text("This includes parallax, as well as more realistic metals and specular reflections.\n");
ImGui::Text("May lead to some warped textures on modded content which have an invalid alpha channel in their environment mask.");
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}

ImGui::Spacing();
ImGui::Spacing();
ImGui::TreePop();
}

if (ImGui::TreeNodeEx("Contact Refinement Parallax Mapping", ImGuiTreeNodeFlags_DefaultOpen)) {
ImGui::TextWrapped("Enables parallax on standard meshes made for parallax.");
ImGui::Checkbox("Enable Parallax", (bool*)&settings.EnableParallax);
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
ImGui::Text("Enables parallax on standard meshes made for parallax.");
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}

if (ImGui::Checkbox("Enable Terrain", (bool*)&settings.EnableTerrain)) {
if (settings.EnableTerrain) {
DataLoaded();
}
}
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
ImGui::Text("Enables terrain parallax using the alpha channel of each landscape texture.\n");
ImGui::Text("Therefore, all landscape textures must support parallax for this effect to work properly.");
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}

ImGui::TextWrapped(
"Enables terrain parallax using the alpha channel of each landscape texture.\n"
"Therefore, all landscape textures must support parallax for this effect to work properly.");
ImGui::Checkbox("Enable Terrain", (bool*)&settings.EnableTerrain);

ImGui::TextWrapped(
"Doubles the sample count and approximates the intersection point using Parallax Occlusion Mapping.\n"
"Significantly improves the quality and removes aliasing.\n"
"TAA or the Skyrim Upscaler is recommended when using this option due to CRPM artifacts.");
ImGui::Checkbox("Enable High Quality", (bool*)&settings.EnableHighQuality);

ImGui::TextWrapped("The furthest distance from the camera which uses parallax.");
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
ImGui::Text("Doubles the sample count and approximates the intersection point using Parallax Occlusion Mapping.\n");
ImGui::Text("Significantly improves the quality and removes aliasing.\n");
ImGui::Text("TAA or the Skyrim Upscaler is recommended when using this option due to CRPM artifacts.");
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}

ImGui::Spacing();
ImGui::Spacing();
ImGui::SliderInt("Max Distance", (int*)&settings.MaxDistance, 0, 4096);
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
ImGui::Text("The furthest distance from the camera which uses parallax.");
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}

ImGui::TextWrapped("The percentage of the max distance which uses CRPM.");
ImGui::SliderFloat("CRPM Range", &settings.CRPMRange, 0.0f, 1.0f);
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
ImGui::Text("The percentage of the max distance which uses Contact Refinement Parallax Mapping (CRPM).");
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}

ImGui::TextWrapped(
"The range that parallax blends from POM to bump mapping, and bump mapping to nothing.\n"
"This value should be set as low as possible due to the performance impact of blending POM and relief mapping.");
ImGui::SliderFloat("Blend Range", &settings.BlendRange, 0.0f, settings.CRPMRange);
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
ImGui::Text("The range that parallax blends from Parallax Occlusion Mapping (POM) to bump mapping, and bump mapping to nothing.\n");
ImGui::Text("This value should be set as low as possible due to the performance impact of blending POM and relief mapping.");
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}

ImGui::TextWrapped("The range between the highest and lowest point a surface can be offset by.");
ImGui::SliderFloat("Height", &settings.Height, 0, 0.2f);

if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
ImGui::Text("The range between the highest and lowest point a surface can be offset by.");
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}

ImGui::Spacing();
ImGui::Spacing();
ImGui::TreePop();
}

if (ImGui::TreeNodeEx("Approximate Soft Shadows", ImGuiTreeNodeFlags_DefaultOpen)) {
ImGui::TextWrapped(
"Enables cheap soft shadows when using parallax.\n"
"This applies to all directional and point lights.");
ImGui::Checkbox("Enable Shadows", (bool*)&settings.EnableShadows);

ImGui::TextWrapped("Modifying the start and end fade can improve performance and hide obvious texture tiling.");
ImGui::SliderInt("Shadows Start Fade", (int*)&settings.ShadowsStartFade, 0, settings.ShadowsEndFade);
ImGui::SliderInt("Shadows End Fade", (int*)&settings.ShadowsEndFade, settings.ShadowsStartFade, 4096);
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
ImGui::Text("Enables cheap soft shadows when using parallax.\n");
ImGui::Text("This applies to all directional and point lights.");
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}

ImGui::Spacing();
ImGui::Spacing();
ImGui::TextWrapped("Modifying the shadow start and end fade can improve performance and hide obvious texture tiling.");
ImGui::SliderInt("Start Fade", (int*)&settings.ShadowsStartFade, 0, settings.ShadowsEndFade);
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
ImGui::Text("Distance shadows start to fade.");
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}

ImGui::SliderInt("End Fade", (int*)&settings.ShadowsEndFade, settings.ShadowsStartFade, 4096);
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
ImGui::Text("Distance shadows finish fading.");
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}

ImGui::TreePop();
}
Expand Down
2 changes: 2 additions & 0 deletions src/Features/ExtendedMaterials.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ struct ExtendedMaterials : Feature
virtual void SetupResources();
virtual inline void Reset() {}

void DataLoaded();

virtual void DrawSettings();

void ModifyLighting(const RE::BSShader* shader, const uint32_t descriptor);
Expand Down
Loading