# New ReleaseD3D9Client Development

#### kuddel

##### Donator
Donator
...another thing waiting to be documented

#### Felix24

##### Active member
I was also experimenting with the heat effect and came up with this, it's different but can't say if it's better or worse.
Code:
// Fetch Heat map
//
if (gCfg.Heat) {
float fH = (gMtrl.specialfx.x * gMtrl.specialfx.x * gMtrl.specialfx.x);
float iH = 1.0f / max(fH, 0.001f);
fHeat = pow(abs(tex2D(HeatS, frg.tex0.xy).g), iH) * pow(abs(fH), 0.02f * iH);
}
else fHeat = (gMtrl.specialfx.x * gMtrl.specialfx.x * gMtrl.specialfx.x);

Interesting. It looks decent when I test it. If I were to change it, I would only change the fHeat line to this. It makes the hotspots not heat up quite so quickly relative to the cooler areas.
fHeat = pow(abs(tex2D(HeatS, frg.tex0.xy).g), iH) * pow(abs(fH), 0.1f * iH);

Is there a risk of it being too computationally intensive?

And thanks for adding the ability to reload textures! This will be a huge time-saver. I'm not connected to the SVN repository, so will you upload it soon to http://users.kymp.net/~p501474a/D3D9Client/ ?

#### jarmonik

Beta Tester
And thanks for adding the ability to reload textures! This will be a huge time-saver. I'm not connected to the SVN repository, so will you upload it soon to http://users.kymp.net/~p501474a/D3D9Client/ ?
Sorry, I though you were able to compile the client. I have upload a new beta on the project site.

Is there a risk of it being too computationally intensive?

It shouldn't be a problem. The pow(abs(fH), 0.1f * iH) is actually a constant so pre-shader should take care of that. But "heat" effect is your work so it's up to you how you want it to work.

#### Felix24

##### Active member
The Reload Textures button doesn't work for normal textures, but only for the heatmap texture. Can it reload all of a vessel's textures?

Edit:
There's some other weird stuff happening that may be the root cause. I changed the base Shuttle texture, saved and clicked Reload Textures, but nothing changed. I then completely restarted Orbiter, but the Shuttle still was using the old texture, which seems impossible.

Then I tried modifying and resaving the heatmap texture, and the Reload Textures button updated that one correctly, but the base texture was still showing the old one.

Anyone have any idea what I did wrong? How can the base texture still show the same thing after being modified and restarting Orbiter?

Last edited:

#### jedidia

##### shoemaker without legs
How can the base texture still show the same thing after being modified and restarting Orbiter?
The textures are referenced in the mesh file, so unless D3D9client changes those (which could be considered rude), that sounds like expected behavior.

#### jarmonik

Beta Tester
The Reload Textures button doesn't work for normal textures, but only for the heatmap texture. Can it reload all of a vessel's textures?
Orbiter, but the Shuttle still was using the old texture, which seems impossible.
It should reload all textures. But there are some exceptions like if a texture is modified by a Sketchpad or by oapiBlt(), then the reload is disabled.
The anomaly with a stock Atlantis is likely due to base texture being loaded from "Textures2" folder.

#### Felix24

##### Active member
The anomaly with a stock Atlantis is likely due to base texture being loaded from "Textures2" folder.
I bet that's the problem- I was only editing the one in the "Textures" folder. Thanks!

#### Felix24

##### Active member
So, can you make the modifications to the shader ? I have included a new binary that enables the specular map for the shader.
Here's the shader with modifications, attached as a zip file. I duplicated and modified the existing lighting implementation. Changes are clearly marked in the shader.

If no spec texture is present, all lighting effects are generated using diffuse, metal, and rghn, like normal.
If a spec texture is present, a new lighting effect is added which is independent of diffuse, metal, and rghn.

It also shines (haha) when used for bare metal foil surfaces like Hubble. Image with brighter metal is with spec.

#### Attachments

• Metalness.zip
4.2 KB · Views: 6
• hubble1.jpg
399.4 KB · Views: 37
• hubble2.jpg
417.9 KB · Views: 37

#### DaveS

##### Space Shuttle Ultra Project co-developer
Donator
Beta Tester
I think this is the right thread to report this in. I've noticed something ever since I installed this add-on: Boca Chica Base and that is that the terrain at KSC/CCAFS has vanished and the surface textures is vibrating like crazy. If I disable terrain flattening, everything is as it should be. Re-enable terrain flattening and the issue is back.

Orbiter is 2016 release with D3D9Client R.4.19.

#### jarmonik

Beta Tester
Here's the shader with modifications, attached as a zip file. I duplicated and modified the existing lighting implementation. Changes are clearly marked in the shader.
Sorry about the delay. I have now uploaded the modification into the SVN. Yes, the one with a specular map does indeed look much better. Thanks about that.

If nobody oppose, I will remove the "Specular" shader intended for a typical specular PBR workflow just to simplify things and reduce work load.

#### jarmonik

Beta Tester
I think this is the right thread to report this in. I've noticed something ever since I installed this add-on: Boca Chica Base and that is that the terrain at KSC/CCAFS has vanished and the surface textures is vibrating like crazy. If I disable terrain flattening, everything is as it should be. Re-enable terrain flattening and the issue is back.
Orbiter is 2016 release with D3D9Client R.4.19.

Is anyone else able to reproduce that ? Is there a problem in the client or is this something else ?

#### Face

Beta Tester
I think this is the right thread to report this in. I've noticed something ever since I installed this add-on: Boca Chica Base and that is that the terrain at KSC/CCAFS has vanished and the surface textures is vibrating like crazy. If I disable terrain flattening, everything is as it should be. Re-enable terrain flattening and the issue is back.

Is the addon *.flt file the only one in the /Textures/Earth/Flat/ directory? If not, could it be that another file is present that changes the KSC area?

#### DaveS

##### Space Shuttle Ultra Project co-developer
Donator
Beta Tester
Is the addon *.flt file the only one in the /Textures/Earth/Flat/ directory? If not, could it be that another file is present that changes the KSC area?
Only file in there.

#### Nikogori

##### Donator
Donator
I've seen "surface texture vibration" in multiple scenarios, too. Terrain flattening is enabled.
Usually it disappears when I zoom out and zoom in. (using mouse wheel)

#### DaveS

##### Space Shuttle Ultra Project co-developer
Donator
Beta Tester
I got this weird difference in shading on the SRM segments. The shader is Metalness and I have the Light glow post-processing selected. Again, this with D3D9Client R4.19 and Orbiter 2016.

#### Attachments

877.7 KB · Views: 30

#### Donamy

Donator
Beta Tester
looks like messed up vertices.

#### jarmonik

Beta Tester
I got this weird difference in shading on the SRM segments. The shader is Metalness and I have the Light glow post-processing selected. Again, this with D3D9Client R4.19 and Orbiter 2016.

I have uploaded R4.20 does that fix the issue there ?
Also, I tested the Boca Chica base and couldn't detect any flickering issues.

#### DaveS

##### Space Shuttle Ultra Project co-developer
Donator
Beta Tester
I have uploaded R4.20 does that fix the issue there ?
Also, I tested the Boca Chica base and couldn't detect any flickering issues.
The issue remains with R4.20. And the terrain and flickering problems are at KSC with the BC add-on installed.

#### jarmonik

Beta Tester
Looks like the SRM is composed from a several independent mesh segments, so, are there simply different settings applied to a different segments ? I couldn't see anything unusual when tested material settings there.