fbxLoader = { predictMaterial = function(params) print("Predict material function") print("File Path: " .. params.fbxName) print("Material name: " .. params.fbxMaterialName) -- From FBX print("Textures: ") for k, v in ipairs(params.textures) do print(" * " .. v) end if string.match( params.fbxMaterialName,"PNOUA$") then return "::physical_nrml_map_op_uv1_ao_op_mask.mat.lua" elseif string.match( params.fbxMaterialName,"PNOL$") then return "::physical_nrml_map_op_uv1_ao_light.mat.lua" end -- return "::physical_nrml_map_op_uv1_ao_light.mat.lua" end, overrideProperties = function(params) print("Override material properties function") print("File Path: " .. params.fbxName) print("Material name: " .. params.fbxMaterialName) -- From FBX -- From FBX print("Material type: " .. params.materialType) --use this for specific changes fore lods for k, v in pairs(params.properties) do print(" * " .. k) print(" " .. tostring(v)) end if params.properties.map_id then params.properties.map_id = { fragmentProperties = { }, fragmentSamplers = { idTex = { fileName = params.fbxPath .. "/".. params.fbxName .."id.tga", type = "TWOD", magFilter = "NEAREST", minFilter = "NEAREST_MIPMAP_NEAREST", scaleDownAllowed = true, maxDegreeOfAnisotropy = 0, }, }, vertexProperties = { }, } end if params.fbxMaterialName:match"lod2|PNL$" and params.properties.map_id then params.properties.map_id = { fragmentProperties = { }, fragmentSamplers = { idTex = { fileName = params.fbxPath .. "/".. params.fbxName .."lod_id.tga" , type = "TWOD", magFilter = "NEAREST", minFilter = "NEAREST_MIPMAP_NEAREST", scaleDownAllowed = true, maxDegreeOfAnisotropy = 0, }, }, vertexProperties = { }, } end if params.properties.map_ao then params.properties.map_ao = { fragmentProperties = { }, fragmentSamplers = { aoTex = { fileName = params.fbxPath .. "/".. params.fbxName .."ao.tga", type = "TWOD", }, }, vertexProperties = { }, } end if params.properties.map_op_2 then params.properties.map_op_2 = { fragmentProperties = { }, fragmentSamplers = { opTex2 = { fileName = "::res/textures/buildings/dirtmap2.dds", type = "TWOD", wrapS = "REPEAT", wrapT = "REPEAT", }, }, vertexProperties = { }, } end if params.properties.map_op_1 then params.properties.map_op_1 = { fragmentProperties = { }, fragmentSamplers = { opTex1 = { fileName = "::res/textures/buildings/overlay.dds", type = "TWOD", wrapS = "REPEAT", wrapT = "REPEAT", }, }, vertexProperties = { }, } end if params.properties.operation_2 then params.properties.operation_2 = { fragmentProperties = { { op = "MULTIPLICATION", mode = "OFFSET_TEXCOORD", scale = {0.2,0.2}, opacity = 0.35, }, }, fragmentSamplers = { }, vertexProperties = { }, } end if params.fbxMaterialName:match"|PNOL$" and params.properties.operation_2 then params.properties.operation_2 = { fragmentProperties = { { op = "NO_OP", }, }, fragmentSamplers = { }, vertexProperties = { }, } end if params.properties.operation_1 then params.properties.operation_1 = { fragmentProperties = { { op = "OVERLAY", mode = "OFFSET_TEXCOORD", scale = {0.04,0.04}, opacity = 0.8, }, }, fragmentSamplers = { }, vertexProperties = { }, } end if params.fbxMaterialName:match"|PNOL$" and params.properties.operation_1 then params.properties.operation_1 = { fragmentProperties = { { op = "NO_OP", }, }, fragmentSamplers = { }, vertexProperties = { }, } end if params.properties.two_sided then params.properties.two_sided = { fragmentProperties = { { twoSided = true, }, }, fragmentSamplers = { }, vertexProperties = { }, } end if params.properties.alpha_test then params.properties.alpha_test = { fragmentProperties = { { cutout = true, sorted = false, }, }, fragmentSamplers = { }, vertexProperties = { }, } end return params.properties end }