misha.physics
Well-known member
- Joined
- Dec 22, 2021
- Messages
- 1,480
- Reaction score
- 2,211
- Points
- 128
- Location
- Lviv
- Preferred Pronouns
- he/him

MESHVIS.EXTERNAL and MESHVIS.VC are used for the mesh that contains MFDs?:
Only needs to be a seperate mshgrp. The Thunder fighter I made, extern, intern, VC and instruments are all one single mesh.Is it necessary to use a separate mesh for MFD displays? Can't we use a single mesh for external model, VC and MFDs?
Oh, you might be right! The metal shader is bound to the whole mesh (AFAIK you can activate the shader in two ways; with materials and/or setting a .cfg in the GC folder). Good that you found that, I might have ran into that a little later with the N1 project.It looks I found the reason. It's because of the *.metal map that I'm using for some other meshgroups in a mesh. But what can I do? I can't add a pure black *.rghn map for my MFD meshgroups, since they don't use a texture at all. So, the only way is using a separate mesh (for MFDs) that doesn't include any meshgroups with *.metal maps?
Yes, they're entirely black. And they work correctly if I delete all *.metal textures.So if a mesh has the metal shader active the MFD shows absoletely nothing?
You can get pretty close to the metal effect just using the _spec and _refl maps.Also, I tried to use a texture for MFDs with a pure black *.rghn map. It doesn't help. But it still works after deleting all *.metal maps.
Is it necessary to use a separate mesh for MFD displays? Can't we use a single mesh for external model, VC and MFDs?
Also, can't we see MFD information in external view even if both commandsMESHVIS.EXTERNALandMESHVIS.VCare used for the mesh that contains MFDs?:
-- Mesh
vi:add_mesh('Cirrus-SR22/Cirrus-SR22(MFDs)')
vi:set_mesh_visibility_mode(0,bit.bor(MESHVIS.EXTERNAL,MESHVIS.VC))
vi:add_mesh('Cirrus-SR22/Cirrus-SR22')
vi:set_mesh_visibility_mode(0,bit.bor(MESHVIS.EXTERNAL,MESHVIS.VC))
function clbk_loadVC(id):function clbk_loadVC(id)
local mfds =
{
pos = _R(0,0,0,0),
nmesh = 0,
ngroup = 0,
flag = 1,
nbt1 = 6,
nbt2 = 6,
bt_yofs = 1024/6,
bt_ydist = 1024/7
}
local mfdgrp = {0,1}
if id == 0 then
vi:set_cameraoffset({x=-0.49644,y=0.60708,z=1})
oapi.VC_set_neighbours(-1, 1, -1, 2)
elseif id == 1 then
vi:set_cameraoffset({x=0.49644,y=0.60708,z=1})
oapi.VC_set_neighbours(0, -1, -1, 2)
elseif id == 2 then
vi:set_cameraoffset({x=0,y=0.45,z=-1})
oapi.VC_set_neighbours(-1, -1, 0, -1)
end
for i=0, 1 do
mfds.ngroup = mfdgrp[i + 1]
oapi.register_mfd(MFDID.LEFT + i, mfds)
end
return true
end


function clbk_loadVC(id) defines the only first mesh (nmesh = 0). -- Mesh
vi:add_mesh('Cirrus-SR22/Cirrus-SR22')
vi:set_mesh_visibility_mode(0,bit.bor(MESHVIS.EXTERNAL,MESHVIS.VC))
vi:add_mesh('Cirrus-SR22/Cirrus-SR22(MFDs)')
vi:set_mesh_visibility_mode(0,bit.bor(MESHVIS.EXTERNAL,MESHVIS.VC))
nmesh = 1, in function clbk_loadVC(id), then I don't see MFDs at all.void ShuttlePB::clbkSetClassCaps (FILEHANDLE cfg)
{
...
// associate a mesh for the visual
AddMesh("ShuttlePB_pilothead");
SetMeshVisibilityMode(0, MESHVIS_EXTERNAL); // hide the pilot head when in VC mode
AddMesh("ShuttlePB_pilot");
SetMeshVisibilityMode(1, MESHVIS_ALWAYS);
AddMesh("ShuttlePB_MFDs");
SetMeshVisibilityMode(2, MESHVIS_ALWAYS); // MFD as separate mesh for D3D9 metalness shader reason
AddMesh("ShuttlePB");
SetMeshVisibilityMode (3, MESHVIS_ALWAYS);
...
}
bool ShuttlePB::clbkLoadVC (int id)
{
static VCMFDSPEC mfds_left = { 2, 1 };
static VCMFDSPEC mfds_right = { 2, 0 };
static VCHUDSPEC hud_pilot = { 3, 7,_V(0,0.305,1.22429),0.3 };
// Left & Right MFDs
oapiVCRegisterMFD(MFD_LEFT, &mfds_left);
oapiVCRegisterMFD(MFD_RIGHT, &mfds_right);
// HUD
oapiVCRegisterHUD(&hud_pilot);
// Pilot's eyes location
SetCameraOffset(_V(0, 0.305, 0.492));
return true;
}
And set nmesh = 1, in function clbk_loadVC(id), then I don't see MFDs at all.
Shouldn't it be vi:set_mesh_visibility_mode(1,..) for the second mesh?I have a problem. I can't use a single mesh for MFDs and the rest of my mesh, because of the *.metal maps that make MFDs meshgroups invisible, so I use two meshes in my script:
The first mesh contains the only left and right MFDs (two squares with UVs). The second one contains the rest.C++:-- Mesh vi:add_mesh('Cirrus-SR22/Cirrus-SR22(MFDs)') vi:set_mesh_visibility_mode(0,bit.bor(MESHVIS.EXTERNAL,MESHVIS.VC)) vi:add_mesh('Cirrus-SR22/Cirrus-SR22') vi:set_mesh_visibility_mode(0,bit.bor(MESHVIS.EXTERNAL,MESHVIS.VC))
In the end of the script I definefunction clbk_loadVC(id):
C++:function clbk_loadVC(id) local mfds = { pos = _R(0,0,0,0), nmesh = 0, ngroup = 0, flag = 1, nbt1 = 6, nbt2 = 6, bt_yofs = 1024/6, bt_ydist = 1024/7 } local mfdgrp = {0,1} if id == 0 then vi:set_cameraoffset({x=-0.49644,y=0.60708,z=1}) oapi.VC_set_neighbours(-1, 1, -1, 2) elseif id == 1 then vi:set_cameraoffset({x=0.49644,y=0.60708,z=1}) oapi.VC_set_neighbours(0, -1, -1, 2) elseif id == 2 then vi:set_cameraoffset({x=0,y=0.45,z=-1}) oapi.VC_set_neighbours(-1, -1, 0, -1) end for i=0, 1 do mfds.ngroup = mfdgrp[i + 1] oapi.register_mfd(MFDID.LEFT + i, mfds) end return true end
In game I see both meshes in external view:
View attachment 45691
But in VC view I see the only first mesh (two MFDs):
View attachment 45692
I suppose it's because thefunction clbk_loadVC(id)defines the only first mesh (nmesh = 0).
So, Is it possible to see both meshes in VC view?
Also, if I define the MFDs mesh second, namely:
And setC++:-- Mesh vi:add_mesh('Cirrus-SR22/Cirrus-SR22') vi:set_mesh_visibility_mode(0,bit.bor(MESHVIS.EXTERNAL,MESHVIS.VC)) vi:add_mesh('Cirrus-SR22/Cirrus-SR22(MFDs)') vi:set_mesh_visibility_mode(0,bit.bor(MESHVIS.EXTERNAL,MESHVIS.VC))nmesh = 1, infunction clbk_loadVC(id), then I don't see MFDs at all.
self:set_mesh_visibility_mode (self:add_mesh (self.vcmesh_tpl), MESHVIS.VC)
Yes, it should be, thank you! It looks I repeated the same mistake I made some time ago.Shouldn't it be vi:set_mesh_visibility_mode(1,..) for the second mesh?
vi:add_mesh('Cirrus-SR22/Cirrus-SR22')
vi:set_mesh_visibility_mode(0,bit.bor(MESHVIS.EXTERNAL,MESHVIS.VC))
vi:add_mesh('Cirrus-SR22/Cirrus-SR22(MFDs)')
vi:set_mesh_visibility_mode(1,bit.bor(MESHVIS.EXTERNAL,MESHVIS.VC))

vi:add_mesh('Cirrus-SR22/Cirrus-SR22(MFDs)')
vi:set_mesh_visibility_mode(0,bit.bor(MESHVIS.EXTERNAL,MESHVIS.VC))
vi:add_mesh('Cirrus-SR22/Cirrus-SR22')
vi:set_mesh_visibility_mode(1,bit.bor(MESHVIS.EXTERNAL,MESHVIS.VC))

D3D9: [Destroy Render Window Called].If you want you can PM me your scripts and I can check if it's a Lua or D3D9 bugMaybe I won't display MFDs in external view, since it's very unstable (crashes to desktop) and I don't know why it happens. In VC it looks good and no crashes:
View attachment 45747