Skip to content

Commit

Permalink
feat: material object editor and more. (#490)
Browse files Browse the repository at this point in the history
* feat: in-game material objects editor; glint support for material objects; mesh texture set updating during editing; subsurface and coat parameters in texture set editor.

* chore: removed no longer used pbr lighting settings.

* style: 🎨 apply clang-format changes

---------

Co-authored-by: Ilya Perapechka <i_perapechka@wargaming.net>
Co-authored-by: Jonahex <Jonahex@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 31, 2024
1 parent 0c79679 commit 149c4d8
Show file tree
Hide file tree
Showing 7 changed files with 192 additions and 288 deletions.
16 changes: 1 addition & 15 deletions package/Shaders/Common/PBR.hlsli
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#define TruePBR_Fuzz (1 << 9)
#define TruePBR_HairMarschner (1 << 10)
#define TruePBR_Glint (1 << 11)
#define TruePBR_ProjectedGlint (1 << 12)

#define TruePBR_LandTile0PBR (1 << 0)
#define TruePBR_LandTile1PBR (1 << 1)
Expand Down Expand Up @@ -106,21 +107,6 @@ namespace PBR
return result;
}

float3 AdjustDirectionalLightColor(float3 lightColor)
{
return pbrSettings.DirectionalLightColorMultiplier * GammaToLinear(lightColor);
}

float3 AdjustPointLightColor(float3 lightColor)
{
return pbrSettings.PointLightColorMultiplier * GammaToLinear(lightColor);
}

float3 AdjustAmbientLightColor(float3 lightColor)
{
return pbrSettings.AmbientLightColorMultiplier * GammaToLinear(lightColor);
}

// [Jimenez et al. 2016, "Practical Realtime Strategies for Accurate Indirect Occlusion"]
float3 MultiBounceAO(float3 baseColor, float ao)
{
Expand Down
6 changes: 1 addition & 5 deletions package/Shaders/Common/SharedData.hlsli
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,9 @@ struct SkylightingSettings

struct PBRSettings
{
float DirectionalLightColorMultiplier;
float PointLightColorMultiplier;
float AmbientLightColorMultiplier;
float BaseColorGamma;
uint UseMultipleScattering;
uint UseMultiBounceAO;
uint3 pad0;
uint2 pad0;
};

cbuffer FeatureData : register(b6)
Expand Down
8 changes: 6 additions & 2 deletions package/Shaders/Lighting.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -1596,6 +1596,9 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace
# if defined(TRUE_PBR)
projBaseColor = saturate(EnvmapData.xyz * projBaseColor);
rawRMAOS.xyw = lerp(rawRMAOS.xyw, float3(ParallaxOccData.x, 0, ParallaxOccData.y), projBlendWeight);
if ((PBRFlags & TruePBR_ProjectedGlint) != 0) {
glintParameters = lerp(glintParameters, SparkleParams, projBlendWeight);
}
# endif
normal.xyz = lerp(normal.xyz, finalProjNormal, projBlendWeight);
baseColor.xyz = lerp(baseColor.xyz, projBaseColor, projBlendWeight);
Expand Down Expand Up @@ -1623,7 +1626,7 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace
# endif // SPECULAR
# endif // SPARKLE

# elif defined(SNOW) && !defined(TRUE_PBR)
# elif defined(SNOW)
# if defined(LANDSCAPE)
psout.Parameters.y = landSnowMask;
# else
Expand Down Expand Up @@ -2229,7 +2232,7 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace
CharacterLightParams.y * saturate(dot(float2(0.164398998, -0.986393988), modelNormal.yz));
float charLightColor = min(CharacterLightParams.w, max(0, CharacterLightParams.z * TexCharacterLightProjNoiseSampler.Sample(SampCharacterLightProjNoiseSampler, baseShadowUV).x));
# if defined(TRUE_PBR)
charLightColor = PBR::AdjustPointLightColor(charLightColor);
charLightColor = GammaToLinear(charLightColor);
# endif
diffuseColor += (charLightMul * charLightColor).xxx;
}
Expand Down Expand Up @@ -2610,6 +2613,7 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace
# if defined(SNOW)
# if defined(TRUE_PBR)
psout.Parameters.x = RGBToLuminanceAlternative(specularColorPBR);
psout.Parameters.y = 0;
# else
psout.Parameters.x = RGBToLuminanceAlternative(lightsSpecularColor);
# endif
Expand Down
Loading

0 comments on commit 149c4d8

Please sign in to comment.