Merge remote-tracking branch 'LL/release/materials_featurette'
# Conflicts: # doc/contributions.txtmaster
commit
b84b5bd949
|
|
@ -179,7 +179,7 @@ jobs:
|
|||
|
||||
# determine the viewer channel from the branch name
|
||||
branch=$AUTOBUILD_VCS_BRANCH
|
||||
IFS='/' read -ra ba <<< $branch
|
||||
IFS='/' read -ra ba <<< "$branch"
|
||||
prefix=${ba[0]}
|
||||
if [ "$prefix" == "project" ]; then
|
||||
IFS='_' read -ra prj <<< "${ba[1]}"
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ Ansariel Hiller
|
|||
SL-4126
|
||||
SL-20224
|
||||
SL-20524
|
||||
https://github.com/secondlife/viewer/issues/1051
|
||||
secondlife/viewer#1051
|
||||
Aralara Rajal
|
||||
Arare Chantilly
|
||||
CHUIBUG-191
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
## Tiling
|
||||
|
||||
The southwest corner of a region with PBR materials should exactly match up with the bottom left corner of the material texture(s).
|
||||
|
||||
If two adjacent regions have the same PBR terrain settings, then:
|
||||
|
||||
- There should not be seams between the two regions at their shared border
|
||||
|
|
|
|||
|
|
@ -3,25 +3,25 @@
|
|||
* @author Nat Goodspeed
|
||||
* @date 2009-06-03
|
||||
* @brief Implementation for llcoros.
|
||||
*
|
||||
*
|
||||
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ U8* LLImageRaw::allocateData(S32 size) { return NULL; }
|
|||
U8* LLImageRaw::reallocateData(S32 size) { return NULL; }
|
||||
const U8* LLImageBase::getData() const { return NULL; }
|
||||
U8* LLImageBase::getData() { return NULL; }
|
||||
const std::string& LLImage::getLastThreadError() { static std::string msg; return msg; }
|
||||
|
||||
// End Stubbing
|
||||
// -------------------------------------------------------------------------------------------
|
||||
|
|
@ -98,7 +99,7 @@ namespace tut
|
|||
done = res;
|
||||
*done = false;
|
||||
}
|
||||
virtual void completed(bool success, LLImageRaw* raw, LLImageRaw* aux, U32)
|
||||
virtual void completed(bool success, const std::string& error_message, LLImageRaw* raw, LLImageRaw* aux, U32 request_id)
|
||||
{
|
||||
*done = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,26 +1,26 @@
|
|||
/**
|
||||
/**
|
||||
* @file llgltfmaterial_test.cpp
|
||||
*
|
||||
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
|
||||
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2023, Linden Research, Inc.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#include "linden_common.h"
|
||||
|
|
|
|||
|
|
@ -1,24 +1,24 @@
|
|||
/**
|
||||
/**
|
||||
* @file pbrShadowAlphaMaskF.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2023, Linden Research, Inc.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
|
@ -33,9 +33,9 @@ in vec4 vertex_color;
|
|||
in vec2 vary_texcoord0;
|
||||
uniform float minimum_alpha;
|
||||
|
||||
void main()
|
||||
void main()
|
||||
{
|
||||
float alpha = texture(diffuseMap,vary_texcoord0.xy).a;
|
||||
float alpha = texture(diffuseMap,vary_texcoord0.xy).a * vertex_color.a;
|
||||
|
||||
if (alpha < minimum_alpha)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -69,12 +69,16 @@ void main()
|
|||
mirrorClip(vary_position);
|
||||
|
||||
vec4 basecolor = texture(diffuseMap, base_color_texcoord.xy).rgba;
|
||||
basecolor.rgb = srgb_to_linear(basecolor.rgb);
|
||||
|
||||
basecolor *= vertex_color;
|
||||
|
||||
if (basecolor.a < minimum_alpha)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
|
||||
vec3 col = vertex_color.rgb * srgb_to_linear(basecolor.rgb);
|
||||
vec3 col = basecolor.rgb;
|
||||
|
||||
// from mikktspace.com
|
||||
vec3 vNt = texture(bumpMap, normal_texcoord.xy).xyz*2.0-1.0;
|
||||
|
|
@ -108,7 +112,7 @@ void main()
|
|||
//emissive = tnorm*0.5+0.5;
|
||||
// See: C++: addDeferredAttachments(), GLSL: softenLightF
|
||||
frag_data[0] = max(vec4(col, 0.0), vec4(0)); // Diffuse
|
||||
frag_data[1] = max(vec4(spec.rgb,vertex_color.a), vec4(0)); // PBR linear packed Occlusion, Roughness, Metal.
|
||||
frag_data[1] = max(vec4(spec.rgb,0.0), vec4(0)); // PBR linear packed Occlusion, Roughness, Metal.
|
||||
frag_data[2] = vec4(tnorm, GBUFFER_FLAG_HAS_PBR); // normal, environment intensity, flags
|
||||
frag_data[3] = max(vec4(emissive,0), vec4(0)); // PBR sRGB Emissive
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,8 +50,8 @@ out vec3 vary_position;
|
|||
// tangent_space_transform below.
|
||||
uniform vec4[2] texture_base_color_transform;
|
||||
|
||||
vec2 texture_transform(vec2 vertex_texcoord, vec4[2] khr_gltf_transform, mat4 sl_animation_transform);
|
||||
vec3 tangent_space_transform(vec4 vertex_tangent, vec3 vertex_normal, vec4[2] khr_gltf_transform, mat4 sl_animation_transform);
|
||||
vec2 terrain_texture_transform(vec2 vertex_texcoord, vec4[2] khr_gltf_transform);
|
||||
vec3 terrain_tangent_space_transform(vec4 vertex_tangent, vec3 vertex_normal, vec4[2] khr_gltf_transform);
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
@ -70,7 +70,7 @@ void main()
|
|||
// *HACK: Should be using texture_normal_transform here. The KHR texture
|
||||
// transform spec requires handling texture transforms separately for each
|
||||
// individual texture.
|
||||
vary_tangent = normalize(tangent_space_transform(vec4(t, tangent.w), n, texture_base_color_transform, texture_matrix0));
|
||||
vary_tangent = normalize(terrain_tangent_space_transform(vec4(t, tangent.w), n, texture_base_color_transform));
|
||||
vary_sign = tangent.w;
|
||||
vary_normal = normalize(n);
|
||||
|
||||
|
|
@ -80,13 +80,13 @@ void main()
|
|||
// separately for each individual texture.
|
||||
#if TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 3
|
||||
// xy
|
||||
vary_coords[0].xy = texture_transform(position.xy, texture_base_color_transform, texture_matrix0);
|
||||
vary_coords[0].xy = terrain_texture_transform(position.xy, texture_base_color_transform);
|
||||
// yz
|
||||
vary_coords[0].zw = texture_transform(position.yz, texture_base_color_transform, texture_matrix0);
|
||||
vary_coords[0].zw = terrain_texture_transform(position.yz, texture_base_color_transform);
|
||||
// (-x)z
|
||||
vary_coords[1].xy = texture_transform(position.xz * vec2(-1, 1), texture_base_color_transform, texture_matrix0);
|
||||
vary_coords[1].xy = terrain_texture_transform(position.xz * vec2(-1, 1), texture_base_color_transform);
|
||||
#elif TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 1
|
||||
vary_texcoord0.xy = texture_transform(position.xy, texture_base_color_transform, texture_matrix0);
|
||||
vary_texcoord0.xy = terrain_texture_transform(position.xy, texture_base_color_transform);
|
||||
#endif
|
||||
|
||||
vec4 tc = vec4(texcoord1,0,1);
|
||||
|
|
|
|||
|
|
@ -77,6 +77,19 @@ vec2 texture_transform(vec2 vertex_texcoord, vec4[2] khr_gltf_transform, mat4 sl
|
|||
return texcoord;
|
||||
}
|
||||
|
||||
// Similar to texture_transform but no offset during coordinate system
|
||||
// conversion, and no texture animation support.
|
||||
vec2 terrain_texture_transform(vec2 vertex_texcoord, vec4[2] khr_gltf_transform)
|
||||
{
|
||||
vec2 texcoord = vertex_texcoord;
|
||||
|
||||
texcoord.y = -texcoord.y;
|
||||
texcoord = khr_texture_transform(texcoord, khr_gltf_transform[0].xy, khr_gltf_transform[0].z, khr_gltf_transform[1].xy);
|
||||
texcoord.y = -texcoord.y;
|
||||
|
||||
return texcoord;
|
||||
}
|
||||
|
||||
// Take the rotation only from both transforms and apply to the tangent. This
|
||||
// accounts for the change of the topology of the normal texture when a texture
|
||||
// rotation is applied to it.
|
||||
|
|
@ -120,3 +133,25 @@ vec3 tangent_space_transform(vec4 vertex_tangent, vec3 vertex_normal, vec4[2] kh
|
|||
|
||||
return (weights.x * vertex_binormal.xyz) + (weights.y * vertex_tangent.xyz);
|
||||
}
|
||||
|
||||
// Similar to tangent_space_transform but no no texture animation support.
|
||||
vec3 terrain_tangent_space_transform(vec4 vertex_tangent, vec3 vertex_normal, vec4[2] khr_gltf_transform)
|
||||
{
|
||||
// Immediately convert to left-handed coordinate system ((0,1) -> (0, -1))
|
||||
vec2 weights = vec2(0, -1);
|
||||
|
||||
// Apply KHR_texture_transform (rotation only)
|
||||
float khr_rotation = khr_gltf_transform[0].z;
|
||||
mat2 khr_rotation_mat = mat2(
|
||||
cos(khr_rotation),-sin(khr_rotation),
|
||||
sin(khr_rotation), cos(khr_rotation)
|
||||
);
|
||||
weights = khr_rotation_mat * weights;
|
||||
|
||||
// Convert back to right-handed coordinate system
|
||||
weights.y = -weights.y;
|
||||
|
||||
vec3 vertex_binormal = vertex_tangent.w * cross(vertex_normal, vertex_tangent.xyz);
|
||||
|
||||
return (weights.x * vertex_binormal.xyz) + (weights.y * vertex_tangent.xyz);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou
|
|||
haze_glow = max(haze_glow, .001); // set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot)
|
||||
haze_glow *= glow.x;
|
||||
// higher glow.x gives dimmer glow (because next step is 1 / "angle")
|
||||
haze_glow = clamp(pow(haze_glow, glow.z), -10, 10);
|
||||
haze_glow = clamp(pow(haze_glow, glow.z), -100000, 100000);
|
||||
// glow.z should be negative, so we're doing a sort of (1 / "angle") function
|
||||
|
||||
// add "minimum anti-solar illumination"
|
||||
|
|
|
|||
|
|
@ -456,17 +456,9 @@ void LLDrawPoolTerrain::renderFullShaderPBR(BOOL local_materials)
|
|||
LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
|
||||
llassert(shader);
|
||||
|
||||
|
||||
// *TODO: Figure out why this offset is *sometimes* producing seams at the
|
||||
// region edge, and repeat jumps when crossing regions, when
|
||||
// RenderTerrainPBRScale is not a factor of the region scale.
|
||||
LLVector3d region_origin_global = gAgent.getRegion()->getOriginGlobal();
|
||||
F32 offset_x = (F32)fmod(region_origin_global.mdV[VX], 1.0/(F64)sPBRDetailScale)*sPBRDetailScale;
|
||||
F32 offset_y = (F32)fmod(region_origin_global.mdV[VY], 1.0/(F64)sPBRDetailScale)*sPBRDetailScale;
|
||||
|
||||
LLGLTFMaterial::TextureTransform base_color_transform;
|
||||
base_color_transform.mScale = LLVector2(sPBRDetailScale, sPBRDetailScale);
|
||||
base_color_transform.mOffset = LLVector2(offset_x, offset_y);
|
||||
// *TODO: mOffset and mRotation left at defaults for now. (per-material texture transforms are implemented in another branch)
|
||||
F32 base_color_packed[8];
|
||||
base_color_transform.getPacked(base_color_packed);
|
||||
// *HACK: Use the same texture repeats for all PBR terrain textures for now
|
||||
|
|
|
|||
|
|
@ -1332,7 +1332,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||
if (rebuild_color)
|
||||
{ //decide if shiny goes in alpha channel of color
|
||||
if (tep &&
|
||||
!isInAlphaPool()) // <--- alpha channel MUST contain transparency, not shiny
|
||||
!isInAlphaPool() && tep->getGLTFRenderMaterial() == nullptr) // <--- alpha channel MUST contain transparency, not shiny
|
||||
{
|
||||
LLMaterial* mat = tep->getMaterialParams().get();
|
||||
|
||||
|
|
|
|||
|
|
@ -77,16 +77,7 @@ void LLFetchedGLTFMaterial::bind(LLViewerTexture* media_tex)
|
|||
{
|
||||
if (mAlphaMode == LLGLTFMaterial::ALPHA_MODE_MASK)
|
||||
{
|
||||
// dividing the alpha cutoff by transparency here allows the shader to compare against
|
||||
// the alpha value of the texture without needing the transparency value
|
||||
if (mBaseColor.mV[3] > 0.f)
|
||||
{
|
||||
min_alpha = mAlphaCutoff / mBaseColor.mV[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
min_alpha = 1024.f;
|
||||
}
|
||||
min_alpha = mAlphaCutoff;
|
||||
}
|
||||
shader->uniform1f(LLShaderMgr::MINIMUM_ALPHA, min_alpha);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,12 +57,6 @@
|
|||
#if 0
|
||||
|
||||
#ifndef LL_WINDOWS
|
||||
|
||||
typedef struct {
|
||||
void *re_pcre;
|
||||
size_t re_nsub;
|
||||
size_t re_erroffset;
|
||||
} regex_t;
|
||||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue