# New ReleaseD3D9Client Development

#### jarmonik

Beta Tester
1. MFDs in VC doesnt work (Shuttle fleet and default Atlantis).
2. For both Shuttles i have CTD at booster separation.
3. Seems MESHVIS_NEVER in SetMeshVisibilityMode() doesnt work at all.
These issues are now fixed. I'll try to upload a new alpha within a few days.

4. There is an issue with animation for dynamically loaded meshes, here is the example:
Is it possible to produce this with the stock vessels or do I need some specific add-on. What add-on and where I can download it ?

---------- Post added at 17:40 ---------- Previous post was at 17:26 ----------

Also, BTW, have you found a solution to the VC polar singularity problem? The polar singularity problem is the twist of the camera that occurs when the camera goes near the 90° point in either direction.
I haven't noticed anything like that. Does the problem exist in build-in engine and D3D7Client ? Does the problem occur with every camera in the VC or do I need to use some specific camera ?

#### DaveS

##### Space Shuttle Ultra Project co-developer
Donator
Beta Tester

I haven't noticed anything like that. Does the problem exist in build-in engine and D3D7Client ? Does the problem occur with every camera in the VC or do I need to use some specific camera ?
Yes, it exists in both the inline and D3D7Client. Well, I guess the problem with other cameras is that they never get close enough for the twist to happen. I don't remember if SSU V1.25 implemented the RMS End Effector camera view but if it did, then it is a prime example of the twist. Just maneuver the RMS while in the EE camera view over to the forward-most grapple fixture on the OBSS and you should experience it.

#### jarmonik

Beta Tester
Yes, it exists in both the inline and D3D7Client. Well, I guess the problem with other cameras is that they never get close enough for the twist to happen. I don't remember if SSU V1.25 implemented the RMS End Effector camera view but if it did, then it is a prime example of the twist. Just maneuver the RMS while in the EE camera view over to the forward-most grapple fixture on the OBSS and you should experience it.
There isn't much the client can do about it. The Orbiter should have a function to set the rotation matrix directly like oapiSetCameraRotationMatrix() but there is no such function. It would allow to get a rid of the singularity problem. However, there is ExternalCameraControl API (CamAPI.h) that might allow to solve the problem. I have no idea how the API works and there seems to be no documentation for it. An other possibility is to create a vessel-client interface that would allow to pass data directly between a vessel and a graphics client.

#### Thorton

##### sense offender
Looks like specular ripples that suppose to be rendered on water only also rendered on the ground.

#### jedidia

##### shoemaker without legs
The polar singularity problem is the twist of the camera that occurs when the camera goes near the 90° point in either direction.
I think that would be the gimbal-lock protection. Wouldn't be a wise thing to take that out, since you can find yourself in a state where your camera rotation locks up without it. I have never noticed it as consiously as you have, though.

#### jarmonik

Beta Tester
Here is an update.

- Dialog Windows in a fullscreen more are now working
- 12 light sources (a hardcoded maximum)
- Specular ripples microtexture bug fixed
- Some MFD releted bugs are fixed
- Booster separation CTD fixed
- Phobos/Deimos CTD fixed
- Mesh visibility mode issue should be fixed.
- VC near plane configuration added in D3D9Client.cfg
- Exhaust texture "edge" issue fixed.
- Saturn rings issue fixed.

Last edited:

#### Thorton

##### sense offender
Sorry, it seems that it was bug in my addon only, but it has been fixed now.

---------- Post added at 17:41 ---------- Previous post was at 01:50 ----------

Oh, new alpha, new glitches

Problems with MFD buttons in 2D cockpit (Default Atlantis and Shuttle Fleet)

Also HUD doesnt display in VC in Atlantis and Fleet.

There is some problem with rendering tiles that have alpha channel:

Tiles from this addon - [ame="http://www.orbithangar.com/searchid.php?ID=4247"]Baikonur Surface Tiles v1.1[/ame]

In AddExhaust (THRUSTER_HANDLE th, double lscale, double wscale, double lofs, SURFHANDLE tex = 0), parameter in bold doesnt work.

OAPIFUNC MATERIAL *oapiMeshMaterial (MESHHANDLE hMesh, DWORD idx) doesnt work too.

bool oapiSetTexture (MESHHANDLE hMesh, DWORD texidx, SURFHANDLE tex) gets me CTD when applied.

#### jarmonik

Beta Tester
Problems with MFD buttons in 2D cockpit (Default Atlantis and Shuttle Fleet)
This one has been around since the first alpha. I need to talk to Martin about it.

There is some problem with rendering tiles that have alpha channel
This problem is fixed and I have implemented a fade feature. Base tiles should now fade down to invisible before the tiles disapear.

In AddExhaust (THRUSTER_HANDLE th, double lscale, double wscale, double lofs, SURFHANDLE tex = 0), parameter in bold doesnt work.
This should be fixed. I haven't been able to test it. (easily enough)

OAPIFUNC MATERIAL *oapiMeshMaterial (MESHHANDLE hMesh, DWORD idx) doesnt work too.
This isn't supported by the graphics client interface. The Orbiter may need to be patched before geting this one to work. oapiSetMaterial should work.

bool oapiSetTexture (MESHHANDLE hMesh, DWORD texidx, SURFHANDLE tex) gets me CTD when applied.
It is now protected against a NULL handles. If it still gives a CTD I need to know how to reproduce it.

Ok, here is a minor update. The fog should work now and the exhaust clipping issue should be fixed.

Last edited:

#### Thorton

##### sense offender
Hm, I still get a CTD with oapiSetTexture(), what info do you need to reproduce it, source code?

#### jarmonik

Beta Tester
Hm, I still get a CTD with oapiSetTexture(), what info do you need to reproduce it, source code?
I need the executables and everything that they need to run and CTD. The source codes won't help in this case.

#### jarmonik

Beta Tester
Ok, I found the reason for the CTD. The Orbiter doesn't reroute the oapiSetTexture() call to the graphics client, so, the client doesn't get the replacement texture. However, the Orbiter will request the client to destroy the "old" existing texture which is done. The CTD will happen when the client is rendering the mesh with a handle of destroyed texture attached in the mesh. :facepalm:

There is nothing I can do about it right now. We can hope that Martin releases a P2 for the Orbiter.

There has been a few thoughts about OGCI (Orbiter Graphics Client Interface) that might allow to create a function ogciSetTexture() which would communicate directly with the graphics client by-passing the Orbiter. The setback is that an addon using such interface would no longer work with the build-in engine.

I suppose we should put our hopes in the P2 at this point. I'll implement the last few remaining features and then we should start driving the P2 forward.

#### Poscik

Playing with haze:

I'm now trying to add some red color to the bottom of haze.

---------- Post added at 07:51 PM ---------- Previous post was at 06:52 PM ----------

Everything seems to be correct now. That's how it looks now:

#### jarmonik

Beta Tester
It looks good from that viewing angle. :thumbup:

#### jarmonik

Beta Tester
Beta Release

The last remaining features are now implemented. The D3D9Client should now have the same functionality as the D3D7Client has with some improvements.
Also, I was thinking about re-implementing the particle effects using GPU and point-sprites but I desided to use the same code as the D3D7Client is using. It's working well enough for now.

There are still several know bugs and issues and some of them can't be fixed without patching the Orbiter.

1. The MFD Buttons in the glass cockpit mode aren't always visible.
2. The close button of dialog windows is missing in windowed mode. (Dialogs can be close by clicking the top-right corner).
3. DeltaGlider IV is causing a CTD
4. AMSO meshes are corrupted.
5. oapiSetTexture() is causing a CTD if used. (oapiSetTexture() doens't call clbkSetMeshTexture)
6. MATERIAL *oapiMeshMaterial (MESHHANDLE hMesh, DWORD idx) isn't working.
7. HUD is causing a major framerate impact in a glass cockpit and 2D panel view.
8. Re-entry stream texture isn't implemented. (Particle effects are working)
9. Some vessel ID's are transparent due to texture alpha channel. Texture configuration optios are listed in D3D9Client.cfg
10. Some exhaust stream clipping problems are detected with non-focus vessels.

Last edited:

#### N_Molson

Donator
Outstanding work ! I'm getting a solid 85 FPS using Thorton's ISSR :thumbup:

Except the few glitches you mentioned, it is already quite functional. I'm impressed.

Also, for some reason, some of my DG-Launcher textures doesn't display (the dark gray parts) :

Can't wait for a P2 fully supporting this client !

#### Thorton

##### sense offender
Thanks for update!

However I've found a bug with particles. During the simulation they render correctly, but when i pausing simulation i have following:

Another thing i've notticed, particles looks very differently from default client.

Also it seems that this construction doesn't work with D3D9 client:
Code:
MESHGROUP *mg;

if (hVisual != NULL)
{
MESHHANDLE hMeshVis = GetMesh(hVisual, iVisMesh);
if (hMeshVis != NULL)
{
mg = oapiMeshGroup(hMeshVis, MgIgx);
if (MgHide)
mg->UsrFlag = 7;
else
mg->UsrFlag = 0;
}
}
The purpose of code posted above is to hide/swow selected mesh group, it works however with default client.

Finally i have small and low priority request: is it possible to add pause sign when simulation is paused, like we can see with default client?

#### jarmonik

Beta Tester
Thanks for update!
However I've found a bug with particles. During the simulation they render correctly, but when i pausing simulation i have following:
I can reproduce that one, should be easy to fix.

Another thing i've notticed, particles looks very differently from default client.
This section of Particle.fx will define how the particle effects looks like. D3D9Client will automatically compile the scripts when starting simulation.

Code:
float4 DiffusePS(float2 tex0 : TEXCOORD0, float3 normalW : TEXCOORD1, float3 toCamW : TEXCOORD2) : COLOR
{
// Normalize input
normalW = normalize(normalW);
float d = max(dot(-gSun.direction, normalW), 0.05f);
float4 color = tex2D(Tex0S, tex0);
return float4(color.rgb*gMat.diffuse.rgb*color.a, gMat.diffuse.a*color.a);
}

float4 EmissivePS(float2 tex0 : TEXCOORD0, float3 normalW : TEXCOORD1, float3 toCamW : TEXCOORD2) : COLOR
{
float4 color = tex2D(Tex0S, tex0);
return float4(color.rgb*gMat.emissive.rgb, gMat.diffuse.a*color.a);
}
You could change the line:
return float4(color.rgb*gMat.diffuse.rgb*color.a, gMat.diffuse.a*color.a);
into:
return float4(color.rgb*gMat.diffuse.rgb, gMat.diffuse.a*color.a);
and see if it fixes the problem.

The purpose of code posted above is to hide/swow selected mesh group, it works however with default client.
Graphics Client interface doesn't support this. It might be possible to provide a limited support for that function. However, editing the vertex list with that function will never work. You could consider using oapiEditMeshGroup(). It should have a full support in D3D9Client. However, I don't know any addons actually using it.

Finally i have small and low priority request: is it possible to add pause sign when simulation is paused, like we can see with default client?
I'll do that, shouldn't be difficult.

#### Thorton

##### sense offender
You could change the line:
return float4(color.rgb*gMat.diffuse.rgb*color.a, gMat.diffuse.a*color.a);
into:
return float4(color.rgb*gMat.diffuse.rgb, gMat.diffuse.a*color.a);
and see if it fixes the problem.
If i change the line diffuse streams look the same as emissive.

Graphics Client interface doesn't support this. It might be possible to provide a limited support for that function. However, editing the vertex list with that function will never work. You could consider using oapiEditMeshGroup(). It should have a full support in D3D9Client. However, I don't know any addons actually using it.
Thanks for warning , i'm participating in development of big historical addon and it uses this function quite often.

#### rstr

##### Donator
Donator
NVidia3D Shutter GlassesTesting with D3D9 Client

Hi.
Just run the Orbiter_NG with the D3D9ClientBeta1 on a HighEnd GTX480 system with NVidia3DVision shutter glasses, and wow :thumbup: , 3D looks absolutely amazing with your DX client !!! Big thanks.
I am very interested in supporting your great D3D9Client, and volunteer to do some testing with the 3D shutter glasses (, though I am not able to contribute some programming work). Let me know whether this would be of interest to you, and which channels to use for any problem reporting.

Regards, and keep up the good work - Rob

Last edited: