Saturday, December 13, 2014
How to create working mirrors for P3Dv2 aicrafts
Just a quick heads-up for aicraft developers (and a quick memo for me) - here is how the working mirrors in my T-45C for Prepar3d V2.0 are done.
This is not meant to be a "tutorial", but just a quick note to show one of the possibilities provided by the new features of Prepar3d V2.
Specifically, Prepar3d V2 has an extended camera system, that allows you to easily render-to-texture any view, including IR sensors etc.
To make a working mirror for you Virtual cockpit you simply create a camera view with specific settings, assign a texture name and then use the texture in your 3D model.
In the T-45 there is a camera set as follows:
Description = Real time mirror
Origin = Virtual Cockpit
MomentumEffect = No
SnapPbhAdjust = Swivel
SnapPbhReturn = FALSE
PanPbhAdjust = Swivel
PanPbhReturn = FALSE
Track = None
ShowAxis = FALSE
AllowZoom = TRUE
InitialZoom = 0.60
SmoothZoomTime = 2.0
ZoomPanScalar = 1.0
ShowWeather = Yes
XyzAdjust = TRUE
InitialXyz = 0, 0.5, 0
InitialPbh = 0, 0, 180
This should be enough to generate a $mirror texture you can use in the VC. You will need, of course, to orient/flip it properly. Also, I have made the base material "self illuminating" otherwise the mirror would receive shadows from the rest of the cockpit.
In green are the specific lines that do the trick. You can of course customize the camera angles and the rendering setting to your preferences (but remember that more detail means bigger fps hit).
All the parameters are described in detail in the SDK - the trick works in a similar fashion for IR sensors or with other post processing effects.
I will probably add this to all my other planes (starting from the -D version)... when I'll get the time. Problem then is that you end up having two models (one for FSX and one for P3Dv2)... which takes longer to maintain.
Hope this helps. Ah, needless to say this ONLY works in Prepar3D v2.