diff --git a/Assets/Core/Shaders/TessDisplacement.frag b/Assets/Core/Shaders/TessDisplacement.frag index d890507..1b4be6c 100644 --- a/Assets/Core/Shaders/TessDisplacement.frag +++ b/Assets/Core/Shaders/TessDisplacement.frag @@ -160,6 +160,15 @@ vec3 blendErosion(vec3 base, vec3 blend, vec3 falloff) } #ifdef DETAIL_SAMPLER_COUNT +vec4 sampleDetailTexture() +{ + vec3 detailTexCoordPerMeter = wrappedNoiseCoord * 10000.0; // repeats [0,1) per meter + vec3 texCoord = detailAlbedoUvScale[0] * detailTexCoordPerMeter; + return texture(albedoDetailSamplers[0], texCoord.xy); +} +#endif // DETAIL_SAMPLER_COUNT + +#if DETAIL_SAMPLER_COUNT > 1 vec4 sampleDetailAlbedo(int i, vec3 normal, vec3 texCoord, vec2 normalUv) { return texture(albedoDetailSamplers[i], texCoord.xy); @@ -175,13 +184,6 @@ vec4 sampleDetailAlbedoMultiScale(int i, vec3 normal, vec3 texCoord, vec2 normal return mix(c, d, clamp(1-lod*0.5, 0, 1)); } -vec4 sampleDetailTexture() -{ - vec3 detailTexCoordPerMeter = wrappedNoiseCoord * 10000.0; // repeats [0,1) per meter - vec3 texCoord = detailAlbedoUvScale[0] * detailTexCoordPerMeter; - return texture(albedoDetailSamplers[0], texCoord.xy); -} - vec4 sampleAttributeDetailTextures(vec3 normal, vec2 normalUv, vec3 albedo) { vec3 detailTexCoordPerMeter = wrappedNoiseCoord * 5000.0; // repeats [0,1) per meter @@ -254,12 +256,12 @@ vec4 sampleAttributeDetailTextures(vec3 normal, vec2 normalUv, vec3 albedo) vec3 albedoDetailTexCoord = detailAlbedoUvScale[index] * detailTexCoordPerMeter; attributeColor += sampleDetailAlbedo(index, normal, albedoDetailTexCoord, normalUv) * attrWeights[i]; } -#endif +#endif //OVERLAY_BLEND #endif return attributeColor; } -#endif +#endif // DETAIL_SAMPLER_COUNT > 1 #ifdef EXPERIMENTAL_DETAIL_ALBEDO vec4 sampleDetailAlbedoAdvanced(int i, vec3 normal, vec3 texCoord, vec2 normalUv) diff --git a/Assets/Core/Shaders/TreeBillboard.frag b/Assets/Core/Shaders/TreeBillboard.frag index c15ade1..fe154ef 100644 --- a/Assets/Core/Shaders/TreeBillboard.frag +++ b/Assets/Core/Shaders/TreeBillboard.frag @@ -4,7 +4,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -#version 330 core +#version 440 core #pragma import_defines ( CAST_SHADOWS ) #pragma import_defines ( ENABLE_SHADOWS ) diff --git a/src/Skybolt/SkyboltVis/Renderable/Planet/Terrain.cpp b/src/Skybolt/SkyboltVis/Renderable/Planet/Terrain.cpp index 0271af8..9a8b88d 100644 --- a/src/Skybolt/SkyboltVis/Renderable/Planet/Terrain.cpp +++ b/src/Skybolt/SkyboltVis/Renderable/Planet/Terrain.cpp @@ -126,7 +126,7 @@ static void setupTerrainStateSet(osg::StateSet& ss, const TerrainConfig& config) if (auto uniformTechnique = dynamic_cast(config.detailMappingTechnique.get()); uniformTechnique) { ss.setDefine("DETAIL_MAPPING_TECHNIQUE_UNIFORM"); - ss.setDefine("DETAIL_SAMPLER_COUNT"); + ss.setDefine("DETAIL_SAMPLER_COUNT", "1"); ss.setTextureAttributeAndModes(unit, uniformTechnique->albedoDetailMap); ss.addUniform(createUniformSampler2d("albedoDetailSamplers", unit++));