New Release D3D9Client Development

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,651
Reaction score
785
Points
128
I try to explain what's going on here. Also you should check the D3D9GraphicsGuide in /OrbiterSDK/Doc

First of all, the client is designed to run meshes and models created for the DX7 inline engine. Therefore, the way that the client will understand a Specular color is tied to a DX7 behavior. A Modern PBR pipelines do understand the specular slightly in a different way than a DX7. What a typical PBR pipelines mean by "Specular" is in our case called "Reflectivity" since the the word "Specular" is already reserved for compatibility. So, if you have a "Specular" texture map designed for modern PBR pipeline it should be assigned for D3D9Client as reflection map <*_refl.dds>

The second thing that should be noted is that "roughness" and "specular.power" are basically one and the same thing using a different scales. If you have a "roughness" texture map and you manipulate a specular power setting then it does create a confusion for the renderer of which one to use. This could explain the sudden jumps in appearance you have described.


But the problem is a bit that I would really like to have those materials applied by mesh, not by vessel, since the mesh might appear in multiple vessels.
I would also prefer for the configurations to be tied to a mesh like <mesh_name>.cfg but the problem is that the client doesn't always get the file name for a meshes. If a mesh is load using oapiLoadMeshGlobal() then a client does get the file name but if oapiLoadMesh() is used instead then the name isn't forwarded for a client. About 50% of addons use the first one and another 50% the second one. The lack of mesh file name has been a show-stopper for some features we have planned. In a case when we don't have the name we need to rely on vessel class name and mesh index. That's not exactly very reliable.

Texture maps don't need to be the same size. So, if you have constant color "Reflectivity" you can simply assign 4x4 pixel miniature texture to a mesh containing the color you want.

the PBR shader ignores the orbiter .msh settings and either takes the values from the cfg file or from the maps. Which would be a bit confusing, because it totally does respect the diffuse and ambient color settings. Is this intended behaviour?
Yes, texture map and additional D3D9 specific configuration will override settings from a mesh file. That should apply everything including "Diffuse", "Ambient", "Emission" material properties.
 

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,842
Reaction score
2,105
Points
203
Location
between the planets
The second thing that should be noted is that "roughness" and "specular.power" are basically one and the same thing using a different scales.
Huh, that's weird... From what I observed reflectivity and roughness control how the general surrounding scene is reflected, while specular color and power specifically control how active lightsources are reflected. The effect of both is visually quite different, and I have seen them working in combination quite well on some materials.

In fact, fiddling around with it a bit paying attention to that aspect, it seems like roughness has an inverted effect on direct lightsources. High roughness means the scene is reflected more clearly, but the sun is barely being reflected at all.

Texture maps don't need to be the same size. So, if you have constant color "Reflectivity" you can simply assign 4x4 pixel miniature texture to a mesh containing the color you want.
That much is clear. I'm using 2x2, actually, works without a hitch.

Yes, texture map and additional D3D9 specific configuration will override settings from a mesh file. That should apply everything including "Diffuse", "Ambient", "Emission" material properties.
That is also clear. I merely expected it to fall back to the .msh definitions for shared properties if neither was provided, which seems to be the case for diffuse and ambient color, but not specular color and power. But after what you wrote, I guess that's because a reflection and roughness map was provided. It's just that if I go and fiddle with specular options, reflectivity and roughness in the debug panel, I can clearly see them both working at the same time, and the result is overall better, so it's a bit of a bummer that specularity is turned of on load if reflectivity and roughness are provided.
 
Last edited:

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,651
Reaction score
785
Points
128
so it's a bit of a bummer that specularity is turned of on load if reflectivity and roughness are provided.

Actually, it's not turned off. It's OK to use specular to control sunlight reflections and combination of (roughness + reflectivity) to control environment reflections. This mode requires either a specular texture map or specular material in the d3d9 "configuration" file.
 

DaveS

Addon Developer
Addon Developer
Donator
Beta Tester
Joined
Feb 4, 2008
Messages
9,429
Reaction score
680
Points
203
Any update on my issue with the Metalness shader?
 

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,651
Reaction score
785
Points
128
In fact, fiddling around with it a bit paying attention to that aspect, it seems like roughness has an inverted effect on direct lightsources. High roughness means the scene is reflected more clearly, but the sun is barely being reflected at all.
Yes, it is inverted and sadly it's too late to do much about it. I can change the material property name to "Smoothness" in the material editor but the texture identifier "*_rghn.dds" remains. Smoother material makes (should make) the sun reflection smaller but more intense in strength. The lack of "strength" or "intensity" in sunlight reflection is what triggered the development of new shaders.
 

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,651
Reaction score
785
Points
128
Any update on my issue with the Metalness shader?

I noticed from the screen shot that the blur is not blurry enough. Likely a result from the higher map resolution. This problem has been fixed. The reason behind "all emissive" issue is still unknown. I don't see anything really wrong in the shuttle rendering behind the reflection map in your screen shot. I am working on the Metalness shader and a new shader using a reflection map as well. I'll upload a new version as soon as I am able.
 

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,842
Reaction score
2,105
Points
203
Location
between the planets
Ok. I'll see what I can make of the new shader then. Never fiddled around with post processing effects before...
 

DaveS

Addon Developer
Addon Developer
Donator
Beta Tester
Joined
Feb 4, 2008
Messages
9,429
Reaction score
680
Points
203
I noticed from the screen shot that the blur is not blurry enough. Likely a result from the higher map resolution. This problem has been fixed. The reason behind "all emissive" issue is still unknown. I don't see anything really wrong in the shuttle rendering behind the reflection map in your screen shot. I am working on the Metalness shader and a new shader using a reflection map as well. I'll upload a new version as soon as I am able.
I don't know what has happened by the emissivity problem is gone all of a sudden. Now instead, the orbiter has this metallic sheen to it. I'm thing this is an expected behavior of the shader, is this correct?
 

Attachments

  • D3D9Client_new_shader2.jpg
    D3D9Client_new_shader2.jpg
    1.6 MB · Views: 16

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,651
Reaction score
785
Points
128
I don't know what has happened by the emissivity problem is gone all of a sudden. Now instead, the orbiter has this metallic sheen to it. I'm thing this is an expected behavior of the shader, is this correct?
I am not seeing anything unusual there. It's very likely a material configuration issue. Also it looks like the robotic arm runs with the old shader.
Do you have the "cAmbient" term in place in the Metalness.fx and the Emission too ?
 

DaveS

Addon Developer
Addon Developer
Donator
Beta Tester
Joined
Feb 4, 2008
Messages
9,429
Reaction score
680
Points
203
My fault, I uploaded the wrong screenshot. This is the correct one, showing the sheen. And I went back to the original R4.12 D3D9Client files, so this is with the stock Metalness.fx.
 

Attachments

  • D3D9Client_new_shader4.jpg
    D3D9Client_new_shader4.jpg
    1.2 MB · Views: 23

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,651
Reaction score
785
Points
128
My fault, I uploaded the wrong screenshot. This is the correct one, showing the sheen.
That looks like material/texture configuration issue. It's a good idea to wait a next release before investing much efforts for material or texture adjustments. I already have multiple fixes and adjustments in my working copy.
 

Felix24

Active member
Joined
May 13, 2010
Messages
245
Reaction score
95
Points
43
This is exciting!

Can the amount of smoothness adjust the amount of Fresnel reflection? I'm interested in adding frost to the outer skin in places (white diffuse, 0 smoothness, reduced metalness? just a guess) which has zero Fresnel reflection, while not changing the Fresnel reflections on the rest of the material.
 

DaveS

Addon Developer
Addon Developer
Donator
Beta Tester
Joined
Feb 4, 2008
Messages
9,429
Reaction score
680
Points
203
That looks like material/texture configuration issue. It's a good idea to wait a next release before investing much efforts for material or texture adjustments. I already have multiple fixes and adjustments in my working copy.
The main mesh only has materials configured to use the Metalness shader and a diffuse texture while the radiator panels and Ku band antenna sport the same but with an additional roughness texture but no reflection texture.

That is my configuration as of right now.
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
507
Points
113
I already have multiple fixes and adjustments in my working copy.
Please notice my commits (r1371 - r1373) and update, so my changes do not make too much trouble when you try to commit yours.

Hoping that it does not disturb your progress,
Kuddel
 

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,651
Reaction score
785
Points
128
This is exciting!

Can the amount of smoothness adjust the amount of Fresnel reflection? I'm interested in adding frost to the outer skin in places (white diffuse, 0 smoothness, reduced metalness? just a guess) which has zero Fresnel reflection, while not changing the Fresnel reflections on the rest of the material.

Frost, that would be interesting to see. I have never given much thought to that but I once thought about rendering of snow and having ice crystals glittering in a different colors. (Not for Orbiter). Right now the Fresnel effect in attenuated by roughness and there is a limit above which the Fresnel in completely off-line. There is no Fresnel texture implemented and I am unsure how to do that properly. Would a coating need it's own roughness ? Also could one of the color channels be used for frost overlay ?

How would you like to implement the frost ?
 

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,651
Reaction score
785
Points
128
Please notice my commits (r1371 - r1373) and update, so my changes do not make too much trouble when you try to commit yours.
Hoping that it does not disturb your progress
No worries. Thanks for adding the reset buttons.
 

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,651
Reaction score
785
Points
128
D3D9Client 4.13 (beta) is released.

There is a new "Specular" shader added to support a typical "Specular PBR workflow" for those who prefer to have more control over the rendering and material behavior. It's located in the end of "Metalness.fx" since they share many of the basic sub functions. Required textures are Diffuse, Roughness <_rghn.dds> and Reflectivity <_refl.dds>. The optional textures are the same as with the "Metalness" shader. I haven't done much testing with it, the basics should be working but it's still very much "work in progress" state.

There is a "Safeguard" check box added to DebugControls. So, if a model uses a diffuse textures that are already pre-attennuated for a proper reflections then the safeguard should be disabled.

Do we need a separate controls for sunlight and environment reflections ? If "Yes" then how should we do that ? The specular texture used by the old shader has a specular power assigned to alpha channel and it's very diffucult to properly manipulate the alpha with many image editors, so, maybe a solution that wouldn't require a use of alpha channel would be nice.
 

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,651
Reaction score
785
Points
128
My fault, I uploaded the wrong screenshot. This is the correct one, showing the sheen. And I went back to the original R4.12 D3D9Client files, so this is with the stock Metalness.fx.
Could this be a problem with the "Earth" glow. Does the color change if you are over land ?
 

N_Molson

Addon Developer
Addon Developer
Donator
Joined
Mar 5, 2010
Messages
9,271
Reaction score
3,244
Points
203
Location
Toulouse
Fixed the "yellowish issue" I had with the Long March ! Many thanks ! :hailprobe:
 
Top