[FIRE-35081] - Fixed blurry textures and scaling issues

Added new calculation to the LLCamera for draw distance multiplier
Removed the Inverse aspect as not longer used
Modified the LLFace to no long user the inverse aspect.
Updated mInFrustum to use mImportanceToCamera as it was correct
LLViewerCamera removed the mCosCameraFOV (not used anymore)
Added LLViewerMenu option under Developer->Dump->Texture List to dump texture list to info for debugging.
LLViewerTexture viewer for LOD textures, now loops to make the texture fit to cover the max discard value instead of calculating with logs and divisions.
LLViewerTextureList updated to to dump texture list to the Infos, and updated to boost for not only textures based upon the importance to the camera, but to boost a second time for textures close to the camera. Also capped the mMaxVirtualSize to try to help track down texture size changes
Updated LLPipeline to use same getDrawDistanceMultiplier as the texture calcPixelArea code.
master
minerjr 2025-03-11 00:31:39 -03:00 committed by Beq
parent c64a294cf1
commit 5b0801e535
13 changed files with 189 additions and 44 deletions

View File

@ -36,7 +36,8 @@ LLCamera::LLCamera() :
mView(DEFAULT_FIELD_OF_VIEW),
mAspect(DEFAULT_ASPECT_RATIO),
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
mInverseAspect(1.0f / DEFAULT_ASPECT_RATIO),
//mInverseAspect(1.0f / DEFAULT_ASPECT_RATIO),
mDrawDistanceMultiplier(1.0f),
// </FS:minerjr> [FIRE-35081]
mViewHeightInPixels( -1 ), // invalid height
mNearPlane(DEFAULT_NEAR_PLANE),
@ -68,12 +69,16 @@ LLCamera::LLCamera(F32 vertical_fov_rads, F32 aspect_ratio, S32 view_height_in_p
mAspect = llclamp(aspect_ratio, MIN_ASPECT_RATIO, MAX_ASPECT_RATIO);
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
// Store the inverse of the aspect ratio, so we can remove it from texture calculations
mInverseAspect = 1.0f / mAspect;
//mInverseAspect = 1.0f / mAspect;
// </FS:minerjr> [FIRE-35081]
mNearPlane = llclamp(near_plane, MIN_NEAR_PLANE, MAX_NEAR_PLANE);
if(far_plane < 0) far_plane = DEFAULT_FAR_PLANE;
mFarPlane = llclamp(far_plane, MIN_FAR_PLANE, MAX_FAR_PLANE);
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
// Store the draw distance multiplier based upon how much bigger/smaller the far plan is then the default (64.0f)
mDrawDistanceMultiplier = mFarPlane / DEFAULT_FAR_PLANE;
mDrawDistanceMultiplier = mDrawDistanceMultiplier < 1.0f ? 1.0f : mDrawDistanceMultiplier;
// </FS:minerjr> [FIRE-35081]
setView(vertical_fov_rads);
}
@ -138,7 +143,7 @@ void LLCamera::setAspect(F32 aspect_ratio)
mAspect = llclamp(aspect_ratio, MIN_ASPECT_RATIO, MAX_ASPECT_RATIO);
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
// Store the inverse of the aspect ratio, so we can remove it from texture calculations
mInverseAspect = 1.0f / mAspect;
//mInverseAspect = 1.0f / mAspect;
// </FS:minerjr> [FIRE-35081]
calculateFrustumPlanes();
}
@ -154,6 +159,11 @@ void LLCamera::setNear(F32 near_plane)
void LLCamera::setFar(F32 far_plane)
{
mFarPlane = llclamp(far_plane, MIN_FAR_PLANE, MAX_FAR_PLANE);
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
// Store the draw distance multiplier based upon how much bigger/smaller the far plan is then the default (64.0f)
mDrawDistanceMultiplier = mFarPlane / DEFAULT_FAR_PLANE;
mDrawDistanceMultiplier = mDrawDistanceMultiplier < 1.0f ? 1.0f : mDrawDistanceMultiplier;
// </FS:minerjr> [FIRE-35081]
calculateFrustumPlanes();
}

View File

@ -129,7 +129,8 @@ private:
F32 mAspect; // width/height
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
// Store the inverse of the aspect ratio, for the texture's sizes
F32 mInverseAspect; // height/width
//F32 mInverseAspect; // height/width
F32 mDrawDistanceMultiplier; // mFarPlane / DEFAULT_FAR_PLANE
// </FS:minerjr> [FIRE-35081]
S32 mViewHeightInPixels; // for ViewHeightInPixels() only
F32 mNearPlane;
@ -166,7 +167,8 @@ public:
S32 getViewHeightInPixels() const { return mViewHeightInPixels; }
F32 getAspect() const { return mAspect; } // width / height
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
F32 getInverseAspect() const { return mInverseAspect; } // width / height
//F32 getInverseAspect() const { return mInverseAspect; } // width / height
F32 getDrawDistanceMultiplier() const { return mDrawDistanceMultiplier; } // mFarPlane / DEFAULT_FAR_PLANE (could also include near plane as well)
// </FS:minerjr> [FIRE-35081]
F32 getNear() const { return mNearPlane; } // meters
F32 getFar() const { return mFarPlane; } // meters

View File

@ -75,6 +75,14 @@ static LLStaticHashedString sColorIn("color_in");
bool LLFace::sSafeRenderSelect = true; // false
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
// Moved to allow more code to access these values
const S8 FACE_IMPORTANCE_LEVEL = 4 ;
const F32 FACE_IMPORTANCE_TO_CAMERA_OVER_DISTANCE[FACE_IMPORTANCE_LEVEL][2] = //{distance, importance_weight}
{{16.1f, 1.0f}, {32.1f, 0.5f}, {48.1f, 0.2f}, {96.1f, 0.05f} } ;
const F32 FACE_IMPORTANCE_TO_CAMERA_OVER_ANGLE[FACE_IMPORTANCE_LEVEL][2] = //{cos(angle), importance_weight}
{{0.985f /*cos(10 degrees)*/, 1.0f}, {0.94f /*cos(20 degrees)*/, 0.8f}, {0.866f /*cos(30 degrees)*/, 0.64f}, {0.0f, 0.36f}} ;
// </FS:minerjr> [FIRE-35081]
#define DOTVEC(a,b) (a.mV[0]*b.mV[0] + a.mV[1]*b.mV[1] + a.mV[2]*b.mV[2])
@ -2332,7 +2340,7 @@ F32 LLFace::getTextureVirtualSize()
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
// Remove the aspect ratio and FOV from the area of the face to remove the changes to the window size from affecting the calculations.
// So that textures are in the same space as the face.
face_area = face_area * LLViewerCamera::getInstance()->getInverseAspect();
//face_area = face_area * LLViewerCamera::getInstance()->getInverseAspect();
// </FS:minerjr> [FIRE-35081]
setVirtualSize(face_area) ;
@ -2470,8 +2478,9 @@ bool LLFace::calcPixelArea(F32& cos_angle_to_view_dir, F32& radius)
x_axis.load3(camera->getXAxis().mV);
cos_angle_to_view_dir = lookAt.dot3(x_axis).getF32();
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
// Added real in frustum check value. Previous was only false for media textures off screen and invalid rig objects
mInFrustum = cos_angle_to_view_dir > camera->getCosHalfFov() && cos_angle_to_view_dir < camera->getCosHalfFov() * 2.0f;
// Added close to camera (based upon the mImportanceToCamera) where any object that is within the FACE_IMPORTANCE_TO_CAMERA_OVER_DISTANCE (16.1f)
// gets an extra texture scaling up.
mCloseToCamera = dist <= FACE_IMPORTANCE_TO_CAMERA_OVER_DISTANCE[0][0] * camera->getDrawDistanceMultiplier() ? 1.0f : 0.0f;
// </FS:minerjr> [FIRE-35081]
//if has media, check if the face is out of the view frustum.
@ -2506,10 +2515,17 @@ bool LLFace::calcPixelArea(F32& cos_angle_to_view_dir, F32& radius)
{
cos_angle_to_view_dir = 1.0f ;
mImportanceToCamera = 1.0f ;
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
mInFrustum = true; // If the face is important to the camera, it is in the frustum
mCloseToCamera = true;
// </FS:minerjr> [FIRE-35081]
}
else
{
mImportanceToCamera = LLFace::calcImportanceToCamera(cos_angle_to_view_dir, dist) ;
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
mInFrustum = bool(mImportanceToCamera); // If the face is important to the camera, it is in the frustum
// </FS:minerjr> [FIRE-35081]
}
return true ;
@ -2544,12 +2560,6 @@ F32 LLFace::adjustPartialOverlapPixelArea(F32 cos_angle_to_view_dir, F32 radius
return 1.0f ;
}
const S8 FACE_IMPORTANCE_LEVEL = 4 ;
const F32 FACE_IMPORTANCE_TO_CAMERA_OVER_DISTANCE[FACE_IMPORTANCE_LEVEL][2] = //{distance, importance_weight}
{{16.1f, 1.0f}, {32.1f, 0.5f}, {48.1f, 0.2f}, {96.1f, 0.05f} } ;
const F32 FACE_IMPORTANCE_TO_CAMERA_OVER_ANGLE[FACE_IMPORTANCE_LEVEL][2] = //{cos(angle), importance_weight}
{{0.985f /*cos(10 degrees)*/, 1.0f}, {0.94f /*cos(20 degrees)*/, 0.8f}, {0.866f /*cos(30 degrees)*/, 0.64f}, {0.0f, 0.36f}} ;
//static
F32 LLFace::calcImportanceToCamera(F32 cos_angle_to_view_dir, F32 dist)
{
@ -2570,7 +2580,10 @@ F32 LLFace::calcImportanceToCamera(F32 cos_angle_to_view_dir, F32 dist)
}
S32 i = 0 ;
for(i = 0; i < FACE_IMPORTANCE_LEVEL && dist > FACE_IMPORTANCE_TO_CAMERA_OVER_DISTANCE[i][0]; ++i);
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
// Added draw distance multiplier to the distance
for(i = 0; i < FACE_IMPORTANCE_LEVEL && dist > FACE_IMPORTANCE_TO_CAMERA_OVER_DISTANCE[i][0] * camera->getDrawDistanceMultiplier(); ++i);
// </FS:minerjr> [FIRE-35081]
i = llmin(i, FACE_IMPORTANCE_LEVEL - 1) ;
F32 dist_factor = FACE_IMPORTANCE_TO_CAMERA_OVER_DISTANCE[i][1] ;

View File

@ -127,6 +127,8 @@ public:
void setPixelArea(F32 area) { mPixelArea = area; }
F32 getVirtualSize() const { return mVSize; }
F32 getPixelArea() const { return mPixelArea; }
F32 getImportanceToCamera() const { return mImportanceToCamera; }
F32 getCloseToCamera() const { return mCloseToCamera; }
S32 getIndexInTex(U32 ch) const { llassert(ch < LLRender::NUM_TEXTURE_CHANNELS); return mIndexInTex[ch]; }
void setIndexInTex(U32 ch, S32 index) { llassert(ch < LLRender::NUM_TEXTURE_CHANNELS); mIndexInTex[ch] = index; }
@ -333,6 +335,7 @@ private:
//1.0: the most important.
//based on the distance from the face to the view point and the angle from the face center to the view direction.
F32 mImportanceToCamera ;
F32 mCloseToCamera;
F32 mBoundingSphereRadius ;
bool mHasMedia ;
bool mIsMediaAllowed;

View File

@ -69,7 +69,6 @@ LLViewerCamera::LLViewerCamera() : LLCamera()
mCameraFOVDefault = DEFAULT_FIELD_OF_VIEW;
mPrevCameraFOVDefault = DEFAULT_FIELD_OF_VIEW;
mCosHalfCameraFOV = cosf(mCameraFOVDefault * 0.5f);
mCosCameraFOV = cosf(mCameraFOVDefault);
mPixelMeterRatio = 0.f;
mScreenPixelArea = 0;
mZoomFactor = 1.f;
@ -144,10 +143,6 @@ void LLViewerCamera::updateCameraLocation(const LLVector3 &center, const LLVecto
mAverageSpeed = (F32)LLTrace::get_frame_recording().getPeriodMeanPerSec(sVelocityStat, 50);
mAverageAngularSpeed = (F32)LLTrace::get_frame_recording().getPeriodMeanPerSec(sAngularVelocityStat);
mCosHalfCameraFOV = cosf(0.5f * getView() * llmax(1.0f, getAspect()));
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
// Store the full Cos FOV value
mCosCameraFOV = cosf(getView() * llmax(1.0f, getAspect()));
// </FS:minerjr> [FIRE-35081]
// update pixel meter ratio using default fov, not modified one
mPixelMeterRatio = (F32)(getViewHeightInPixels()/ (2.f*tanf(mCameraFOVDefault*0.5f)));
@ -827,9 +822,6 @@ void LLViewerCamera::setDefaultFOV(F32 vertical_fov_rads)
setView(vertical_fov_rads);
mCameraFOVDefault = vertical_fov_rads;
mCosHalfCameraFOV = cosf(mCameraFOVDefault * 0.5f);
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
mCosCameraFOV = cosf(mCameraFOVDefault);
// </FS:minerjr> [FIRE-35081]
}
bool LLViewerCamera::isDefaultFOVChanged()

View File

@ -81,7 +81,6 @@ public:
static LLTrace::CountStatHandle<>* getVelocityStat() {return &sVelocityStat; }
static LLTrace::CountStatHandle<>* getAngularVelocityStat() {return &sAngularVelocityStat; }
F32 getCosHalfFov() {return mCosHalfCameraFOV;}
F32 getCosFov() {return mCosCameraFOV;}
F32 getAverageSpeed() {return mAverageSpeed ;}
F32 getAverageAngularSpeed() {return mAverageAngularSpeed;}
@ -121,10 +120,6 @@ protected:
F32 mCameraFOVDefault;
F32 mPrevCameraFOVDefault;
F32 mCosHalfCameraFOV;
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
// Store the Cos of the full FOV
F32 mCosCameraFOV;
// </FS:minerjr> [FIRE-35081]
LLVector3 mLastPointOfInterest;
F32 mPixelMeterRatio; // Divide by distance from camera to get pixels per meter at that distance.
S32 mScreenPixelArea; // Pixel area of entire window

View File

@ -128,6 +128,7 @@
#include "llviewerparcelmgr.h"
#include "llviewerstats.h"
#include "llviewerstatsrecorder.h"
#include "llviewertexturelist.h"
#include "llvlcomposition.h"
#include "llvoavatarself.h"
#include "llvoicevivox.h"
@ -12784,6 +12785,9 @@ void initialize_menus()
// Develop (Fonts debugging)
commit.add("Develop.Fonts.Dump", boost::bind(&LLFontGL::dumpFonts));
commit.add("Develop.Fonts.DumpTextures", boost::bind(&LLFontGL::dumpFontTextures));
//Develop (dump data)
commit.add("Develop.TextureList.Dump", boost::bind(&LLViewerTextureList::dumpTexturelist));
// <FS:Beq/> Add telemetry controls to the viewer Develop menu (Toggle profiling)
view_listener_t::addMenu(new FSProfilerToggle(), "Develop.ToggleProfiling");

View File

@ -1178,6 +1178,9 @@ void LLViewerFetchedTexture::init(bool firstinit)
mKeptSavedRawImageTime = 0.f;
mLastCallBackActiveTime = 0.f;
mForceCallbackFetch = false;
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
mCloseToCamera = 0.0f; // Store if the camera is close to the camera (0.0f or 1.0f)
// </FS:minerjr> [FIRE-35081]
mFTType = FTT_UNKNOWN;
}
@ -3053,7 +3056,11 @@ void LLViewerLODTexture::processTextureStats()
else if (mBoostLevel < LLGLTexture::BOOST_HIGH && mMaxVirtualSize <= 10.f)
{
// If the image has not been significantly visible in a while, we don't want it
mDesiredDiscardLevel = llmin(mMinDesiredDiscardLevel, (S8)(MAX_DISCARD_LEVEL + 1));
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
//mDesiredDiscardLevel = llmin(mMinDesiredDiscardLevel, (S8)(MAX_DISCARD_LEVEL + 1));
// Off screen textures at 6 would not downscale.
mDesiredDiscardLevel = llmin(mMinDesiredDiscardLevel, (S8)(MAX_DISCARD_LEVEL));
// </FS:minerjr> [FIRE-35081]
mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, (S32)mLoadedCallbackDesiredDiscardLevel);
}
else if (!mFullWidth || !mFullHeight)
@ -3063,6 +3070,8 @@ void LLViewerLODTexture::processTextureStats()
}
else
{
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
/*
//static const F64 log_2 = log(2.0);
static const F64 log_4 = log(4.0);
@ -3090,10 +3099,28 @@ void LLViewerLODTexture::processTextureStats()
discard_level = floorf(discard_level);
F32 min_discard = 0.f;
if (mFullWidth > max_tex_res || mFullHeight > max_tex_res)
min_discard = 1.f;
*/
discard_level = llclamp(discard_level, min_discard, (F32)MAX_DISCARD_LEVEL);
// Use a S32 value for the discard level
S32 discard_level = 0;
// Find the best discard that covers the entire mMaxVirtualSize of the on screen texture
for (; discard_level <= MAX_DISCARD_LEVEL; discard_level++)
{
// If the max virtual size is greater then the current discard level, then break out of the loop and use the current discard level
if (mMaxVirtualSize > getWidth(discard_level) * getHeight(discard_level))
{
break;
}
}
// Use a S32 instead of a float
S32 min_discard = 0;
if (mFullWidth > max_tex_res || mFullHeight > max_tex_res)
min_discard = 1;
//discard_level = llclamp(discard_level, min_discard, (F32)MAX_DISCARD_LEVEL);
discard_level = llclamp(discard_level, min_discard, MAX_DISCARD_LEVEL); // Don't convert to float and back again
// </FS:minerjr> [FIRE-35081]
// Can't go higher than the max discard level
mDesiredDiscardLevel = llmin(getMaxDiscardLevel() + 1, (S32)discard_level);

View File

@ -437,6 +437,11 @@ public:
void setInFastCacheList(bool in_list) { mInFastCacheList = in_list; }
bool isInFastCacheList() { return mInFastCacheList; }
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
F32 getCloseToCamera() const {return mCloseToCamera ;} // Get close to camera value
void setCloseToCamera(F32 value) {mCloseToCamera = value ;} // Set the close to camera value (0.0f or 1.0f)
// </FS:minerjr> [FIRE-35081]
/*virtual*/bool isActiveFetching() override; //is actively in fetching by the fetching pipeline.
virtual bool scaleDown() { return false; };
@ -537,6 +542,9 @@ protected:
bool mForSculpt ; //a flag if the texture is used as sculpt data.
bool mIsFetched ; //is loaded from remote or from cache, not generated locally.
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
F32 mCloseToCamera; // Float (0.0f or 1.0f) to indicate if the texture is close to the camera
// </FS:minerjr> [FIRE-35081]
public:
static F32 sMaxVirtualSize; //maximum possible value of mMaxVirtualSize

View File

@ -371,11 +371,28 @@ void LLViewerTextureList::shutdown()
mInitialized = false ; //prevent loading textures again.
}
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
// static
// Allows the menu to call the dump method of the texture list
void LLViewerTextureList::dumpTexturelist()
{
gTextureList.dump();
}
// </FS:minerjr> [FIRE-35081]
void LLViewerTextureList::dump()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
LL_INFOS() << "LLViewerTextureList::dump()" << LL_ENDL;
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
S32 texture_count = 0;
S32 textures_close_to_camera = 0;
S32 image_counts[MAX_DISCARD_LEVEL + 1];
for (S32 index = 0; index <= MAX_DISCARD_LEVEL; index++)
{
image_counts[index] = 0;
}
// </FS:minerjr> [FIRE-35081]
for (image_list_t::iterator it = mImageList.begin(); it != mImageList.end(); ++it)
{
LLViewerFetchedTexture* image = *it;
@ -385,9 +402,28 @@ void LLViewerTextureList::dump()
<< " size " << image->getWidth() << "x" << image->getHeight()
<< " discard " << image->getDiscardLevel()
<< " desired " << image->getDesiredDiscardLevel()
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
<< " close to camera " << (image->getCloseToCamera() > 0.0f ? "Y" : "N") // Display the close to camera flag
<< " FFType " << fttype_to_string(image->getFTType()) // Display the FFType of the camera
<< " Type " << (S32)image->getType() // Display the type of the image (LOCAL_TEXTURE = 0, MEDIA_TEXTURE = 1, DYNAMIC_TEXTURE = 2, FETCHED_TEXTURE = 3,LOD_TEXTURE = 4)
// </FS:minerjr> [FIRE-35081]
<< " http://asset.siva.lindenlab.com/" << image->getID() << ".texture"
<< LL_ENDL;
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
image_counts[image->getDiscardLevel()] += 1;
texture_count++;
textures_close_to_camera += S32(image->getCloseToCamera());
// </FS:minerjr> [FIRE-35081]
}
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
// Add overal texture totals
LL_INFOS() << "Texture Stats: Textures in Close to Camera " << textures_close_to_camera << " of " << texture_count << " : " << LL_ENDL;
for (S32 index = 0; index <= MAX_DISCARD_LEVEL; index++)
{
LL_INFOS() << " Discard Level: " << index << " Number of Textures: " << image_counts[index] << LL_ENDL;
}
// </FS:minerjr> [FIRE-35081]
}
void LLViewerTextureList::destroyGL()
@ -942,12 +978,13 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag
bool current_on_screen = false;
F32 vsize = 0.0f; // Moved outside the loop to save reallocation every loop
F32 important_to_camera = 0.0f;
F32 close_to_camera = 0.0f; // Track if the texture is close to the cameras
F64 animated = 0; // U64 used to track if a pointer is set for the animations. (The texture matrix of the face is null if no animation assigned to the texture)
// So if you keep adding and the final result is 0, there is no animation
// </FS:minerjr> [FIRE-35081]
// boost resolution of textures that are important to the camera
// Can instead of using max for a min of 1.0, just subtract 1 from the boost and just do a 1 + (TextureCameraBoost - 1) * importanceToCamera)
static LLCachedControl<F32> texture_camera_boost(gSavedSettings, "TextureCameraBoost", 7.f);
static LLCachedControl<F32> texture_camera_boost(gSavedSettings, "TextureCameraBoost", 7.f);
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
for (U32 i = 0; i < LLRender::NUM_TEXTURE_CHANNELS; ++i)
{
@ -1026,9 +1063,14 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag
// Lerp instead of doing conditional input
// If the image is import to the camera, even a little then make the on screen true
on_screen_count += S32(important_to_camera * 1000.0f);
vsize = vsize + (vsize * (1.0f + important_to_camera * texture_camera_boost) - vsize) * F32(current_on_screen);
//vsize = vsize + (vsize * (1.0f + important_to_camera * texture_camera_boost) - vsize) * F32(current_on_screen);
// Apply boost of size based upon importance to camera
vsize = vsize + (vsize * important_to_camera * texture_camera_boost);
// Apply second boost based upon if the texture is close to the camera (< 16.1 meters * draw distance multiplier)
vsize = vsize + (vsize * face->mCloseToCamera * texture_camera_boost);
// Update the max on screen vsize based upon the on screen vsize
close_to_camera += face->mCloseToCamera;
LL_DEBUGS() << "" << imagep->getID() << " " << imagep->getNumFaces(i) << " OS Vsize: " << vsize << " Vsize: " << (vsize * bias) << " CTC: " << face->mCloseToCamera << LL_ENDL;
max_on_screen_vsize = llmax(max_on_screen_vsize, vsize);
max_vsize = llmax(max_vsize, vsize * bias);
// </FS:minerjr> [FIRE-35081]
@ -1039,7 +1081,8 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
// Replaced all the checks for this bool to be only in this 1 place instead of in the loop.
// If the on screen counter is greater then 0, then there was at least 1 on screen texture
on_screen = bool(on_screen_count);
on_screen = bool(on_screen_count);
imagep->setCloseToCamera(close_to_camera > 0.0f ? 1.0f : 0.0f);
//if (face_count > 1024)
// Add check for if the image is animated to boost to high as well
@ -1078,16 +1121,25 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag
imagep->addTextureStats(max_on_screen_vsize);
}
// If the boost level just became high, or the texture is (Local, Media Dynamic)
else if (imagep->getBoostLevel() == LLViewerTexture::BOOST_HIGH || imagep->getType() < LLViewerTexture::FETCHED_TEXTURE)
else if (imagep->getBoostLevel() == LLViewerTexture::BOOST_HIGH || imagep->getType() < LLViewerTexture::FETCHED_TEXTURE || close_to_camera)
{
// Always use the best quality of the texture
imagep->addTextureStats(max_on_screen_vsize);
}
// All other texture cases will use max_vsize with bias applied.
else
{
{
imagep->addTextureStats(max_vsize);
}
U32 max_tex_res = LLGLTexture::MAX_IMAGE_SIZE_DEFAULT;
if (imagep->getBoostLevel() < LLGLTexture::BOOST_HIGH)
{
// restrict texture resolution to download based on RenderMaxTextureResolution
static LLCachedControl<U32> max_texture_resolution(gSavedSettings, "RenderMaxTextureResolution", 2048);
// sanity clamp debug setting to avoid settings hack shenanigans
max_tex_res = (U32)llclamp((U32)max_texture_resolution, 512, LLGLTexture::MAX_IMAGE_SIZE_DEFAULT);
imagep->mMaxVirtualSize = llmin(imagep->mMaxVirtualSize, (F32)(max_tex_res * max_tex_res));
}
// </FS:minerjr> [FIRE-35081]
}

View File

@ -111,6 +111,9 @@ public:
static void receiveImageHeader(LLMessageSystem *msg, void **user_data);
static void receiveImagePacket(LLMessageSystem *msg, void **user_data);
// </FS:Ansariel>
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
static void dumpTexturelist(); // Added code to handle dumping texture information
// </FS:minerjr> [FIRE-35081]
public:
LLViewerTextureList();

View File

@ -2275,12 +2275,23 @@ F32 LLPipeline::calcPixelArea(LLVector3 center, LLVector3 size, LLCamera &camera
//ramp down distance for nearby objects
//shrink dist by dist/16.
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
/*
if (dist < 16.f)
{
dist /= 16.f;
dist *= dist;
dist *= 16.f;
}
*/
// Applied the camera draw distance multiplier to the distance similar to the textures
if (dist < 16.f * camera.getDrawDistanceMultiplier())
{
dist /= 16.f * camera.getDrawDistanceMultiplier();
dist *= dist;
dist *= 16.f * camera.getDrawDistanceMultiplier();
}
// </FS:minerjr> [FIRE-35081]
//get area of circle around node
F32 app_angle = atanf(size.length()/dist);
@ -2300,12 +2311,23 @@ F32 LLPipeline::calcPixelArea(const LLVector4a& center, const LLVector4a& size,
//ramp down distance for nearby objects
//shrink dist by dist/16.
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
/*
if (dist < 16.f)
{
dist /= 16.f;
dist *= dist;
dist *= 16.f;
dist /= 16.f;
dist *= dist;
dist *= 16.f;
}
*/
// Applied the camera draw distance multiplier to the distance similar to the textures
if (dist < 16.f * camera.getDrawDistanceMultiplier())
{
dist /= 16.f * camera.getDrawDistanceMultiplier();
dist *= dist;
dist *= 16.f * camera.getDrawDistanceMultiplier();
}
// </FS:minerjr> [FIRE-35081]
//get area of circle around node
F32 app_angle = atanf(size.getLength3().getF32() / dist);
@ -8082,7 +8104,7 @@ bool LLPipeline::renderSnapshotFrame(LLRenderTarget* src, LLRenderTarget* dst)
{
float frame_width = w;
float frame_height = frame_width / snapshot_aspect;
// Centre this box in [0..1]×[0..1]
// Centre this box in [0..1]<EFBFBD>[0..1]
float y_offset = 0.5f * (h - frame_height);
left = 0.f;
top = y_offset / h;
@ -8093,7 +8115,7 @@ bool LLPipeline::renderSnapshotFrame(LLRenderTarget* src, LLRenderTarget* dst)
{
float frame_height = h;
float frame_width = h * snapshot_aspect;
// Centre this box in [0..1]×[0..1]
// Centre this box in [0..1]<EFBFBD>[0..1]
float x_offset = 0.5f * (w - frame_width);
left = x_offset / w;
top = 0.f;

View File

@ -5761,6 +5761,20 @@
<menu_item_check.on_click
function="Advanced.ToggleViewAdminOptions" />
</menu_item_check>
<menu_item_separator/>
<menu
create_jump_keys="true"
label="Dump"
name="Dump"
tear_off="true">
<menu_item_call
label="LLViewerTexturelist"
name="LLViewerTexturelist">
<menu_item_call.on_click
function="Develop.TextureList.Dump" />
</menu_item_call>
</menu>
</menu>
<menu
create_jump_keys="true"