mirror of
https://github.com/lubosz/overte.git
synced 2025-08-19 12:03:20 +02:00
Fixing the missing field for blender translucent map
This commit is contained in:
parent
3c075532f8
commit
3274df9923
3 changed files with 14 additions and 5 deletions
|
@ -1098,8 +1098,9 @@ FBXGeometry* FBXReader::extractFBXGeometry(const QVariantHash& mapping, const QS
|
||||||
diffuseTextures.insert(getID(connection.properties, 2), getID(connection.properties, 1));
|
diffuseTextures.insert(getID(connection.properties, 2), getID(connection.properties, 1));
|
||||||
} else if (type.contains("tex_color_map")) {
|
} else if (type.contains("tex_color_map")) {
|
||||||
diffuseTextures.insert(getID(connection.properties, 2), getID(connection.properties, 1));
|
diffuseTextures.insert(getID(connection.properties, 2), getID(connection.properties, 1));
|
||||||
} else if (type.contains("transparentcolor")) { // it should be TransparentColor...
|
} else if (type.contains("transparentcolor")) { // Maya way of passing TransparentMap
|
||||||
// THis is how Maya assign a texture that affect diffuse color AND transparency ?
|
transparentTextures.insert(getID(connection.properties, 2), getID(connection.properties, 1));
|
||||||
|
} else if (type.contains("transparencyfactor")) { // Blender way of passing TransparentMap
|
||||||
transparentTextures.insert(getID(connection.properties, 2), getID(connection.properties, 1));
|
transparentTextures.insert(getID(connection.properties, 2), getID(connection.properties, 1));
|
||||||
} else if (type.contains("bump")) {
|
} else if (type.contains("bump")) {
|
||||||
bumpTextures.insert(getID(connection.properties, 2), getID(connection.properties, 1));
|
bumpTextures.insert(getID(connection.properties, 2), getID(connection.properties, 1));
|
||||||
|
|
|
@ -102,16 +102,20 @@ void FBXReader::consolidateFBXMaterials() {
|
||||||
detectDifferentUVs = (diffuseTexture.texcoordSet != 0) || (!diffuseTexture.transform.isIdentity());
|
detectDifferentUVs = (diffuseTexture.texcoordSet != 0) || (!diffuseTexture.transform.isIdentity());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FBXTexture transparentTexture;
|
FBXTexture transparentTexture;
|
||||||
QString transparentTextureID = transparentTextures.value(material.materialID);
|
QString transparentTextureID = transparentTextures.value(material.materialID);
|
||||||
|
// If PBS Material, systematically bind the albedo texture as transparency texture and check for the alpha channel
|
||||||
|
if (material.isPBSMaterial) {
|
||||||
|
transparentTextureID = diffuseTextureID;
|
||||||
|
}
|
||||||
if (!transparentTextureID.isNull()) {
|
if (!transparentTextureID.isNull()) {
|
||||||
transparentTexture = getTexture(transparentTextureID);
|
transparentTexture = getTexture(transparentTextureID);
|
||||||
|
|
||||||
material.opacityTexture = transparentTexture;
|
material.opacityTexture = transparentTexture;
|
||||||
detectDifferentUVs |= (transparentTexture.texcoordSet != 0) || (!transparentTexture.transform.isIdentity());
|
detectDifferentUVs |= (transparentTexture.texcoordSet != 0) || (!transparentTexture.transform.isIdentity());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FBXTexture normalTexture;
|
FBXTexture normalTexture;
|
||||||
QString bumpTextureID = bumpTextures.value(material.materialID);
|
QString bumpTextureID = bumpTextures.value(material.materialID);
|
||||||
QString normalTextureID = normalTextures.value(material.materialID);
|
QString normalTextureID = normalTextures.value(material.materialID);
|
||||||
|
|
|
@ -84,8 +84,12 @@ void Material::setMetallic(float metallic) {
|
||||||
void Material::setTextureMap(MapChannel channel, const TextureMapPointer& textureMap) {
|
void Material::setTextureMap(MapChannel channel, const TextureMapPointer& textureMap) {
|
||||||
if (textureMap) {
|
if (textureMap) {
|
||||||
_key.setMapChannel(channel, (true));
|
_key.setMapChannel(channel, (true));
|
||||||
|
|
||||||
if (channel == MaterialKey::ALBEDO_MAP) {
|
if (channel == MaterialKey::ALBEDO_MAP) {
|
||||||
|
// clear the previous flags whatever they were:
|
||||||
|
_key.setOpacityMaskMap(false);
|
||||||
|
_key.setTranslucentMap(false);
|
||||||
|
|
||||||
if (textureMap->useAlphaChannel()) {
|
if (textureMap->useAlphaChannel()) {
|
||||||
if (textureMap->isDefined()) {
|
if (textureMap->isDefined()) {
|
||||||
if (textureMap->getTextureView().isValid()) {
|
if (textureMap->getTextureView().isValid()) {
|
||||||
|
|
Loading…
Reference in a new issue