mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 18:16:45 +02:00
Trying to clena up the problem?
This commit is contained in:
parent
ec7165983d
commit
695e558851
4 changed files with 34 additions and 18 deletions
|
@ -151,7 +151,7 @@ bool NetworkGeometry::isLoadedWithTextures() const {
|
||||||
(material->lightmapTexture && !material->lightmapTexture->isLoaded())) {
|
(material->lightmapTexture && !material->lightmapTexture->isLoaded())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (material->useAlbedoMapOpacity && material->albedoTexture && material->albedoTexture->getGPUTexture()) {
|
if (/*material->useAlbedoMapOpacity && */ material->albedoTexture && material->albedoTexture->getGPUTexture()) {
|
||||||
material->_material->setTextureMap(model::MaterialKey::ALBEDO_MAP, material->_material->getTextureMap(model::MaterialKey::ALBEDO_MAP));
|
material->_material->setTextureMap(model::MaterialKey::ALBEDO_MAP, material->_material->getTextureMap(model::MaterialKey::ALBEDO_MAP));
|
||||||
// Reset the materialKey transparentTexture key only, as it is albedoTexture-dependent
|
// Reset the materialKey transparentTexture key only, as it is albedoTexture-dependent
|
||||||
const auto& usage = material->albedoTexture->getGPUTexture()->getUsage();
|
const auto& usage = material->albedoTexture->getGPUTexture()->getUsage();
|
||||||
|
|
|
@ -92,7 +92,23 @@ void Material::setTextureMap(MapChannel channel, const TextureMapPointer& textur
|
||||||
auto usage = textureMap->getTextureView()._texture->getUsage();
|
auto usage = textureMap->getTextureView()._texture->getUsage();
|
||||||
if (usage.isAlpha()) {
|
if (usage.isAlpha()) {
|
||||||
// Texture has alpha, is nut just a mask or a true transparent channel
|
// Texture has alpha, is nut just a mask or a true transparent channel
|
||||||
if (!usage.isAlphaMask()) {
|
if (usage.isAlphaMask()) {
|
||||||
|
_key.setOpacityMaskMap(true);
|
||||||
|
_key.setTranslucentMap(false);
|
||||||
|
} else {
|
||||||
|
_key.setOpacityMaskMap(false);
|
||||||
|
_key.setTranslucentMap(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (textureMap->isDefined()) {
|
||||||
|
if (textureMap->getTextureView().isValid()) {
|
||||||
|
auto usage = textureMap->getTextureView()._texture->getUsage();
|
||||||
|
if (usage.isAlpha()) {
|
||||||
|
// Texture has alpha, is nut just a mask or a true transparent channel
|
||||||
|
if (usage.isAlphaMask()) {
|
||||||
_key.setOpacityMaskMap(true);
|
_key.setOpacityMaskMap(true);
|
||||||
_key.setTranslucentMap(false);
|
_key.setTranslucentMap(false);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -39,21 +39,21 @@ float getMaterialShininess(Material m) { return 1.0 - getMaterialRoughness(m); }
|
||||||
|
|
||||||
int getMaterialKey(Material m) { return floatBitsToInt(m._spareKey.w); }
|
int getMaterialKey(Material m) { return floatBitsToInt(m._spareKey.w); }
|
||||||
|
|
||||||
const int EMISSIVE_VAL_BIT = 0x00000001;
|
const int EMISSIVE_VAL_BIT = 0x00000001;
|
||||||
const int ALBEDO_VAL_BIT = 0x00000002;
|
const int ALBEDO_VAL_BIT = 0x00000002;
|
||||||
const int METALLIC_VAL_BIT = 0x00000004;
|
const int METALLIC_VAL_BIT = 0x00000004;
|
||||||
const int GLOSSY_VAL_BIT = 0x00000008;
|
const int GLOSSY_VAL_BIT = 0x00000008;
|
||||||
const int OPACITY_VAL_BIT = 0x00000010;
|
const int OPACITY_VAL_BIT = 0x00000010;
|
||||||
|
|
||||||
const int EMISSIVE_MAP_BIT = 0x00000020;
|
const int EMISSIVE_MAP_BIT = 0x00000020;
|
||||||
const int ALBEDO_MAP_BIT = 0x00000040;
|
const int ALBEDO_MAP_BIT = 0x00000040;
|
||||||
const int OPACITY_MASK_MAP_BIT = 0x00000080;
|
const int OPACITY_MASK_MAP_BIT = 0x00000080;
|
||||||
const int OPACITY_TRANSLUCENT_MAP_BIT = 0x00000100;
|
const int OPACITY_TRANSLUCENT_MAP_BIT = 0x00000100;
|
||||||
const int METALLIC_MAP_BIT = 0x00000200;
|
const int METALLIC_MAP_BIT = 0x00000200;
|
||||||
const int ROUGHNESS_MAP_BIT = 0x00000400;
|
const int ROUGHNESS_MAP_BIT = 0x00000400;
|
||||||
const int NORMAL_MAP_BIT = 0x00001000;
|
const int NORMAL_MAP_BIT = 0x00000800;
|
||||||
const int OCCLUSION_MAP_BIT = 0x00002000;
|
const int OCCLUSION_MAP_BIT = 0x00001000;
|
||||||
const int LIGHTMAP_MAP_BIT = 0x00004000;
|
const int LIGHTMAP_MAP_BIT = 0x00002000;
|
||||||
|
|
||||||
|
|
||||||
<@endif@>
|
<@endif@>
|
||||||
|
|
|
@ -114,9 +114,9 @@ vec3 fetchLightmapMap(vec2 uv) {
|
||||||
|
|
||||||
<@func evalMaterialOpacity(fetchedOpacity, materialOpacity, matKey, opacity)@>
|
<@func evalMaterialOpacity(fetchedOpacity, materialOpacity, matKey, opacity)@>
|
||||||
{
|
{
|
||||||
const float OPACITY_MASK_THRESHOLD = 0.95;
|
const float OPACITY_MASK_THRESHOLD = 0.5;
|
||||||
<$opacity$> = (((<$matKey$> & (OPACITY_TRANSLUCENT_MAP_BIT | OPACITY_MASK_MAP_BIT)) != 0) ?
|
<$opacity$> = (((<$matKey$> & (OPACITY_TRANSLUCENT_MAP_BIT | OPACITY_MASK_MAP_BIT)) != 0) ?
|
||||||
(((<$matKey$> & OPACITY_MASK_MAP_BIT) != 0) ? step(<$fetchedOpacity$>, OPACITY_MASK_THRESHOLD) : <$fetchedOpacity$>) :
|
(((<$matKey$> & OPACITY_MASK_MAP_BIT) != 0) ? step(OPACITY_MASK_THRESHOLD, <$fetchedOpacity$>) : <$fetchedOpacity$>) :
|
||||||
1.0) * <$materialOpacity$>;
|
1.0) * <$materialOpacity$>;
|
||||||
}
|
}
|
||||||
<@endfunc@>
|
<@endfunc@>
|
||||||
|
|
Loading…
Reference in a new issue