New Release D3D9Client Development

DaveS

Space Shuttle Ultra Project co-developer
Addon Developer
Donator
Beta Tester
Joined
Feb 4, 2008
Messages
8,837
Reaction score
136
Points
153
So I want the radiator panels of the shuttle to reflect with this dark blue color at a high angle and this more neutral white color at low angles. How can I accomplish this with D3D9Client R2? I had this working in an earlier beta of R2 before Felix's reflection map fix was incorporated.
 

Donamy

Addon Developer
Addon Developer
Donator
Beta Tester
Joined
Oct 16, 2007
Messages
6,831
Reaction score
84
Points
123
Location
Cape
It would change color differently, depending on what was being reflected, water, clouds, land or space. I would think.
 

DaveS

Space Shuttle Ultra Project co-developer
Addon Developer
Donator
Beta Tester
Joined
Feb 4, 2008
Messages
8,837
Reaction score
136
Points
153
It would change color differently, depending on what was being reflected, water, clouds, land or space. I would think.
True, but right now there's just a very small change between high angles and low angles of reflection. In reality, it should change to very light color at low angles when it is reflecting something dark, like space. This video of the STS-133 R-BAR Pitch Maneuver (RPM) shows the effect very well as the observer position stationary (ISS Lab camera) while the orbiter rotates changing the reflection angle:

 

Xyon

Puts the Fun in Dysfunctional
Administrator
Moderator
Addon Developer
Webmaster
GFX Staff
Donator
Beta Tester
Joined
Aug 9, 2009
Messages
6,629
Reaction score
101
Points
138
Location
10.0.0.1
Website
www.orbiter-radio.co.uk
Evening folks; at some point soon, I will need to take the my server properly offline for a short while, which will impact your access to the SVN service on it. Would there be a date or time when this would be especially inconvenient?
 

Donamy

Addon Developer
Addon Developer
Donator
Beta Tester
Joined
Oct 16, 2007
Messages
6,831
Reaction score
84
Points
123
Location
Cape
Evening folks; at some point soon, I will need to take the my server properly offline for a short while, which will impact your access to the SVN service on it. Would there be a date or time when this would be especially inconvenient?

When ever you need too !

True, but right now there's just a very small change between high angles and low angles of reflection. In reality, it should change to very light color at low angles when it is reflecting something dark, like space. This video of the STS-133 R-BAR Pitch Maneuver (RPM) shows the effect very well as the observer position stationary (ISS Lab camera) while the orbiter rotates changing the reflection angle:

[STS-133] RPM (Rendezvous Pitch Maneuver), Last ever for Shuttle Discovery - YouTube



Must be blinding, when it reflects the sun.
 
Last edited:

DaveS

Space Shuttle Ultra Project co-developer
Addon Developer
Donator
Beta Tester
Joined
Feb 4, 2008
Messages
8,837
Reaction score
136
Points
153

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
1,559
Reaction score
88
Points
48
Evening folks; at some point soon, I will need to take the my server properly offline for a short while, which will impact your access to the SVN service on it. Would there be a date or time when this would be especially inconvenient?
Whenever it is convenient for you is the best time :thumbup:
 

Xyon

Puts the Fun in Dysfunctional
Administrator
Moderator
Addon Developer
Webmaster
GFX Staff
Donator
Beta Tester
Joined
Aug 9, 2009
Messages
6,629
Reaction score
101
Points
138
Location
10.0.0.1
Website
www.orbiter-radio.co.uk

jarmonik

Addon Developer
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,110
Reaction score
66
Points
48
Website
users.kymp.net
So I want the radiator panels of the shuttle to reflect with this dark blue color at a high angle and this more neutral white color at low angles. How can I accomplish this with D3D9Client R2? I had this working in an earlier beta of R2 before Felix's reflection map fix was incorporated.

In the "dark blue" photo, the radiators are fully lit by the sun light and they are reflecting nothing (just empty space). So, that photo should show a true diffuse color of the radiators and that's pretty much what the diffuse texture should be. On the other hand, in the "natural white" photo, the reflected color is pretty close to the color of the Earth that's being reflected. A viewing angle does have an effect to the reflected image (intensity, sharpness) but that's starting to become noticeable below 20 deg. So, neither photo should be effected by viewing angle dependencies.

A few words about the "Felix's Fix". If you create a gold foil texture for the DX7 inline engine, that texture would have pretty bright gold color applied to it. That's pretty much it when a renderer doesn't support reflections. However, in a reflective environment a diffuse color of a gold foil would need to be close to a black. And that's because of an energy conservation, if 75% of incoming light is reflected then only 25% of the incoming light can go through diffuse scattering. One purpose of the "Felix's Fix" is to avoid a need of a separate diffuse textures for DX7 and DX9, and an other is to prevent over powering/saturating the reflections.

The equation:
cDiff.rgb *= (1.0f - fRefl);

Will shift the color of the diffuse texture towards a black when the reflectivity "fRefl" increases. You didn't tell what's wrong with the current rendering of the radiators. But I would assume the color to be too dark. If the diffuse texture has the color and intensity shown in the "dark blue" photo then the "Felix's Fix" correction factor would not be needed and it's darkening something that's already correct.

There are a few quick tests you could try:

Remove/Comment out the line 365 from the PBR.fx:
//cDiff.rgb *= (1.0f - fTot);

If that doens't help then you could try to alter the line 369 to this:
cDiff.rgb *= (1.0f - fRefl*fRefl);

You can alter the brightness of the diffuse texture from the D3D9Mesh debugger by using "Tune Albedo" property but that will of-course effect to the whole texture not just the selected group. "Tune X" features works only when the mesh debugger is open. Currently the diffuse material property can't be adjusted above above 1.0.

A few notes:
- It would be good idea to ask Felix's opinion about this.
- Fresnel behavior is not yet implemented and few other issues are still open.
- I am further looking into this matter.
- Might be good idea to wait a little with major texture works. Small changes in the rendering behavior can happen.
 
Last edited:

DaveS

Space Shuttle Ultra Project co-developer
Addon Developer
Donator
Beta Tester
Joined
Feb 4, 2008
Messages
8,837
Reaction score
136
Points
153
In the "dark blue" photo, the radiators are fully lit by the sun light and they are reflecting nothing (just empty space). So, that photo should show a true diffuse color of the radiators and that's pretty much what the diffuse texture should be. On the other hand, in the "natural white" photo, the reflected color is pretty close to the color of the Earth that's being reflected. A viewing angle does have an effect to the reflected image (intensity, sharpness) but that's starting to become noticeable below 20 deg. So, neither photo should be effected by viewing angle dependencies.

A few words about the "Felix's Fix". If you create a gold foil texture for the DX7 inline engine, that texture would have pretty bright gold color applied to it. That's pretty much it when a renderer doesn't support reflections. However, in a reflective environment a diffuse color of a gold foil would need to be close to a black. And that's because of an energy conservation, if 75% of incoming light is reflected then only 25% of the incoming light can go through diffuse scattering. One purpose of the "Felix's Fix" is to avoid a need of a separate diffuse textures for DX7 and DX9, and an other is to prevent over powering/saturating the reflections.

The equation:
cDiff.rgb *= (1.0f - fRefl);

Will shift the color of the diffuse texture towards a black when the reflectivity "fRefl" increases. You didn't tell what's wrong with the current rendering of the radiators. But I would assume the color to be too dark. If the diffuse texture has the color and intensity shown in the "dark blue" photo then the "Felix's Fix" correction factor would not be needed and it's darkening something that's already correct.

There are a few quick tests you could try:

Remove/Comment out the line 365 from the PBR.fx:
//cDiff.rgb *= (1.0f - fTot);

If that doens't help then you could try to alter the line 369 to this:
cDiff.rgb *= (1.0f - fRefl*fRefl);

You can alter the brightness of the diffuse texture from the D3D9Mesh debugger by using "Tune Albedo" property but that will of-course effect to the whole texture not just the selected group. "Tune X" features works only when the mesh debugger is open. Currently the diffuse material property can't be adjusted above above 1.0.

A few notes:
- It would be good idea to ask Felix's opinion about this.
- Fresnel behavior is not yet implemented and few other issues are still open.
- I am further looking into this matter.
- Might be good idea to wait a little with major texture works. Small changes in the rendering behavior can happen.
Thanks for the lay down on how the reflections work. Right now the problem is that the "natural" top-down reflection color is just too dark. This is the main diffuse texture of the texture and as you can see, the radiator panels are painted in the correct dark blue color but yet, they appear pitch black in-sim.
. I tried both fixes but none really had any effect. Which map of the roughness map controls the gamma channel? The diffuse map or the alpha map?
 
Last edited:

jarmonik

Addon Developer
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,110
Reaction score
66
Points
48
Website
users.kymp.net
Which map of the roughness map controls the gamma channel? The diffuse map or the alpha map?
I don't understand the question.

In the "Tune X" debug controls, the gamma field is used to apply a gamma curve into the texture's RGB data channels. The gamma control, along side by side with the RGB brightness control allows to adjust texture contrast.

The "Tune _Spec" doesn't have gamma control. The last field controls the specular power value. Which in SSU case will specify the roughness value for reflection blurriness. Since, no additional _rghn map is specified.

If _rghn map is specified, then the roughness value comes from the green color channel because the DXT1 compression quality is best for the green channel.

There doesn't exists a texture that would have a per pixel gamma value.
 

DaveS

Space Shuttle Ultra Project co-developer
Addon Developer
Donator
Beta Tester
Joined
Feb 4, 2008
Messages
8,837
Reaction score
136
Points
153
I don't understand the question.

In the "Tune X" debug controls, the gamma field is used to apply a gamma curve into the texture's RGB data channels. The gamma control, along side by side with the RGB brightness control allows to adjust texture contrast.

The "Tune _Spec" doesn't have gamma control. The last field controls the specular power value. Which in SSU case will specify the roughness value for reflection blurriness. Since, no additional _rghn map is specified.

If _rghn map is specified, then the roughness value comes from the green color channel because the DXT1 compression quality is best for the green channel.

There doesn't exists a texture that would have a per pixel gamma value.
I have converted the SSU payload bay textures to use the PBR engine after reading the D3D9Client guide. After that final piece of information the roughness texture, I think I have gotten the textures just right.
 

jarmonik

Addon Developer
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,110
Reaction score
66
Points
48
Website
users.kymp.net
Thanks for the lay down on how the reflections work. Right now the problem is that the "natural" top-down reflection color is just too dark.

The reflection intensity in _refl map could be too high. Which would take down the diffuse color down to zero (black).

Also, because of the diffuse texture attenuation towards black (Felix's Fix), the diffuse texture would need to have brighter color for the radiators. Maybe 2-4 times brighter.

Well, maybe we could have on/off switch for the attenuation or something...
 

DaveS

Space Shuttle Ultra Project co-developer
Addon Developer
Donator
Beta Tester
Joined
Feb 4, 2008
Messages
8,837
Reaction score
136
Points
153
The reflection intensity in _refl map could be too high. Which would take down the diffuse color down to zero (black).
That was part of the problem, the reflection intensity was too high as determined by playing with the tuning utility. I also decreased the green channel of the roughness texture, once again determined by tuning utility of D3D9Client.
 

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,633
Reaction score
24
Points
38
Hi guys,

sorry to bother but I was working on my spacenetwork addon and I updated the D3D9, noticing that this issue:
https://www.orbiter-forum.com/showthread.php?p=547005&postcount=4205

is still there, so I wanted to report it. Just to sum it up: if I use the "oapiCameraAttach" function the terrain gets clipped, I'd say because the camera keeps using the clip radius or the size of the focused vessel, instead of switching to the camera target one.

As a matter of fact I just confirmed that this varies from the vessel in focus at the moment I attach the camera to another vessel: if the clip_radius / size of the vessel is small the issue is not present, otherwise it's there.

One practical example: stock ISS produces the bug, it has clip 68.4 m and size 55 m, while stock shuttle A doesn't, clip and radius = 17m.
 
Last edited:

jarmonik

Addon Developer
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,110
Reaction score
66
Points
48
Website
users.kymp.net
D3D9Client2016 R2.1

Here's a new build. The issue above should be fixed.

The build is for the official Orbiter 2016 release.
 

Attachments

  • D3D9Client2016-R2-1.zip
    1.7 MB · Views: 285

DaveS

Space Shuttle Ultra Project co-developer
Addon Developer
Donator
Beta Tester
Joined
Feb 4, 2008
Messages
8,837
Reaction score
136
Points
153
Could support for more than one environment camera per vessel be added? I'd like to be able to tie them to specific animations, in SSU's case the payload bay radiator panels and the Ku band antenna.

Currently there's only one camera and it's fixed to the bottom of the payload bay leading to inaccurate reflections once the payload bay doors have been opened (they reflect the payload bay which they shouldn't be able to do). Same deal with the Ku band antenna. Here's two comparison screenshots:

https://www.dropbox.com/s/we0h0grfdjdjk7f/STS107_Kuband_PLBcam_A.jpg?dl=0
https://www.dropbox.com/s/xwmwg7xkuo5osod/SSU_Kuband_PLBcam_A.jpg?dl=0
 

BrianJ

Addon Developer
Addon Developer
Joined
Apr 19, 2008
Messages
1,262
Reaction score
101
Points
63
Location
Code 347
Comets?

Hi all,
I was wondering if D3D9 Graphics Client would be any better at rendering some kind of representation of comets than the default Orbiter2016, so I tried a couple of experiments with my old "comet-coma" mesh/texture.

First thing I noticed was that in D3D9, a planetary mesh (called by MaxPatchResolution = 0 in the .cfg) is not scaled by the planet radius. Not a problem, but I wonder if that will impact some add-ons (Saturn/Jupiter moons, etc.).
[NOTE Does Orbiter2016 default graphics still scale the mesh? I haven't checked]
[EDIT Checked it - yes, Orbiter2016 still scales planetary mesh by planet radius]

A good thing is that you can have transparent/semi-transparent planetary meshes in D3D9.

However, it seems there is still a maximum distance for rendering mesh polys of about 100,000km from camera.

This mesh is about 32000km wide and twice as long, it belongs to a planet of 40000km diameter. You can see clipping starts to occur at about 100,000km distance. Move further away and the mesh disappears.
o2016_d3d9_comet.jpg

Just for fun, I put it in 80000km Earth orbit.
o2016_d3d9_comet2.jpg

Looks a bit different from outside the atmosphere.
o2016_d3d9_comet3.jpg

Anyway, just messing around having fun :)
Cheers,
Brian
 
Last edited:

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
9,476
Reaction score
245
Points
153
Location
between the planets
So, I have a question about that color blitting. I think a while back it was mentioned that D3D9client does in fact support it. Today I wanted to take a crack at it ad bring my developing GUI-toolkit up to speed, but then found this in the orbiter documentation for oapiBlt:

Colour keys are only supported with Orbiter's inline graphics client. External clients ignore the ck parameter. The use of colour keys is therefore discouraged.

So... is this just outdated documentation, or do I need to use another call to blit with D3D9client? Because this very much sounds like orbiter simply not passing the color key on to graphics clients.

---------- Post added at 08:35 PM ---------- Previous post was at 08:01 PM ----------

Oh, for that matter, could you point me to the D3D9client build for r65? I had to replace my laptop two months ago, this is the first time that I'm getting my stuff to run under D3D9client again...
 
Top