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
2 changes: 1 addition & 1 deletion NewVegasReloaded/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ extern "C" {

Info->InfoVersion = PluginInfo::kInfoVersion;
Info->Name = "NewVegasReloaded";
Info->Version = 430;
Info->Version = 431;
return true;

}
Expand Down
8 changes: 4 additions & 4 deletions NewVegasReloaded/NewVegasReloaded.rc
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,3,0,0
PRODUCTVERSION 4,3,0,0
FILEVERSION 4,3,1,0
PRODUCTVERSION 4,3,1,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -68,12 +68,12 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "New Vegas Reloaded"
VALUE "FileVersion", "4.3.0"
VALUE "FileVersion", "4.3.1"
VALUE "InternalName", "NewVegasReloaded.dll"
VALUE "LegalCopyright", "Copyright (C) 2025"
VALUE "OriginalFilename", "NewVegasReloaded.dll"
VALUE "ProductName", "New Vegas Reloaded"
VALUE "ProductVersion", "4.3.0"
VALUE "ProductVersion", "4.3.1"
END
END
BLOCK "VarFileInfo"
Expand Down
1 change: 0 additions & 1 deletion NewVegasReloaded/NewVegasReloaded.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@
<ClInclude Include="..\src\effects\DepthOfField.h" />
<ClInclude Include="..\src\effects\Effects.h" />
<ClInclude Include="..\src\effects\Exposure.h" />
<ClInclude Include="..\src\effects\ExtraShaders.h" />
<ClInclude Include="..\src\effects\Flashlight.h" />
<ClInclude Include="..\src\effects\GodRays.h" />
<ClInclude Include="..\src\effects\Grass.h" />
Expand Down
15 changes: 15 additions & 0 deletions NewVegasReloaded/NewVegasReloaded.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,12 @@
<ClInclude Include="..\src\effects\PBR.h">
<Filter>Effects</Filter>
</ClInclude>
<ClInclude Include="..\src\NewVegas\Hooks\Shaders.h">
<Filter>NewVegas\Hooks</Filter>
</ClInclude>
<ClInclude Include="..\src\effects\SMAA.h">
<Filter>Effects</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Main.cpp">
Expand Down Expand Up @@ -531,6 +537,15 @@
<ClCompile Include="..\src\effects\PBR.cpp">
<Filter>Effects</Filter>
</ClCompile>
<ClCompile Include="..\src\NewVegas\Hooks\Shaders.cpp">
<Filter>NewVegas\Hooks</Filter>
</ClCompile>
<ClCompile Include="..\src\effects\SMAA.cpp">
<Filter>Effects</Filter>
</ClCompile>
<ClCompile Include="..\src\effects\SunShadows.cpp">
<Filter>Effects</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="Exports.def">
Expand Down
53 changes: 34 additions & 19 deletions src/hlsl/NewVegas/Shaders/Includes/Parallax.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ float4 TESR_ParallaxData : register(c35);

#ifdef TERRAIN
// Complex Parallax Materials for Community Shaders
// https://bartwronski.com/wp-content/uploads/2014/03/ac4_gdc.pdf
// https://www.artstation.com/blogs/andreariccardi/3VPo/a-new-approach-for-parallax-mapping-presenting-the-contact-refinement-parallax-mapping-technique
float getTerrainHeight(float2 coords, float2 dx, float2 dy, float blendFactor, int texCount, sampler2D tex[7], float blends[7], float status[7], out float weights[7]) {
weights = blends;
Expand Down Expand Up @@ -56,11 +57,11 @@ float2 getParallaxCoords(float distance, float2 coords, float2 dx, float2 dy, fl
}

// Variables.
bool highQuality = TESR_TerrainParallaxData.w;
static const float maxSteps = (TESR_TerrainParallaxData.w) ? 16.0f : 8.0f;
float maxDistance = TESR_TerrainParallaxExtraData.x;
float height = TESR_TerrainParallaxExtraData.y;
#else
bool highQuality = false;
static const float maxSteps = 16.0f;
float maxDistance = 2048;
float height = 0.1 * TESR_ParallaxData.x;
#endif
Expand All @@ -86,16 +87,9 @@ float2 getParallaxCoords(float distance, float2 coords, float2 dx, float2 dy, fl
float2 output;
if (distanceBlend < 1.0)
{
int numSteps;

if (highQuality) {
numSteps = lerp(4, 64, quality);
numSteps = clamp((numSteps / 4) * 4, 4, 64);
}
else {
numSteps = lerp(4, 32, quality);
numSteps = clamp((numSteps / 4) * 4, 4, 32);
}
int numSteps = int((maxSteps * (1.0 - distanceBlend)) + 0.5);
numSteps = ((numSteps + 3) / 4) * 4;
numSteps = clamp(numSteps, 4, maxSteps);

float stepSize = rcp((float) numSteps);

Expand All @@ -107,9 +101,13 @@ float2 getParallaxCoords(float distance, float2 coords, float2 dx, float2 dy, fl

float2 pt1 = 0;
float2 pt2 = 0;

int numStepOrig = numSteps;
bool done = false;
bool contactRefinement = false;

// Need fastopt otherwise compile times are crazy.
[loop][fastopt] while (numSteps > 0) {
[loop][fastopt] while (numSteps > 0 && !done) {
float4 currentOffset[2];
currentOffset[0] = prevOffset.xyxy - float4(1, 1, 2, 2) * offsetPerStep.xyxy;
currentOffset[1] = prevOffset.xyxy - float4(3, 3, 4, 4) * offsetPerStep.xyxy;
Expand All @@ -133,33 +131,50 @@ float2 getParallaxCoords(float distance, float2 coords, float2 dx, float2 dy, fl

[branch] if (any(testResult))
{
float2 lastOffset = 0;
[flatten] if (testResult.w)
{
lastOffset = currentOffset[1].xy;
pt1 = float2(currentBound.w, currHeight.w);
pt2 = float2(currentBound.z, currHeight.z);
}
[flatten] if (testResult.z)
{
lastOffset = currentOffset[0].zw;
pt1 = float2(currentBound.z, currHeight.z);
pt2 = float2(currentBound.y, currHeight.y);
}
[flatten] if (testResult.y)
{
lastOffset = currentOffset[0].xy;
pt1 = float2(currentBound.y, currHeight.y);
pt2 = float2(currentBound.x, currHeight.x);
}
[flatten] if (testResult.x)
{
lastOffset = prevOffset;
pt1 = float2(currentBound.x, currHeight.x);
pt2 = float2(prevBound, prevHeight);
}
break;

if (contactRefinement) {
done = true;
}
else {
contactRefinement = true;
prevOffset = lastOffset;
prevBound = pt2.x;
numSteps = numStepOrig;
stepSize /= (float) numSteps;
offsetPerStep /= (float) numSteps;
}
}
else {
prevOffset = currentOffset[1].zw;
prevBound = currentBound.w;
prevHeight = currHeight.w;
numSteps -= 4;
}

prevOffset = currentOffset[1].zw;
prevBound = currentBound.w;
prevHeight = currHeight.w;
numSteps -= 4;
}

float delta2 = pt2.x - pt2.y;
Expand Down
2 changes: 1 addition & 1 deletion src/hlsl/NewVegas/Shaders/TerrainTemplate.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ PS_OUTPUT main(PS_INPUT IN) {
float3 lightTS = mul(tbn, SunDir.xyz);
float parallaxShadowMultiplier = getParallaxShadowMultipler(dist, offsetUV, dx, dy, lightTS, texCount, blends, heightStatus, BaseMap);

float3 lighting = getSunLighting(lightTS, SunColor.rgb, eyeDir, combinedNormal, AmbientColor.rgb, baseColor, gloss, specExponent);
float3 lighting = getSunLighting(lightTS, SunColor.rgb, eyeDir, combinedNormal, AmbientColor.rgb, baseColor, gloss, specExponent, 1.0, parallaxShadowMultiplier);

#if defined(NUM_PT_LIGHTS)
[loop] for (int i = 0; i < PointLightCount; i++) {
Expand Down
Loading