New Release D3D9Client Development

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,666
Reaction score
100
Points
78
Currently, custom cameras are tied to a focus vessel on a line 1701 in Scene.cpp. I don't know what happens if that "safety check" is removed. It depends on how the planetary surface manager (i.e. tile manager) is tied to the main camera and focus vessel. Also a distant vessels do not have a visual. So, there are a lot of potential problems.

I see, I tried to tie manually the custom camera to a vessel not in focus but it just CTDs... I also think that for you it's not at all a high priority point, and that is understandable. I tried to have a look at the code of D3D9 to see if I could try to implement it manually but my only guess was to make another visual in parallel for the vessel I want the custom camera for, and then use that, but that's too difficult for me to go there, I have no specific knowledge of the D3D9 code, so I'll just wait, maybe one day this feature will be available.
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
507
Points
113
A bug fix for a custom camera issue has been uploaded. Not sure if that addresses all the issues.
It surely fixes the "weird world when custom camera is used" bug :thumbup:

It's funny how minute this fix was/is :cheers:
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
507
Points
113
Where I can find the update?
On my local hard drive :lol:

But seriously: I like to hold back the release a bit as there might be some more little fixes that might need to be included. But it won't be too long (a day or two max.). I will post the next releases here ASAP.
 

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,651
Reaction score
785
Points
128
I see, I tried to tie manually the custom camera to a vessel not in focus but it just CTDs...


Just to clarify, that it's permitted to have a custom cameras in a non focus vessels but they are not producing a video feed. Currently a live feed can only come from a focus vessel. This, of course, could be easilly extended to any near-by vessel. Where "near-by" means about 100m to 100km depending on camera altitude.


I have only tested the custom camera interface with a camera MFD (using a multiple instances in multiple vessels), so, bugs may exists those are not catched with that test.
 

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,666
Reaction score
100
Points
78
Do you think that there could be a way to have two instances of orbiter running synched on the same computer that shares data so I can have the video feed from one instance displayed in the other? it seems crazy even to me while i'm writing it, i know...
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
507
Points
113
Here they are:
D3D9Client for Orbiter 2016
D3D9Client for Orbiter BETA (r84)

Both represent the current HEAD revision of the repository (r980) including the custom camera fix by Jarmo.

With some luck these are quite stable :p

For the record: Both were build with Visual Studio 2015
 

Attachments

  • D3D9ClientR3.1-for2016(r980).zip
    1.5 MB · Views: 84
  • D3D9ClientBeta27.1-forBETA r84(r980).zip
    1.7 MB · Views: 39

Abdullah Radwan

Addon Developer
Addon Developer
Joined
Aug 20, 2017
Messages
314
Reaction score
284
Points
78
Location
Cairo
Here they are:
D3D9Client for Orbiter 2016
D3D9Client for Orbiter BETA (r84)

Both represent the current HEAD revision of the repository (r980) including the custom camera fix by Jarmo.

With some luck these are quite stable :p

For the record: Both were build with Visual Studio 2015

Thanks! It works very well now. Can the code be edited to attachment points instead of docking ports? That's going be very useful on rocket launches.
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
507
Points
113
Thanks! It works very well now.
Fine. May I ask whether the original version (Visual Studio 2015) worked, or the Visual Studio 2017 proposal? Or both?

Can the code be edited to attachment points instead of docking ports?

Should be possible by using the attachment API methods ( AttachmentCount, GetAttachmentHandle and GetAttachmentParams) to get their position and orientation.
But I wonder what happens to those attachment points that are not "ridgitly fixed" to the vessel like the one at the end of the Shuttle's SRMS...:hmm:

When I find some time I might take a look at that.

That's going be very useful on rocket launches.
Why that?
 
Last edited:

Abdullah Radwan

Addon Developer
Addon Developer
Joined
Aug 20, 2017
Messages
314
Reaction score
284
Points
78
Location
Cairo
Fine. May I ask whether the original version (Visual Studio 2015) worked, or the Visual Studio 2017 proposal? Or both?
I meant 2017 one.

Should be possible by using the attachment API methods ( AttachmentCount, GetAttachmentHandle and GetAttachmentParams) to get their position and orientation.
But I wonder what happens to those attachment points that are not "ridgitly fixed" to the vessel like the one at the end of the Shuttle's SRMS...:hmm:

When I find some time I might take a look at that.
A better idea will be the ability to enter the coordinates manually just like the old CameraMFD. Should be a better idea rather than attachment points. I will try to learn Orbiter SDK (If I get any time) and see what I can do with it.


Why that?
To monitor the vessel from the ground, so I set the focus to the rocket with a ground free camera and control my mission from there. Like the cameras installed on Falcon 9 and Falcon Heavy.
 

Abdullah Radwan

Addon Developer
Addon Developer
Joined
Aug 20, 2017
Messages
314
Reaction score
284
Points
78
Location
Cairo
So I took the code and modified it heavily. This works very well for my purpose. Built and tested using Visual Studio 2017 and Orbiter 2016. Might improve it further and upload it on OrbitHanger.

It needs at least one attachment point to get the basic camera position then you can move the camera using the buttons.

xfW1YMW.png
 

Attachments

  • CameraMFD.zip
    19.2 KB · Views: 19

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,651
Reaction score
785
Points
128
But I wonder what happens to those attachment points that are not "ridgitly fixed" to the vessel like the one at the end of the Shuttle's SRMS...:hmm:


Custom camera position and orientation can be updated by calling gcSetupCustomCamera() function with an existing camera handle passed to it. So, Is there an elegant way of acquiring the params for SRMS endpoint or do we need some kind of gcAPI function for that like gcMeshGroupToLocal() passing a fixed point from a mesh group to local vessel frame. Also, MATRIX4 gcGetMeshGroupTransform() could do the trick.

---------- Post added at 12:44 ---------- Previous post was at 12:38 ----------

Do you think that there could be a way to have two instances of orbiter running synched on the same computer that shares data so I can have the video feed from one instance displayed in the other? it seems crazy even to me while i'm writing it, i know...


That sounds complicated. What are you trying to do exactly ?
 

francisdrake

Addon Developer
Addon Developer
Joined
Mar 23, 2008
Messages
1,060
Reaction score
864
Points
128
Website
francisdrakex.deviantart.com
I would need advice how to properly load meshes when using the D3D9 client.
For my Starliner I get CTD's about every other run when starting up, while the standard graphics client is behaving better.

I tried several loading methods, as shown below. The same eratic behaviour. The docs mentions to avoid GetMesh() (which I do not use, at least not explicitely) and use the DEVMESHANDLE. Can I use the returned handle the same as a normal MESHHANDLE? :hmm:

Classical:
MESHHANDLE cmMesh, ...
cmMesh = oapiLoadMeshGlobal("CST-100\\CST-100-cm");
AddMesh(cmMesh, &ofs);

No handle:
AddMesh("CST-100\\CST-100-cm", &ofs);
// Unfortunately this cannot be used for all meshes. If the mesh is modified later on, the meshhandle is needed. This method takes a second longer to crash at startup.

Cast DEVMESHHANDLE:
DEVMESHHANDLE cmMesh, ...
cmMesh = (DEVMESHHANDLE) oapiLoadMeshGlobal("CST-100\\CST-100-cm");
AddMesh(cmMesh, &ofs);
 

Abdullah Radwan

Addon Developer
Addon Developer
Joined
Aug 20, 2017
Messages
314
Reaction score
284
Points
78
Location
Cairo
Just to clarify, that it's permitted to have a custom cameras in a non focus vessels but they are not producing a video feed. Currently a live feed can only come from a focus vessel. This, of course, could be easilly extended to any near-by vessel. Where "near-by" means about 100m to 100km depending on camera altitude.


I have only tested the custom camera interface with a camera MFD (using a multiple instances in multiple vessels), so, bugs may exists those are not catched with that test.

What about rendering the area near any vessel has a custom camera in the scenario? Shouldn't be too difficult for today powerful computers.
 

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,666
Reaction score
100
Points
78
That sounds complicated. What are you trying to do exactly ?

just to see from my vessel (which is a simulated Mission Control Center) what the other vessel sees
 

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,651
Reaction score
785
Points
128
What about rendering the area near any vessel has a custom camera in the scenario? Shouldn't be too difficult for today powerful computers.


That would require to rewrite the tile manager that is responsible to load/unload surface tiles and managing tile resolution levels. That isn't the most simpliest part of the client.


Also, an other problem is the limit of 3GB of usable memory. If the current graphics settings are pushed high enough the 3GB will run out even without an additional scenery.


It should be possible to add a support for some kind of remote control scenarios (with some limitations). But what exactly did you have in mind ?

---------- Post added at 01:03 ---------- Previous post was at 00:53 ----------

just to see from my vessel (which is a simulated Mission Control Center) what the other vessel sees
Ok, I'll think about it.
 

Abdullah Radwan

Addon Developer
Addon Developer
Joined
Aug 20, 2017
Messages
314
Reaction score
284
Points
78
Location
Cairo
That would require to rewrite the tile manager that is responsible to load/unload surface tiles and managing tile resolution levels. That isn't the most simpliest part of the client.


Also, an other problem is the limit of 3GB of usable memory. If the current graphics settings are pushed high enough the 3GB will run out even without an additional scenery.


It should be possible to add a support for some kind of remote control scenarios (with some limitations). But what exactly did you have in mind ?


Let's take a Falcon 9 launch as an example. I'll set the focus to Falcon 9 with a free ground cam. Using my CameraMFD I put a camera in it. The problem is, when it goes higher than 100 km or so, it doesn't render the vessel correctly anymore. Also, I would like having a camera on the first stage (so not the focus vessel) and its landing pad so I can monitor it as well.


So I want to render the focus vessel no matter about its position (e.g. render Mars even I am at Earth for a Mars probe), as well as any non-focus vessel has a camera on it. I think this shouldn't exceed 3GB limitation (BTW, this is a DirectX 9 limitation or an Orbiter limitation?).
 

Donamy

Addon Developer
Addon Developer
Donator
Beta Tester
Joined
Oct 16, 2007
Messages
6,904
Reaction score
196
Points
138
Location
Cape
In 2010, you used to be able to focus on a different vessel, when looking at a preset camera view. 2016 you can't. When you select a different preset camera of a different vessel. It changes the focus to that vessel. Not good if you want to see a preset camera view, while the focus is on a different one. Wonder why it was changed.
 

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,651
Reaction score
785
Points
128
Cast DEVMESHHANDLE:
DEVMESHHANDLE cmMesh, ...
cmMesh = (DEVMESHHANDLE) oapiLoadMeshGlobal("CST-100\\CST-100-cm");
AddMesh(cmMesh, &ofs);


This is a wrong thing to do.




Classical:
MESHHANDLE cmMesh, ...
cmMesh = oapiLoadMeshGlobal("CST-100\\CST-100-cm");
AddMesh(cmMesh, &ofs);

No handle:
AddMesh("CST-100\\CST-100-cm", &ofs);
// Unfortunately this cannot be used for all meshes. If the mesh is modified later on, the meshhandle is needed. This method takes a second longer to crash at startup.


Both of these methods are OK to load and assign a mesh template to a vessel.

When a vessel enters in a visual range a set of D3D9-specific meshes are created from assigned mesh templates.

If you need a DEVMESHHANDLE to modify a D3D9-specific mesh used in rendering, you can acquire it in VESSEL2::clbkVisualCreated() callback function by using VESSEL::GetDevMesh() function. GetDevMesh() is the only way (I know of) to get a valid DEVMESHHANDLE. This also works in "No handle" case presented above. You don't really need the MESHHANDLE (pointing into a mesh template).

If (for some reason) a mesh template is modified, it's possible to trigger an update of D3D9-specific mesh by calling VESSEL::MeshModified(). This should be avoided due to high performance cost.
 
Last edited:

Abdullah Radwan

Addon Developer
Addon Developer
Joined
Aug 20, 2017
Messages
314
Reaction score
284
Points
78
Location
Cairo
How I can set night vision in D3D9? I want to add it to my Camera MFD. An example code would be great.
 
Top