• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

DX-10 Tweaks - Wireframe Cool Stuff from Paul Roussin

Messages
1,025
Country
us-florida
Here's a little information some developers might be interested in. This is information I've been holding on to since 2009 and special thanks to Paul Roussin for this information.

Using Paul's techniques you can view FS objects in wireframe mode.

BEWARE: THIS AFFECTS YOUR SHADERS FOLDER AND TO RESTORE YOU'D NEED TO RE-BUILD YOUR SHADERS DIRECTORY BY DELETING THE FOLDERS IN THE FOLLOWING DIRECTORY:

C:\Users\yourusername\AppData\Local\Microsoft\FSX


---------------------------------------------------------------

Here is a modified technique to display the airplane in wireframe.
Look in your general.fx file.
Mine is here:

C:\Program Files\Microsoft Games\Microsoft Flight Simulator X\ShadersHLSL\General\General.fx

Find this technique near the end of the file. Look from the bottom up.

Add the code in green and this will wireframe the airplane.
The selection is done by #if defined(PS_USES_FRESNEL)
You can look through the file and test other selections.

Note once you set a mode it sticks! So the #else was needed to restore the fill mode of the triangles to solid. Without that most of the scene is wireframe. FSX does not clear the scene each frame so without the solid painting the wireframes will smear all over and make a mess.

If you wish to wirefram just the terrain, then add fillmode = wireframe; to the terrain file. That sticks so you have to set the mode back to solid using fillmode = Solid; in the next thecnique that is used. FSX does not restore the prior state after using a technique so yo have to do it your self.

technique T0
<
int Performance = EffectPerfLevel_MaxShader20;
>
{
pass P0
{
#include <DefaultStates.fxh>

#ifndef SHD_BLOOM
FogColor = 0;
#endif

VertexShader = compile vs_3_0 VS(); //NULL;//
PixelShader = compile ps_3_0 PS();

AlphaBlendEnable = (State_AlphaBlendEnable);
SrcBlend = (State_SrcBlend);
DestBlend = (State_DstBlend);//begin wireframe
#if defined(PS_USES_FRESNEL)
FillMode = WIREFRAME;
cullmode = ccw;
#else
FillMode = Solid;
#endif
//end wireframe

}
#ifdef SHD_SHADOWMAP
pass ShadowMap
{
#include <DefaultStates.fxh>

VertexShader = compile vs_2_0 VS_ShadowMap();
PixelShader = compile ps_2_0 PS_ShadowMap();

AlphaBlendEnable = (State_ShadowAlphaBlendEnable);
SrcBlend = SrcAlpha;
DestBlend = InvSrcAlpha;
}
#endif
}

This is the result:

plane.jpg


You can also play with other files.

For clouds look here: C:\Program Files\Microsoft Games\Microsoft Flight Simulator X\ShadersHLSL\misc\SwarmCloud.fx
Terrain: C:\Program Files\Microsoft Games\Microsoft Flight Simulator X\ShadersHLSL\Terrain\Terrain20.fx

Remember to return the fillmode to solid or many parts of the scene will not clear for a fresh repaint. Old stuff will stay in the scene.
Say you want the terrain in wireframe mode and solid otherwise.
Add the green FillMode = WIREFRAME; line to the T0 technique in the Terrain20.fx file as shown below.
Be sure to add FillMode = Solid; to the other files to restore the drawing state!!!
I added it to the General.fx as it is called frequently.
C:\Program Files\Microsoft Games\Microsoft Flight Simulator X\ShadersHLSL\Terrain\Terrain20.fxtechnique T0
<
>
{
pass p0
{
#include<DefaultStates.fxh>
#ifdef
SHD_BLOOM
FogColor = 0;
#endif
FillMode = WIREFRAME;
cullmode = ccw;
VertexShader = compile vs_2_0 Terrain20VS();
PixelShader = compile ps_2_0 Terrain20PS();
ColorWriteEnable = Red | Green | Blue | Alpha;
}
}

Here is the result (note the airplane modification was removed from the general file).

terrain.jpg


Paul
 
You can also do with this with various performance analysis tools, some go into greater detail allowing you to review drawcalls/vert counts and even change things like texture display resolution etc.
 
You can also do with this with various performance analysis tools, some go into greater detail allowing you to review drawcalls/vert counts and even change things like texture display resolution etc.

And purge textures still stored in the pagefile?

That's one of my pet peeves with Windows and MSFS. No matter how much RAM you have, you still need the stupid page file, but if you have the page file enableed, MSFS will merrily put textures into it and refuse to delete them after closing the simulator. The only solution is a reboot of the entire PC.
 
I don't recall ever needing to use that function, so have never looked for it unfortunately.
 
Neat! Although, this is for DX9, correct? The screenshots show Windows XP window chrome (XP didn't support DX10), and the shader files referred to are used with DX9.
 
I don't recall ever needing to use that function, so have never looked for it unfortunately.

You do aircraft models and never ran into this?

Symptom: A changed texture on an aircraft just won't update, no matter how often you reload the aircraft, switch paint schemes or open and close FSX.
 
You do aircraft models and never ran into this?

Symptom: A changed texture on an aircraft just won't update, no matter how often you reload the aircraft, switch paint schemes or open and close FSX.

I've never known what the issue is called, so thanks now. Experience it more than often...

A model can be updated, but texture won't be updated on reloading the A/C. Sometimes the texture is being updated yes, I believe it depends on view status. But I'm absolutely not sure about this...
 
You do aircraft models and never ran into this?

Symptom: A changed texture on an aircraft just won't update, no matter how often you reload the aircraft, switch paint schemes or open and close FSX.

One of the many issues with testing things in FSX. I personally have always avoided actually testing artwork assets in the game, and rather setup an environment in Max to render everything in a virtually identical manner, saving me a lot of time.
 
One of the many issues with testing things in FSX. I personally have always avoided actually testing artwork assets in the game, and rather setup an environment in Max to render everything in a virtually identical manner, saving me a lot of time.

I do the same with MCX, but things like bump and spac maps do need to be tested in FSX itself to see their ultimate impact on rendering the model.
 
For developers though it can give an idea on how MDL's are constructed to give ideas on how to reduce draw calls and vertex counts, lets please stay on topic. ;)
 
Back
Top