diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/app_settings/settings.xml | 11 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl | 3 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl | 31 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl | 28 | ||||
-rw-r--r-- | indra/newview/lldrawpoolpbropaque.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llface.cpp | 11 | ||||
-rw-r--r-- | indra/newview/llpanelface.cpp | 26 | ||||
-rw-r--r-- | indra/newview/llpanelprofile.cpp | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_tools_texture.xml | 2 |
9 files changed, 65 insertions, 51 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index cd33690075..9508c1dc2d 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -10558,6 +10558,17 @@ <key>Value</key> <integer>0</integer> </map> + <key>RenderUseMikktSpace</key> + <map> + <key>Comment</key> + <string>Use Mikkt Space tangents on GLTF materials.</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> <key>RenderUseTriStrips</key> <map> <key>Comment</key> diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl index 67f4c59c3f..51afda2791 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl @@ -41,6 +41,7 @@ uniform sampler2D specularMap; VARYING vec2 vary_texcoord0; vec3 linear_to_srgb(vec3 c); +vec2 encode_normal (vec3 n); void main() { @@ -56,5 +57,5 @@ void main() frag_data[0] = vec4(col.rgb, 0.0); frag_data[1] = spec; - frag_data[2] = norm; // TODO: Should .w be set? + frag_data[2] = vec4(encode_normal(norm.xyz),0,GBUFFER_FLAG_HAS_ATMOS); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl index 7a13abc7e8..69019667de 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl @@ -42,6 +42,8 @@ uniform vec3 emissiveColor; #ifdef HAS_NORMAL_MAP uniform sampler2D bumpMap; + VARYING vec3 vary_tangent; + flat in float vary_sign; #endif #ifdef HAS_EMISSIVE_MAP @@ -66,9 +68,6 @@ VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; #ifdef HAS_NORMAL_MAP VARYING vec3 vary_normal; -VARYING vec3 vary_mat0; -VARYING vec3 vary_mat1; -VARYING vec3 vary_mat2; VARYING vec2 vary_texcoord1; #endif @@ -94,21 +93,14 @@ void main() vec3 col = vertex_color.rgb * albedo.rgb; -#ifdef HAS_NORMAL_MAP - vec4 norm = texture2D(bumpMap, vary_texcoord1.xy); - norm.xyz = normalize(norm.xyz * 2 - 1); + // from mikktspace.com + vec4 vNt = texture2D(bumpMap, vary_texcoord1.xy)*2.0-1.0; + float sign = vary_sign; + vec3 vN = vary_normal; + vec3 vT = vary_tangent.xyz; - vec3 tnorm = vec3(dot(norm.xyz,vary_mat0), - dot(norm.xyz,vary_mat1), - dot(norm.xyz,vary_mat2)); -#else - vec4 norm = vec4(0,0,0,1.0); -// vec3 tnorm = vary_normal; - vec3 tnorm = vec3(0,0,1); -#endif - - tnorm = normalize(tnorm.xyz); - norm.xyz = tnorm.xyz; + vec3 vB = sign * cross(vN, vT); + vec3 tnorm = normalize( vNt.x * vT + vNt.y * vB + vNt.z * vN ); // RGB = Occlusion, Roughness, Metal // default values, see LLViewerTexture::sDefaultPBRORMImagep @@ -153,6 +145,11 @@ void main() col.rgb = vary_position.xyz; #endif + tnorm *= gl_FrontFacing ? 1.0 : -1.0; + + //col = vec3(0,0,0); + //emissive = vary_tangent.xyz*0.5+0.5; + //emissive = vec3(vary_sign*0.5+0.5); // See: C++: addDeferredAttachments(), GLSL: softenLightF frag_data[0] = vec4(col, 0.0); // Diffuse frag_data[1] = vec4(emissive, vertex_color.a); // PBR sRGB Emissive diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl index a2606ed771..e17d91af38 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl @@ -59,13 +59,7 @@ ATTRIBUTE vec2 texcoord0; ATTRIBUTE vec4 tangent; ATTRIBUTE vec2 texcoord1; -VARYING vec3 vary_mat0; -VARYING vec3 vary_mat1; -VARYING vec3 vary_mat2; - VARYING vec2 vary_texcoord1; -#else -VARYING vec3 vary_normal; #endif #ifdef HAS_SPECULAR_MAP @@ -75,6 +69,10 @@ VARYING vec2 vary_texcoord2; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; +VARYING vec3 vary_tangent; +flat out float vary_sign; + +VARYING vec3 vary_normal; void main() { @@ -113,9 +111,9 @@ void main() vec3 t = normalize((mat*vec4(tangent.xyz+position.xyz,1.0)).xyz-pos.xyz); vec3 b = cross(n, t)*tangent.w; - vary_mat0 = vec3(t.x, b.x, n.x); - vary_mat1 = vec3(t.y, b.y, n.y); - vary_mat2 = vec3(t.z, b.z, n.z); + //vary_mat0 = vec3(t.x, b.x, n.x); + //vary_mat1 = vec3(t.y, b.y, n.y); + //vary_mat2 = vec3(t.z, b.z, n.z); #else //HAS_NORMAL_MAP vary_normal = n; #endif //HAS_NORMAL_MAP @@ -123,12 +121,16 @@ vary_normal = n; vec3 n = normalize(normal_matrix * normal); #ifdef HAS_NORMAL_MAP vec3 t = normalize(normal_matrix * tangent.xyz); - vec3 b = cross(n,t)*tangent.w; + vary_tangent = t; + vary_sign = tangent.w; + vary_normal = n; + + //vec3 b = cross(n,t)*tangent.w; //vec3 t = cross(b,n) * binormal.w; - vary_mat0 = vec3(t.x, b.x, n.x); - vary_mat1 = vec3(t.y, b.y, n.y); - vary_mat2 = vec3(t.z, b.z, n.z); + //vary_mat0 = vec3(t.x, b.x, n.x); + //vary_mat1 = vec3(t.y, b.y, n.y); + //vary_mat2 = vec3(t.z, b.z, n.z); #else //HAS_NORMAL_MAP vary_normal = n; #endif //HAS_NORMAL_MAP diff --git a/indra/newview/lldrawpoolpbropaque.cpp b/indra/newview/lldrawpoolpbropaque.cpp index 9fc3d51cad..e1614904b4 100644 --- a/indra/newview/lldrawpoolpbropaque.cpp +++ b/indra/newview/lldrawpoolpbropaque.cpp @@ -146,6 +146,8 @@ void LLDrawPoolPBROpaque::renderDeferred(S32 pass) shader->uniform1f(LLShaderMgr::METALLIC_FACTOR, pparams->mGLTFMaterial->mMetallicFactor); shader->uniform3fv(LLShaderMgr::EMISSIVE_COLOR, 1, pparams->mGLTFMaterial->mEmissiveColor.mV); + LLGLDisable cull_face(mat->mDoubleSided ? GL_CULL_FACE : 0); + if (rigged) { if (pparams->mAvatar.notNull() && (lastAvatar != pparams->mAvatar || lastMeshId != pparams->mSkinInfo->mHash)) diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 52aacb607c..f35b4b6d91 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -2166,14 +2166,19 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, mVertexBuffer->getTangentStrider(tangent, mGeomIndex, mGeomCount, map_range); F32* tangents = (F32*) tangent.get(); - mVObjp->getVolume()->genTangents(f); + LLGLTFMaterial* gltf_mat = tep->getGLTFMaterial(); + static LLCachedControl<bool> use_mikktspace(gSavedSettings, "RenderUseMikktSpace"); + bool mikktspace = use_mikktspace && gltf_mat != nullptr; + + mVObjp->getVolume()->genTangents(f, mikktspace); LLVector4Logical mask; mask.clear(); mask.setElement<3>(); - LLVector4a* src = vf.mTangents; - LLVector4a* end = vf.mTangents+num_vertices; + LLVector4a* tbuff = mikktspace ? vf.mMikktSpaceTangents : vf.mTangents; + LLVector4a* src = tbuff; + LLVector4a* end = tbuff+num_vertices; while (src < end) { diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index c205efb436..ac4c76351d 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -188,7 +188,6 @@ BOOL LLPanelFace::postBuild() LLColorSwatchCtrl* mShinyColorSwatch; LLComboBox* mComboTexGen; - LLComboBox* mComboMatMedia; LLCheckBoxCtrl *mCheckFullbright; @@ -199,10 +198,11 @@ BOOL LLPanelFace::postBuild() setMouseOpaque(FALSE); - LLTextureCtrl* pbr_ctrl = getChild<LLTextureCtrl>("pbr_control"); + LLTextureCtrl* pbr_ctrl = findChild<LLTextureCtrl>("pbr_control"); if (pbr_ctrl) { - pbr_ctrl->setDefaultImageAssetID(LLUUID(gSavedSettings.getString("DefaultObjectTexture"))); + pbr_ctrl->setDefaultImageAssetID(LLUUID::null); + pbr_ctrl->setBlankImageAssetID(LLUUID::null); // should there be some empty default material? pbr_ctrl->setCommitCallback(boost::bind(&LLPanelFace::onCommitPbr, this, _2)); pbr_ctrl->setOnCancelCallback(boost::bind(&LLPanelFace::onCancelPbr, this, _2)); pbr_ctrl->setOnSelectCallback(boost::bind(&LLPanelFace::onSelectPbr, this, _2)); @@ -321,22 +321,22 @@ BOOL LLPanelFace::postBuild() mComboTexGen->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); } - mComboMatMedia = getChild<LLComboBox>("combobox matmedia"); - if(mComboMatMedia) + LLComboBox* combo_mat_media = findChild<LLComboBox>("combobox matmedia"); + if(combo_mat_media) { - mComboMatMedia->setCommitCallback(LLPanelFace::onCommitMaterialsMedia,this); - mComboMatMedia->selectNthItem(MATMEDIA_MATERIAL); + combo_mat_media->setCommitCallback(LLPanelFace::onCommitMaterialsMedia,this); + combo_mat_media->selectNthItem(MATMEDIA_MATERIAL); } - LLRadioGroup* radio_mat_type = getChild<LLRadioGroup>("radio_material_type"); + LLRadioGroup* radio_mat_type = findChild<LLRadioGroup>("radio_material_type"); if(radio_mat_type) { radio_mat_type->setCommitCallback(LLPanelFace::onCommitMaterialType, this); radio_mat_type->selectNthItem(MATTYPE_DIFFUSE); } - LLRadioGroup* radio_pbr_type = getChild<LLRadioGroup>("radio_pbr_type"); - if (radio_mat_type) + LLRadioGroup* radio_pbr_type = findChild<LLRadioGroup>("radio_pbr_type"); + if (radio_pbr_type) { radio_pbr_type->setCommitCallback(LLPanelFace::onCommitPbrType, this); radio_pbr_type->selectNthItem(PBRTYPE_ALBEDO); @@ -1660,7 +1660,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) clearCtrls(); // Disable non-UICtrls - LLTextureCtrl* pbr_ctrl = getChild<LLTextureCtrl>("pbr_control"); + LLTextureCtrl* pbr_ctrl = findChild<LLTextureCtrl>("pbr_control"); if (pbr_ctrl) { pbr_ctrl->setImageAssetID(LLUUID::null); @@ -2126,7 +2126,7 @@ void LLPanelFace::onSelectPbr(const LLSD& data) { LLSelectMgr::getInstance()->saveSelectedObjectTextures(); - LLTextureCtrl* pbr_ctrl = getChild<LLTextureCtrl>("pbr_control"); + LLTextureCtrl* pbr_ctrl = findChild<LLTextureCtrl>("pbr_control"); if (!pbr_ctrl) return; if (!pbr_ctrl->getTentative()) { @@ -3646,7 +3646,7 @@ void LLPanelFace::onTextureSelectionChanged(LLInventoryItem* itemp) void LLPanelFace::onPbrSelectionChanged(LLInventoryItem* itemp) { - LLTextureCtrl* pbr_ctrl = getChild<LLTextureCtrl>("pbr_control"); + LLTextureCtrl* pbr_ctrl = findChild<LLTextureCtrl>("pbr_control"); if (pbr_ctrl) { LLUUID obj_owner_id; diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index 29c9329a26..09e568e9ac 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -887,8 +887,6 @@ BOOL LLPanelProfileSecondLife::postBuild() mDiscardDescriptionChanges->setCommitCallback([this](LLUICtrl*, void*) { onDiscardDescriptionChanges(); }, nullptr); mDescriptionEdit->setKeystrokeCallback([this](LLTextEditor* caller) { onSetDescriptionDirty(); }); - getChild<LLButton>("open_notes")->setCommitCallback([this](LLUICtrl*, void*) { onOpenNotes(); }, nullptr); - mCanSeeOnlineIcon->setMouseUpCallback([this](LLUICtrl*, S32 x, S32 y, MASK mask) { onShowAgentPermissionsDialog(); }); mCantSeeOnlineIcon->setMouseUpCallback([this](LLUICtrl*, S32 x, S32 y, MASK mask) { onShowAgentPermissionsDialog(); }); mCanSeeOnMapIcon->setMouseUpCallback([this](LLUICtrl*, S32 x, S32 y, MASK mask) { onShowAgentPermissionsDialog(); }); diff --git a/indra/newview/skins/default/xui/en/panel_tools_texture.xml b/indra/newview/skins/default/xui/en/panel_tools_texture.xml index 54a00da294..9bdfff41d8 100644 --- a/indra/newview/skins/default/xui/en/panel_tools_texture.xml +++ b/indra/newview/skins/default/xui/en/panel_tools_texture.xml @@ -252,8 +252,6 @@ width="64" /> <texture_picker can_apply_immediately="true" - default_image_name="Default" - fallback_image="materials_ui_x_24.png" follows="left|top" height="80" label="PBR " |