Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
5.3 kB
1
Indexable
Never
diff --git a/modelmaterials_gl4/defaultMaterialTemplate.lua b/modelmaterials_gl4/defaultMaterialTemplate.lua
index c6f994b19..4a477f3e2 100644
--- a/modelmaterials_gl4/defaultMaterialTemplate.lua
+++ b/modelmaterials_gl4/defaultMaterialTemplate.lua
@@ -771,7 +771,7 @@ fragment = [[
 
 	float Perlin3D( vec3 P ) {
 
-		// return (textureLod(noisetex3dcube, fract(P*0.1), 0.0).a * 2.0 - 1.0);
+		return (textureLod(noisetex3dcube, fract(P*0.1), 0.0).a * 2.0 - 1.0);
 		//  https://github.com/BrianSharpe/Wombat/blob/master/Perlin3D.glsl
 
 		// establish our grid cell and unit position
@@ -1256,7 +1256,7 @@ fragment = [[
 			seedVec = modelVertexPosOrig.xyz * 0.6;
 			seedVec.y += 1024.0 * hash11(float(unitID));
 
-			healthMix = SNORM2NORM(sqrt(Perlin3D(seedVec.xyz)) * (2.0 - baseVertexDisplacement));
+			healthMix = SNORM2NORM(Perlin3D(seedVec.xyz)) * (2.0 - baseVertexDisplacement);
 			healthMix = smoothstep(0.0, healthMix, max((1.0 - healthFraction) + baseVertexDisplacement, 0.0)) * 0.8; // Reduce maximum damage shading to 80%
 		}
 		#endif
@@ -1330,7 +1330,7 @@ fragment = [[
 		}
 		#endif
 		vec4 teeeeemcolor = teamCol;
-		vec3 albedoColor = SRGBtoLINEAR(mix(texColor1.rgb, teeeeemcolor.rgb, clamp(step(0.1, texColor1.a), 0.0, 0.9)));
+		vec3 albedoColor = SRGBtoLINEAR(mix(texColor1.rgb, teeeeemcolor.rgb, texColor1.a));
 
 		if (BITMASK_FIELD(bitOptions, OPTION_HEALTH_TEXRAPTORS)) {
 			float texHeight = normalTexVal.a;
@@ -1600,7 +1600,7 @@ fragment = [[
 		#endif
 
 		outColor.rgb *= brightnessFactor; // this is to correct for lack of env mapping, the nastiest hack there has ever been...
-		
+
 		//iblDiffuse, iblSpecular
 		//outColor.rgb = iblSpecular;
 
@@ -1677,6 +1677,7 @@ fragment = [[
 	},
 }
 
+local SKIN_SUPPORT = Script.IsEngineMinVersion(105, 0, 1653) and "1" or "0"
 local defaultMaterialTemplate = {
 	--standardUniforms --locs, set by api_cus
 	--deferredUniforms --locs, set by api_cus
@@ -1690,7 +1691,7 @@ local defaultMaterialTemplate = {
 	-- they need to be redefined on every child material that has its own {shader,deferred,shadow}Definitions
 	shaderDefinitions = {
 		"#define RENDERING_MODE 0",
-		"#define SKINSUPPORT " .. (Spring.Utilities.EngineVersionAtLeast(105,1,1,1653) and "1" or "0"),
+		"#define SKINSUPPORT " .. SKIN_SUPPORT,
 		"#define SUNMULT pbrParams[6]",
 		"#define EXPOSURE pbrParams[7]",
 
@@ -1707,7 +1708,7 @@ local defaultMaterialTemplate = {
 	},
 	deferredDefinitions = {
 		"#define RENDERING_MODE 1",
-		"#define SKINSUPPORT " .. (Spring.Utilities.EngineVersionAtLeast(105,1,1,1653) and "1" or "0"),
+		"#define SKINSUPPORT " .. SKIN_SUPPORT,
 		"#define SUNMULT pbrParams[6]",
 		"#define EXPOSURE pbrParams[7]",
 
@@ -1724,7 +1725,7 @@ local defaultMaterialTemplate = {
 	},
 	shadowDefinitions = {
 		"#define RENDERING_MODE 2",
-		"#define SKINSUPPORT " .. (Spring.Utilities.EngineVersionAtLeast(105,1,1,1653) and "1" or "0"),
+		"#define SKINSUPPORT " .. SKIN_SUPPORT,
 		"#define SUPPORT_DEPTH_LAYOUT ".. tostring((Platform.glSupportFragDepthLayout and 1) or 0),
 		"#define SUPPORT_CLIP_CONTROL ".. tostring((Platform.glSupportClipSpaceControl and 1) or 0),
 		[[
@@ -1741,7 +1742,7 @@ local defaultMaterialTemplate = {
 	},
 	reflectionDefinitions = {
 		"#define RENDERING_MODE 0",
-		"#define SKINSUPPORT " .. (Spring.Utilities.EngineVersionAtLeast(105,1,1,1653) and "1" or "0"),
+		"#define SKINSUPPORT " .. SKIN_SUPPORT,
 		"#define SUNMULT pbrParams[6]",
 		"#define EXPOSURE pbrParams[7]",
 
@@ -1758,8 +1759,8 @@ local defaultMaterialTemplate = {
 	},
 
 	shaderOptions = {
-		shadowmapping     = false,
-		normalmapping     = true,
+		shadowmapping     = true,
+		normalmapping     = false,
 
 		vertex_ao         = false,
 		flashlights       = false,
@@ -1772,7 +1773,7 @@ local defaultMaterialTemplate = {
 		health_texturing = false,
 		health_texraptors = false,
 
-		modelsfog        = false,
+		modelsfog        = true,
 
 		treewind         = false,
 
@@ -1781,17 +1782,17 @@ local defaultMaterialTemplate = {
 	},
 
 	deferredOptions = {
-		shadowmapping    = false,
-		normalmapping    = true,
+		shadowmapping    = true,
+		normalmapping    = false,
 
 		vertex_ao        = false,
 		flashlights      = false,
-		shift_rgbhsv   	 = false,
+		shift_rgbhsv   = false,
 
 		threads_arm      = false,
 		threads_core     = false,
 
-		modelsfog        = false,
+		modelsfog        = true,
 
 		health_displace  = false,
 		health_texturing = false,
@@ -1999,7 +2000,7 @@ local function SunChanged(luaShader)
 		Spring.GetConfigFloat("unitSunMult", 1.0),
 		Spring.GetConfigFloat("unitExposureMult", 1.0),
 	})
-	luaShader:SetUniformFloatAlways("gamma", Spring.GetConfigFloat("modelGamma", 100.0))
+	luaShader:SetUniformFloatAlways("gamma", Spring.GetConfigFloat("modelGamma", 1.0))
 end
 
 defaultMaterialTemplate.ProcessOptions = ProcessOptions
@@ -2009,4 +2010,4 @@ defaultMaterialTemplate.GetAllOptions = GetAllOptions
 defaultMaterialTemplate.SunChangedOrig = SunChanged
 defaultMaterialTemplate.SunChanged = SunChanged
 
-return defaultMaterialTemplate
+return defaultMaterialTemplate
\ No newline at end of file
Leave a Comment