From 71ae65ae175a33c7f60442f62b0ef59415528bf5 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Mon, 29 Aug 2022 14:06:48 -0700 Subject: SL-17703: PBR: Fix missing ORM to use 1,0,0 --- indra/newview/lldrawpoolpbropaque.cpp | 2 +- indra/newview/llviewertexture.cpp | 11 ++++++++++- indra/newview/llviewertexture.h | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/lldrawpoolpbropaque.cpp b/indra/newview/lldrawpoolpbropaque.cpp index 3930e11cf3..35beafaa40 100644 --- a/indra/newview/lldrawpoolpbropaque.cpp +++ b/indra/newview/lldrawpoolpbropaque.cpp @@ -120,7 +120,7 @@ void LLDrawPoolPBROpaque::renderDeferred(S32 pass) } else { - shader->bindTexture(LLShaderMgr::SPECULAR_MAP, LLViewerFetchedTexture::sWhiteImagep); + shader->bindTexture(LLShaderMgr::SPECULAR_MAP, LLViewerTexture::sDefaultPBRORMImagep); // ORM 1,0,0 } if (pparams->mEmissiveMap) diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index c389d2122e..3ecab2c647 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -69,6 +69,7 @@ const S32Megabytes gMaxVideoRam(512); LLPointer LLViewerTexture::sNullImagep = NULL; LLPointer LLViewerTexture::sBlackImagep = NULL; LLPointer LLViewerTexture::sCheckerBoardImagep = NULL; +LLPointer LLViewerTexture::sDefaultPBRORMImagep = NULL; // PBR: When ORM is missing use 1,0,0 LLPointer LLViewerFetchedTexture::sMissingAssetImagep = NULL; LLPointer LLViewerFetchedTexture::sWhiteImagep = NULL; LLPointer LLViewerFetchedTexture::sDefaultImagep = NULL; @@ -367,6 +368,13 @@ void LLViewerTextureManager::init() LLViewerTexture::sNullImagep = LLViewerTextureManager::getLocalTexture(raw.get(), TRUE); } + // Create Default PBR ORM Texture 1,0,0 + { + LLPointer red = new LLImageRaw(8,8,3); + red->clear(0xFF, 0x00, 0x00, 0xFF); + LLViewerTexture::sDefaultPBRORMImagep = LLViewerTextureManager::getLocalTexture(red.get(), TRUE); + } + const S32 dim = 128; LLPointer image_raw = new LLImageRaw(dim,dim,3); U8* data = image_raw->getData(); @@ -451,8 +459,9 @@ void LLViewerTextureManager::cleanup() LLImageGL::sDefaultGLTexture = NULL; LLViewerTexture::sNullImagep = NULL; LLViewerTexture::sBlackImagep = NULL; + LLViewerFetchedTexture::sDefaultPBRORMImagep = NULL; LLViewerTexture::sCheckerBoardImagep = NULL; - LLViewerFetchedTexture::sDefaultImagep = NULL; + LLViewerFetchedTexture::sDefaultImagep = NULL; LLViewerFetchedTexture::sSmokeImagep = NULL; LLViewerFetchedTexture::sMissingAssetImagep = NULL; LLTexUnit::sWhiteTexture = 0; diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index 53cf911102..89ded4ded7 100644 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -252,6 +252,7 @@ public: static LLPointer sNullImagep; // Null texture for non-textured objects. static LLPointer sBlackImagep; // Texture to show NOTHING (pure black) static LLPointer sCheckerBoardImagep; // Texture to show NOTHING (pure black) + static LLPointer sDefaultPBRORMImagep; // PBR: When ORM is missing use 1,0,0 }; -- cgit v1.2.3 From 826bd47cc1355844dea7cfc838ba5f685b91251e Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Mon, 29 Aug 2022 14:08:27 -0700 Subject: SL-17703: PBR: Fix default OMR if pbr shader compiled sans HAS_SPECULAR_MAP --- .../app_settings/shaders/class1/deferred/pbropaqueF.glsl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl index 87c1ff5517..b5c38bba04 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl @@ -104,15 +104,16 @@ void main() tnorm = normalize(tnorm.xyz); norm.xyz = normalize(tnorm.xyz); + // RGB = Occlusion, Roughness, Metal - // default values - // occlusion ? - // roughness 1.0 - // metal 1.0 + // default values, see LLViewerTexture::sDefaultPBRORMImagep + // occlusion 1.0 + // roughness 0.0 + // metal 0.0 #ifdef HAS_SPECULAR_MAP vec3 spec = texture2D(specularMap, vary_texcoord2.xy).rgb; #else - vec3 spec = vec3(1,1,1); + vec3 spec = vec3(1,0,0); #endif spec.g *= roughnessFactor; -- cgit v1.2.3