public IMaterialSettings Import(int surfaceIdx, MaterialBag bag) { string uvSet = bag.ExtractUvSetName(figure); var textureImporter = TextureImporter.Make(textureProcessor, figure, uvSet, surfaceIdx); var diffuseTexture = textureImporter.ImportColorTexture(bag.ExtractColorTexture("diffuse")); FloatTexture opacityTexture; if (bag.HasExtraType(MaterialBag.DazBrickType) || bag.HasExtraType(MaterialBag.IrayUberType)) { var rawOpacityTexture = bag.ExtractFloatTexture("extra/studio_material_channels/channels/Cutout Opacity"); opacityTexture = textureImporter.ImportFloatTexture(rawOpacityTexture); faceTransparencyProcessor.ProcessSurface(surfaceIdx, uvSet, rawOpacityTexture); } else { opacityTexture = new FloatTexture { value = 1, image = null }; } return(new HairMaterialSettings { uvSet = uvSet, diffuseAlbedo = diffuseTexture, opacity = opacityTexture }); }
private RawUberMaterialSettings ImportRaw(MaterialBag bag) { RawUberMaterialSettings settings = new RawUberMaterialSettings { }; settings.uvSet = bag.ExtractUvSetName(figure); settings.baseMixing = bag.ExtractInteger("extra/studio_material_channels/channels/Base Mixing"); //Base / Diffuse / Reflection settings.metallicWeight = bag.ExtractFloatTexture("extra/studio_material_channels/channels/Metallic Weight"); settings.diffuseWeight = bag.ExtractFloatTexture("extra/studio_material_channels/channels/Diffuse Weight"); settings.baseColor = bag.ExtractColorTexture("diffuse"); //Base / Diffuse / Translucency settings.translucencyWeight = bag.ExtractFloatTexture("extra/studio_material_channels/channels/Translucency Weight"); settings.baseColorEffect = bag.ExtractInteger("extra/studio_material_channels/channels/Base Color Effect"); settings.translucencyColor = bag.ExtractColorTexture("extra/studio_material_channels/channels/Translucency Color"); settings.sssReflectanceTint = bag.ExtractColor("extra/studio_material_channels/channels/SSS Reflectance Tint"); //Base / Glossy / Reflection settings.glossyWeight = bag.ExtractFloatTexture("extra/studio_material_channels/channels/Glossy Weight"); settings.glossyLayeredWeight = bag.ExtractFloatTexture("extra/studio_material_channels/channels/Glossy Layered Weight"); settings.glossyColor = bag.ExtractColorTexture("extra/studio_material_channels/channels/Glossy Color"); settings.glossyColorEffect = bag.ExtractInteger("extra/studio_material_channels/channels/Glossy Color Effect"); settings.glossyReflectivity = bag.ExtractFloatTexture("extra/studio_material_channels/channels/Glossy Reflectivity"); settings.glossySpecular = bag.ExtractColorTexture("extra/studio_material_channels/channels/Glossy Specular"); settings.glossyRoughness = bag.ExtractFloatTexture("extra/studio_material_channels/channels/Glossy Roughness"); settings.glossiness = bag.ExtractFloatTexture("extra/studio_material_channels/channels/Glossiness"); //Base / Glossy / Refraction settings.refractionIndex = bag.ExtractFloat("extra/studio_material_channels/channels/Refraction Index"); settings.refractionWeight = bag.ExtractFloatTexture("extra/studio_material_channels/channels/Refraction Weight"); //Base / Bump settings.bumpStrength = bag.ExtractFloatTexture("extra/studio_material_channels/channels/Bump Strength"); settings.normalMap = bag.ExtractFloatTexture("extra/studio_material_channels/channels/Normal Map"); //Top Coat settings.topCoatWeight = bag.ExtractFloatTexture("extra/studio_material_channels/channels/Top Coat Weight"); settings.topCoatColor = bag.ExtractColorTexture("extra/studio_material_channels/channels/Top Coat Color"); settings.topCoatColorEffect = bag.ExtractInteger("extra/studio_material_channels/channels/Top Coat Color Effect"); settings.topCoatRoughness = bag.ExtractFloatTexture("extra/studio_material_channels/channels/Top Coat Roughness"); settings.topCoatGlossiness = bag.ExtractFloatTexture("extra/studio_material_channels/channels/Top Coat Glossiness"); settings.topCoatLayeringMode = bag.ExtractInteger("extra/studio_material_channels/channels/Top Coat Layering Mode"); settings.topCoatReflectivity = bag.ExtractFloatTexture("extra/studio_material_channels/channels/Reflectivity"); settings.topCoatIor = bag.ExtractFloatTexture("extra/studio_material_channels/channels/Top Coat IOR"); settings.topCoatCurveNormal = bag.ExtractFloatTexture("extra/studio_material_channels/channels/Top Coat Curve Normal"); settings.topCoatCurveGrazing = bag.ExtractFloatTexture("extra/studio_material_channels/channels/Top Coat Curve Grazing"); //Top Coat / Bump settings.topCoatBumpMode = bag.ExtractInteger("extra/studio_material_channels/channels/Top Coat Bump Mode"); settings.topCoatBump = bag.ExtractFloatTexture("extra/studio_material_channels/channels/Top Coat Bump"); //Volume settings.thinWalled = bag.ExtractBoolean("extra/studio_material_channels/channels/Thin Walled"); settings.transmittedMeasurementDistance = bag.ExtractFloat("extra/studio_material_channels/channels/Transmitted Measurement Distance"); settings.transmittedColor = bag.ExtractColor("extra/studio_material_channels/channels/Transmitted Color"); settings.scatteringMeasurementDistance = bag.ExtractFloat("extra/studio_material_channels/channels/Scattering Measurement Distance"); settings.sssAmount = bag.ExtractFloat("extra/studio_material_channels/channels/SSS Amount"); settings.sssDirection = bag.ExtractFloat("extra/studio_material_channels/channels/SSS Direction"); //Geometry / Cutout settings.cutoutOpacity = bag.ExtractFloatTexture("extra/studio_material_channels/channels/Cutout Opacity"); return(settings); }