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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[Info]
Version = 1-0-0
Version = 1-0-1
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ namespace TerrainShadows
if (SharedData::terraOccSettings.EnableTerrainShadow) {
float2 terraOccUV = GetTerrainShadowUV(worldPos.xy);
float2 shadowHeight = GetTerrainZ(ShadowHeightTexture.SampleLevel(samp, terraOccUV, 0));
#if defined(DEFERRED)
// Sharp shadows
float shadowFraction = saturate(10.0 * (worldPos.z - shadowHeight.y) / (shadowHeight.x - shadowHeight.y));
#else
// Blurry shadows to simulate scattering
float shadowFraction = saturate((worldPos.z - shadowHeight.y) / (shadowHeight.x - shadowHeight.y));
#endif
return shadowFraction;
}

Expand Down
2 changes: 2 additions & 0 deletions package/Shaders/RunGrass.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include "Common/SharedData.hlsli"
#include "Common/Permutation.hlsli"

#define DEFERRED

#ifdef GRASS_LIGHTING
# define GRASS
#endif // GRASS_LIGHTING
Expand Down
10 changes: 7 additions & 3 deletions src/Features/TerrainShadows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,15 +197,19 @@ TerrainShadows::PerFrame TerrainShadows::GetCommonBufferData()

void TerrainShadows::LoadHeightmap()
{
auto tes = RE::TES::GetSingleton();
if (!tes)
return;
static auto tes = RE::TES::GetSingleton();

auto worldspace = tes->GetRuntimeData2().worldSpace;
while (worldspace && worldspace->parentWorld && worldspace->parentUseFlags.any(RE::TESWorldSpace::ParentUseFlag::kUseLandData))
worldspace = worldspace->parentWorld;

if (!worldspace)
return;

std::string worldspace_name = worldspace->GetFormEditorID();
Comment thread
coderabbitai[bot] marked this conversation as resolved.
if (!heightmaps.contains(worldspace_name)) // no height map for that, but we don't remove cache
return;
Comment thread
doodlum marked this conversation as resolved.

if (cachedHeightmap && cachedHeightmap->worldspace == worldspace_name) // already cached
return;

Expand Down