We had that in the forum some time ago but with self-contained lua objects ... the dummy object would just load its sub-parts like you do too :
--Load all the parts for the models
--
object.mezzHouse_parts01_groof =LoadModel("abstract::gTown_smallBlock_mezzHouse_parts01_groof.gmf")
object.mezzHouse_parts01_gfloor=LoadModel("abstract::gTown_smallBlock_mezzHouse_parts01_gfloor.gmf")
object.mezzHouse_parts01_gwalls_1=LoadModel("abstract::gTown_smallBlock_mezzHouse_parts01_gwalls_1.gmf")
object.mezzHouse_parts01_gwalls_2=LoadModel("abstract::gTown_smallBlock_mezzHouse_parts01_gwalls_2.gmf")
but since all loaded models can have its own lua script we made a simple camera-distance check to repaint the part in question with a transparent material like :
if fw~=nil then
object.model:Hide()
-- pick1 = LinePick(campos, camera.position, 1, nil)
pick2 = CameraPick(camera,Vec3(GraphicsWidth()/2,GraphicsHeight()/2, 20.0),0,0)
object.model:Show()
-- if pick1~=nil then SetWorld(fw.main.world) end
if pick2~=nil then
SetWorld(fw.transparency.world)
object.model:Paint(LoadMaterial("abstract::dirtyglass2.mat"), 1)
SetWorld(fw.main.world)
else
-- [fixme] rePaint original material ...
-- and scale materials alpha value by distance (glFragData.w)
object.model:Paint(LoadMaterial("abstract::gTown_1_1024.mat"), 1)
end
end
... the issue which came up was that lights and skinned models are occlussion culled by default and "cant" deal with this way of half-transparency. A real shader for this might work however if you push the object in question into the transparent world.