New Release D3D9Client Development

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,669
Reaction score
798
Points
128
Last edited:

Face

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 18, 2008
Messages
4,404
Reaction score
581
Points
153
Location
Vienna
I'm not very accustomed to it, since there is a website I usually get the files from there. Anyway I never thought there was a needing to use svn in this case. I just opened the svn repo and downloaded the updated files. Now I have to setup the project to make it compile again, but at least i checked and there are the macros needed.

I see.

Do you already have an idea for a text file format to specify shapes? I think defining circles with lat/lon-midpoint with radius and height should be sufficient for a first cut, right?

---------- Post added at 10:59 ---------- Previous post was at 10:55 ----------

Sorry, we don't have sources in the distribution backage. Other than some example projects. I can attach the sources into a post. Which one do you need 2016 or Beta ?

Just to throw this in here: I keep a reasonably close fork of the SVN repo in Bitbucket, where you have the possibility to gather ZIP archives of every OVP state.

The 2016 version is this: https://bitbucket.org/face/ovp/get/D3D9Client/2016.zip
 

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,667
Reaction score
105
Points
78
I see.

Do you already have an idea for a text file format to specify shapes? I think defining circles with lat/lon-midpoint with radius and height should be sufficient for a first cut, right?

The first tentative I want to make is directly code wise, I decide an area and plug in the values directly into the code. If that works, I'll pass to the text file definitions.

Anyway I don't know if I'll do this right away. There is an increasing interest on the VesselBuilder project which is almost finished and I absolutely want to finish and publish that soon
 

Face

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 18, 2008
Messages
4,404
Reaction score
581
Points
153
Location
Vienna
The first tentative I want to make is directly code wise, I decide an area and plug in the values directly into the code. If that works, I'll pass to the text file definitions.

Well, as a first test you could plug in this:
Code:
if (elev) for(auto i=0;i<ndat;i++)
{
	elev[i] = 0;
}
before
Code:
return (elev != 0);

This will flatten the whole world.
 

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,667
Reaction score
105
Points
78
Well, as a first test you could plug in this:
Code:
if (elev) for(auto i=0;i<ndat;i++)
{
	elev[i] = 0;
}
before
Code:
return (elev != 0);

This will flatten the whole world.

yep, I coded the same with just 1000 instead of 0 to see the effect of a custom height on the whole world... But I can't get it to compile due to project setup yet...
 

Face

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 18, 2008
Messages
4,404
Reaction score
581
Points
153
Location
Vienna
yep, I coded the same with just 1000 instead of 0 to see the effect of a custom height on the whole world... But I can't get it to compile due to project setup yet...

Well, I can tell you that it works just fine, so you are on the right path :tiphat: .
 

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,667
Reaction score
105
Points
78
when trying to compile I keep getting the error:
MSB4019 The imported project "C:\Orbiter2016\Orbitersdk\VS2015\PropertyPages\orbiter_plugin.props" was not found. Verify that the path in the declaration <Import> is correct and that the file is on the disk.

I tried many things in project properties, but this breaks compilation immediately and I can't do anything else.
 

Face

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 18, 2008
Messages
4,404
Reaction score
581
Points
153
Location
Vienna
when trying to compile I keep getting the error:
MSB4019 The imported project "C:\Orbiter2016\Orbitersdk\VS2015\PropertyPages\orbiter_plugin.props" was not found. Verify that the path in the declaration <Import> is correct and that the file is on the disk.

I tried many things in project properties, but this breaks compilation immediately and I can't do anything else.

Try extracting this into your /orbitersdk/resources/ folder: View attachment resources.zip
 

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,667
Reaction score
105
Points
78
Try extracting this into your /orbitersdk/resources/ folder: View attachment 16578

Nope, I add to do the following just to get close:
- open the D3D9ClientVS2017.vcxproj with notepad
- change all the references to vs2015\..whatever it was\orbiter_plugin.props to the proper orbitersdk\resources\orbiter plugin.props and the debug.props
- add a copy of the given orbiter plugin.props and orbiter debug.props with the underscors (orbiter_plug.props and orbiter_debug.props)
- add manually to the project properties the inclusion directory of orbitersdk/include and the lib orbitersdk\lib

still I get that
Code:
class "oapi::GraphicsClient" does not include any member "LABELTYPE"
class "oapi::D3D9Client" does not include any member "GetSurfaceMarkerLeged"

and all the relevant errors because those objects are not recognized
 

Face

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 18, 2008
Messages
4,404
Reaction score
581
Points
153
Location
Vienna
still I get that
Code:
class "oapi::GraphicsClient" does not include any member "LABELTYPE"
class "oapi::D3D9Client" does not include any member "GetSurfaceMarkerLeged"

Could it be that the version you've checked out from the repo is the one for the beta Orbiter engine, but you try to compile in an stock 2016 environment?

Surface labels ring a bell there.
 

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,667
Reaction score
105
Points
78
Could it be that the version you've checked out from the repo is the one for the beta Orbiter engine, but you try to compile in an stock 2016 environment?

Surface labels ring a bell there.

I just opened svn://mirror.orbiter-radio.co.uk/D3D9client/trunk as Jarmo said to do :shrug:

---------- Post added at 16:47 ---------- Previous post was at 16:18 ----------

I just managed to compile it with your link in bitbucket.. Finally!!! thank you Face!!!
 

Face

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 18, 2008
Messages
4,404
Reaction score
581
Points
153
Location
Vienna
I just managed to compile it with your link in bitbucket.. Finally!!! thank you Face!!!

You're welcome. That links just points to the right branch for stock 2016 development. You should be able to do the same with SVN, but there you need to know how to handle SVN branches properly.

---------- Post added at 21:36 ---------- Previous post was at 19:02 ----------

I played with it a bit, and the following code can put a flattened circle on the tiles on the fly:
Code:
float lat = +34.58; // Vandenberg coordinates
float lng = -120.62;
float radius = 300 * 0.00001; //Approx. decimal degrees for 1 meter at equator
INT16 height = 2;

float bands = pow((float)2, lvl);
float width = 180 / bands;
float step = width / 256;
float latmin = 90 - width*(ilat + 1) - step * 1.5;
float latmax = 90 - width*ilat + step * 1.5;
float lngmin = -180 + width*ilng - step * 1.5;;
float lngmax = -180 + width*(ilng + 1) + step * 1.5;
float radius2 = radius * radius;
if (elev && latmin < lat + radius && latmax > lat - radius && lngmin < lng + radius && lngmax > lng - radius) for(auto i=0;i<ndat;i++)
{
	float y = latmin + (i / 259)*step - lat;
	float x = lngmin + (i % 259)*step - lng;
	if (x*x+y*y<radius2) elev[i] = height;
}

This puts a hole in the ground at the Vandenberg location. Of course it is not smoothing the edges or tuning the performance, but the demonstration seems nice.
 

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,667
Reaction score
105
Points
78
EDIT : moved to a new thread to highlight the result and not contaminate the D3D9 thread
 
Last edited:

Felix24

Active member
Joined
May 13, 2010
Messages
245
Reaction score
95
Points
43
The tiger-stripes is a common problem in a self-shadowing. It's usually more intense when sun angle is low. Also the shadow-map resolution setting in D3D9Client.cfg may effect to the results. I'll try to make some adjustments to reduce the stripes.

Has a solution to the "tiger stripes" been found yet? I think I found one (at least I hope it helps in the search): In PBR.fx, in two places:

Around line 198-ish:
PHP:
cSun *= ComputeShadow(frg.shdH, dLN, sc);
And around line 455-ish:
PHP:
float fShadow = ComputeShadow(frg.shdH, dLN, sc);
The lines above should be changed to:
PHP:
cSun *= smoothstep(0, 0.72, ComputeShadow(frg.shdH, dLN, sc));
and
PHP:
float fShadow = smoothstep(0, 0.72, ComputeShadow(frg.shdH, dLN, sc));

I noticed that there used to be lines like these in PBR.fx a while back, but it was removed for some reason. The modification causes the shadows to no longer creep around into the sunlit areas of objects, but it also makes the shadows be sharper. What other issues might this cause, Jarmo? I hope it doesn't break other things.

Here are a couple of screenshots showing the stripes on the stock ISS:

Before:

9 samples
9_samples_before.jpg


27 samples dithered
27_samples_dithered_before.jpg


After:

9 samples
9_samples_after.jpg


27 samples dithered
27_samples_dithered_after.jpg


Attached is the scenario I am using for the screenshots.
 

Attachments

  • (Current state) 0002.scn
    1.5 KB · Views: 2

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,669
Reaction score
798
Points
128
Has a solution to the "tiger stripes" been found yet? I think I found one (at least I hope it helps in the search): In PBR.fx, in two places:

I noticed that there used to be lines like these in PBR.fx a while back, but it was removed for some reason. The modification causes the shadows to no longer creep around into the sunlit areas of objects, but it also makes the shadows be sharper. What other issues might this cause, Jarmo? I hope it doesn't break other things.


Thanks about the fixes. It looks good here, I am not aware of any other implications except the sharper shadows which isn't a problem really. I have committed the changes to SVN. :cheers:
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
508
Points
113
D3D9 Client Build Instructions

@fred18: I tried to update our README.txt. Could you please take a look if everything you've experienced is covered somehow?
Any other suggestions / corrections etc. are welcomed, too :thumbup:

Code:
ORBITER VISUALISATION PROJECT -
D3D9 Client Build Instructions

This Document describes the steps needed to build D3D9Client from the sources.
This document uses Visual Studio 2015 (Community Edition) as the main compiler,
but it should be very similar with Visual Studio 2017. As new versions will
appear (Visual Studio 2019) and time goes by there might be some difference in
the procedures.
In case your current Visual Studio versions needs some changed procedures,
please notify the developers at the orbiter-forums "D3D9Client Development"
thread ([url]https://www.orbiter-forum.com/showthread.php?t=18431[/url]).


1. Required components
----------------------

To be able to compile D3D9 graphics client from the sources, you need:

* The fitting Orbiter libraries and headers.
  As a minimal build environment you only need the files from
  - Orbitersdk/include
  - Orbitersdk/lib
  - Orbitersdk/resources (Orbiter 2016)
    rsp.
    Orbitersdk/VS2015    (Orbiter BETA)

  The easiest way to get these directories is to run the get_orbiter_libs.bat
  script from Utils/D3D9Client.

  Another option is just to install the complete Orbiter installation, which
  will also have the benefits of being able to instantly debug the client.

* A Windows C++ compiler (Visual Studio 2015 Community Edition is ok, later
  versions should be fine, clang should also work, other compilers may or may
  not work).

* For a DirectX graphic client, you obviously also need the respective 3-D
  graphics SDKs. The D3D9 client builds with the MS DirectX June 2010
  SDK.
  You need the DirectX Software Development Kit (Version 9.29.1962 or newer) to
  build the client. It can be downloaded at Microsoft Download Center at
    [url]https://www.microsoft.com/en-us/download/details.aspx?id=6812[/url]

  If you have an existing Microsoft Visual C++ 2010 Redistributable installed
  on your computer, you may receive an "S1023" error when you install the June
  2010 DirectX SDK.
  To resolve this issue follow the instructions from
    [url]https://support.microsoft.com/en-us/help/2728613/s1023-error-when-you-install-the-directx-sdk-june-2010[/url]

  To run the client later on you also need the DirectX End-User Runtimes (June
  2010 or newer). These can be downloaded at Microsoft Download Center at
    [url]https://www.microsoft.com/en-us/download/details.aspx?id=8109[/url]
  (See [url]http://users.kymp.net/~p501474a/D3D9Client/#DirectX%20Runtimes[/url] for
  details on that).

* OPTIONAL (nVIDIA)
  NVIDIA API (needed since stereoscopic option was introduced in the Client)
  The NVAPI can be downloaded from the nVIDIA developer site at
    [url]https://developer.nvidia.com/nvapi[/url]

  If you don't like to install the NVIDIA API (it's not needed if stereoscopic
  option should not be available in the client), you do not need to do
  anything.
  During the build process (pre compiling) a dummy header "nvapi.h" will be
  generated into the main source directory (Orbitersdk/D3D9Client)
  automatically if it does not yet exist.
  This also means that if you *have* installed the NVIDIA API and copied the
  header file into the main source directory (Orbitersdk/D3D9Client) it will
  *not* be touched or overwritten by any further build process.

* OPTIONAL (Documentation)
  To recompile the D3D9 source documentation you need Doxygen from
    [url]http://www.stack.nl/~dimitri/doxygen/[/url]

  There is a doxygen configuration file in D3D9Client/doc/Doxyfile which
  can be used to generate the compressed html help file
  Orbitersdk/D3D9Client/doc/D3D9Client.chm included in the repository.
  Additionally to doxygen itself some other packets might be needed (depending
  on the output format you would like to generate) to create the 'chm' file
  you need:
  - Microsoft HTML Help Workshop (compiler for .CHM files)
      [url]http://go.microsoft.com/fwlink/?LinkId=14188[/url]
  - Graphviz (for the 'dot' tool to generate graphs)
      [url]http://www.graphviz.org/[/url]

* OPTIONAL (7-Zip)
  In order to create release-packages (ZIPs) a convenient build_release.bat
  script is used. If you like to be able to run that script without any errors
  you also need 7-Zip to be installed:
    [url]https://www.7-zip.org/[/url]

  The build_release.bat script expects the executable to be at
  "C:\Program Files\7-Zip\7z.exe", so to minimize any issues with that you
  should keep that (default) location.


2. Building the D3D9 client
---------------------------

To compile the sources of the D3D9 graphics client, you have two options:

* Via IDE
  Just start the solution file that fits your compiler version.
  - Orbitersdk\D3D9Client\D3D9ClientVS2010.sln (Visual Studio 2010)
  - Orbitersdk\D3D9Client\D3D9ClientVS2012.sln (Visual Studio 2012)
  - Orbitersdk\D3D9Client\D3D9ClientVS2015.sln (Visual Studio 2015)
  - Orbitersdk\D3D9Client\D3D9ClientVS2017.sln (Visual Studio 2017)

  In case you have a more recent version of Visual Studio (like Visual Studio
  2019 for example), you should take the solution file with the highest number.
  Visual Studio will usually be able to migrate the project- and solution-files
  to the current version (The names however will not match your Visual Studio
  version, though).

* Via build_release.bat
  Just run build_release.bat from the folder Utils/D3D9Client and the client
  should be build without any further action required.
  The script likes to creates two ZIP release-packages at the end of a
  (successful) build, so to make that part work you need 7-Zip as well (see
  Required components).


3. Testing the D3D9 client
--------------------------

* If the compilation of the D3D9 client was successful, it has created a
  plugin in Modules/Plugin/D3D9Client.dll.

* Run the "no-graphics" version of orbiter (orbiter_ng) and activate
  the D3D9Client plugin from the Modules tab.

* You should now get a video tab in the Launchpad dialog. Configure your
  graphics driver and screen options, then launch a scenario.

* The Visual Studio project files should all be able to just run the Debug-
  Button. This however always starts with the "(Current state)" Scenario, so
  you might need to start at least once via orbiter_ng.exe to setup a fitting
  scenario to work with when debugging.
 

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,667
Reaction score
105
Points
78
@fred18: I tried to update our README.txt. Could you please take a look if everything you've experienced is covered somehow?
Any other suggestions / corrections etc. are welcomed, too :thumbup:

Hi Kuddel, thanks. I will go again through this to see if the step by step is fine.

I also didn't know about some batches in the utils folder.

Anyway I gave a look at the get_orbiter_libs.bat file and it says
Code:
svn export --force -r %REV% %URL%/VS2015/PropertyPages %OUT_DIR%/VS2015/PropertyPages || goto exit_nok

I don't know batches very well but it seems to me that the structure "VS2015/PropertyPages" is preserved even using this.

That was a huge headache I had. I had to edit manually the vcxproj to delete the references to VS2015/propertypages and set them to orbiter/resources folder. Also the properties were named "orbiter_plugin.props" and "orbiter_debug.props" but in the resources folder they currently are orbiter plugin.props and orbiter debug. props (with the space, not the underscore), so I had to create a copy of the props with the underscore.

I will go again through the process, as said but this was the major issue

:cheers:
Fred
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
508
Points
113
Anyway I gave a look at the get_orbiter_libs.bat file and it says
Code:
svn export --force -r %REV% %URL%/VS2015/PropertyPages %OUT_DIR%/VS2015/PropertyPages || goto exit_nok

I don't know batches very well but it seems to me that the structure "VS2015/PropertyPages" is preserved even using this.

It's more a "feature" of the svn export here, but as you mention it I might have to add svn to the "Required components", too.
Although having the sources I guess one might have svn...
Nevertheless TortoisSVN used to have a check box like
[ ] install command line programs o something like that, which is essential for the batch scripts to work!
So thanks for looking into this :thumbup: Future developers will benefit!
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
508
Points
113
@fred18: Since you've used Visual Studio 2019 (if I remember correctly), could you be so kind and send me (or post) the Solution-, Project- and Filter-Files that have been updated?
I assume you've used the "2017" Solution which got migrated by Visual Studio 2019 then.
I want to add those project files to the repository and as I am not 100% sure what exactly Visual Studio 2019 will have changed in those files a reference would be nice.

A ZIP containing
- Orbitersdk/D3D9Client/*.filters
- Orbitersdk/D3D9Client/*.sln
- Orbitersdk/D3D9Client/*.vcxproj
would be a "save selection" ;)

The attached ZIP contains "my guesses" on what the files should look like... ;)

Regards,
Kuddel
 

Attachments

  • VS2019_prj(guessed).zip
    5.1 KB · Views: 5
Last edited:

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,755
Reaction score
2,738
Points
203
Location
Dallas, TX
So I am trying to get D3d9 back working.
So I downloaded this:
https://www.tuttovola.org/index.php?action=downloads;sa=view;down=1104

and Now I get DirectX runtimes maybe missing.
So I installed this:https://www.microsoft.com/en-us/download/confirmation.aspx?id=9033

Unzipped into a blank folder and ran setup.
But still get that error:
log:
Code:
00000.000: ---------------------------------------------------------------
000000.000: Module D3D9Client.dll ........ [Build 190406, API 160828]
000000.000: 
000000.000: **** Creating simulation session
000000.000: D3D9: [DirectX 9 Initialized]
            D3D9: 3D-Adapter.............. : AMD Radeon HD 8330
            D3D9: MaxTextureWidth......... : 16384
            D3D9: MaxTextureHeight........ : 16384
            D3D9: MaxTextureRepeat........ : 8192
            D3D9: VolTexAddressCaps....... : 0x3F
            D3D9: NumSimultaneousRTs...... : 4
            D3D9: VertexDeclCaps.......... : 0x3FF
            D3D9: MiscCaps................ : 0x3FCCF2
            D3D9: XNA Math Support........ : Yes
            D3D9: Vertex Texture.......... : Yes
            D3D9: Shadow Mapping.......... : Yes
            D3D9: D3DFMT_A16B16G16R16F.... : Yes
            D3D9: D3DFMT_A32B32G32R32F.... : Yes
            D3D9: D3DFMT_D32F_LOCKABLE.... : Yes
            D3D9: D3DFMT_A2R10G10B10...... : Yes
            D3D9: D3DFMT_L8............... : Yes
            D3D9: D3DDTCAPS_DEC3N......... : Yes
            D3D9: D3DDTCAPS_FLOAT16_2..... : Yes
            D3D9: D3DDTCAPS_FLOAT16_4..... : Yes
            D3D9: Runs under WINE......... : No
            D3D9: Available Texture Memory : 4095 MB
000000.000: D3D9: [3DDevice Initialized]
D3D9: ERROR: D3D9Surface.cpp Line:2045 Error:-2147024770 D3DXCreateEffectFromFileA(pDev, name, 0, 0, 0, 0, &FX, &errors)
D3D9: ERROR: Failed to create an Effect (Modules/D3D9Client/CKBlit.fx)
D3D9: ERROR: D3D9Pad.cpp Line:87 Error:-2147024770 D3DXCreateEffectFromFileA(pDev, name, 0, 0, 0, 0, &FX, &errors)
D3D9: ERROR: Failed to create an Effect (Modules/D3D9Client/Sketchpad.fx)
D3D9: ERROR: D3D9Effect.cpp Line:341 Error:-2147024770 D3DXCreateEffectFromFileA(pDev, name, macro, 0, D3DXSHADER_NO_PRESHADER|D3DXSHADER_PREFER_FLOW_CONTROL, 0, &FX, &errors)
D3D9: ERROR: Failed to create an Effect (Modules/D3D9Client/D3D9Client.fx)
D3D9: ERROR: PlanetRenderer.cpp Line:193 Error:-2147024770 D3DXCreateEffectFromFileA(pDev, name, macro, 0, 0, 0, &pShader, &errors)
D3D9: ERROR: Failed to create an Effect (Modules\D3D9Client\Surface.fx)
D3D9: ERROR: Scene.cpp Line:2997 Error:-2147024770 D3DXCreateEffectFromFile(pDev, name, 0, 0, 0, 0, &FX, &errors)
D3D9: ERROR: Failed to create an Effect (Modules/D3D9Client/SceneTech.fx)
 
Top