• 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.

P3D v2 When do mipmaps switch?

Messages
310
Country
us-washington
I've finally come up with a partial solution to the visibility range of lights in P3D by mipmapping the texture and then rather radically editing it. As long as one is editing the mipmaps, there is no reason that they all need to look the same and from some quick experiments this seems to open up a number of possibilities. If one does that, the question is 'when do the mipmaps switch? I think this question came up before, but I don't remember seeing anything quantitative. Any ideas guys?

[edited to add] It turns out that this is more complicated than I thought; the distance at which the mipmaps switch is a function of the zoom for one thing. In addition it looks like the relative sizes of the visible area between the main texture and the mipmaps influences the size at which the mips are displayed. I'll see if I can figure this out.
 
Last edited:
Many thanks, and please do keep us informed on this important line of inquiry, Larry ! :)

GaryGB
 
Thanks Gary,
So far nothing makes consistent sense, so I went back to the empirical approach; trial and error that is. I'll try to write down what hope to have figured out in a day or so. But in case anyone else wants to try this, here is how I'm creating and editing the mipmapped textures. Although I could do it several ways for FSX, P3D seems quite fussy. For blend mode 2, start with a simple .bmp, perhaps an existing one and resize to 512 x 512 so there is plenty of room to work with. Open this in ImageTool.exe from the SDK and mipmap it. (Doing it with the PS plugin does not work for P3D.) Save as .dds so you can edit in Photoshop. Open the .dds in Photoshop with the image flipped and with the mipmaps. Edit as you wish, then flatten the image and just 'save', 'using existing mipmaps' and with the image flipped. Open this .dds in ImageTool and save as .bmp. There may be an easier way, but I know this works. Talk about frustration until I figured this out! I'll write more about editing, but for now since I have not found a consistent pattern so I can predict what will happen, I decided to approach things backwards. Since the visibility problem is especially bad at the extremes of distance, I painted mipmaps 8 and 9 pure white. (2^9 =512) I also set the alpha level in the effect file to 256.

(I've noticed several other lighthouse effects files that use multiple identical emitters, blend mode 2, with alpha levels one hundred or so. Based on how additive blending works (assuming it's the same as in Photoshop), I am not sure I see the logic in this. You can't get any whiter than pure white, 256, 256, 256.)

By loading this test .bmp in the sim, I can set scale= values in the .fx file that make the light look realistic at the far range of visibility. It turns out that I can now cut the scale values for a lighthouse effect from a common value of 14 meters down to 5 or 6 meters this way and yet now have a light that looks realistic at that distance. Now it's a matter of editing the remaining mipmaps. I've been surprised at what I've found. For sure it's a way to control the grossly oversized effect when up close. One question that remains is what does the scale value refer to? The SDK says it's the size of the 'particle' but does that mean the initial tile, that is, all 512 pixels of it, or only the non-black portion? So far neither answer seems to be working! (I've been measuring the size displayed in the sim by taking close up screen shots of the light effect used in a custom lighthouse model where I know the dimensions. By opening the clip in PS and using the 'custom measurement scale' I can read off the actual dimensions of the light effect in meters.)
Enough for the preliminaries! More later... if I solve this to my satisfaction.
 
Last edited:
Gary, I think I have made some progress. This might be hard to find, but since I started on the topic in the previous post I might as well continue. By editing the mipmaps I've managed to increase the range of my lighthouse effect to 10 nm in FSX, have a better approximation of the non-linear nature of apparent luminosity vs measured luminosity (that is a less rapid falloff in intensity with distance), have the near distance effect now sized realistically while reducing the scale= values by 1/2 to 1/3 the size, all with one emitter. In P3D the effect abruptly cuts off at a maximum of 6km but other than that, the look is similar to that in FSX. I've also used the method to make a custom texture for my running light effects with similar results. I have some ideas of other ways I can use this idea too.

My first draft describing what I did is here: http://1drv.ms/1Ai52gP

I've found at least preliminary answers to a number of the questions I've asked on this subject and I've mentioned them in the draft.

Hope this is of use,

Larry
 
Hi Larry:

Good to see the results of your further inquiry on these matters; nicely detailed work ! :)

I'll take a look at the linked document, and will offer comments after a review of this topic and related info on textures and transparency for Effect (Fx) files versus other types of MSFS scenery content, as well as the numeric "Pixel coordinate" reference system used with Effect texture BMP versus DDS files.

Additionally I would hope to more clearly identify the 'correlation' of implementing Effect MIPMAP-ed textures with MDL MIPMAP-ed textures (...as pertains to "distance-related" on-screen object size in pixels which triggers LOD switching). :scratchch


NOTE: When testing this aspect of conditional object display for MIPMAPS and/or LODs, one may wish to add and use an explicit SmallPartRejectRadius entry set in the FSX.Cfg / P3D.Cfg at the default parameter value of (1) pixel:

https://fsxtimes.wordpress.com/2011/09/29/fsx-cfg-smallpartrejectradius/

http://www.simforums.com/forums/autogen-and-mesh-definition-radius-problem_topic44277.html

http://forum.avsim.net/topic/379324-do-the-jesus-tweaks-affect-draw-distance/

http://forum.avsim.net/topic/368398-increase-draw-in-distance-of-ground-planes-and-vehicles/

http://forum.avsim.net/topic/335760-traffic-disappearing-after-a-certain-range-threshold/

http://forum.avsim.net/topic/355081-ships-invisible/



Because of anomalies with run time rendering display of Effects with unpredictable "offset" positioning that the FS development community is encountering with FSX and/or P3D, I anticipate some inquiry may also be called for with regard to "user aircraft visual display radius" and potential correlation with the MSFS 3D world QMID grid LOD display system which impacts content display horizontally (X-Y: Lat-Lon) and vertically (Z: Altitude) in the sim, as well as the undocumented "scenery over-load content clipping option" which MSFS demonstrates in some flight scenarios. :idea:

GaryGB
 
Last edited:
Hi Gary,
Here's a thought about mipmap switching for object textures. This would be easy to check with the same method I used for effects. The idea would be to make a test object consisting of a line of something simple, like boxes say 100 to 200 meters in size, the next half that and so on. Paint them all the same color with a specific texture. Then after compiling, edit the resulting .dds texture in PS, changing the color of each mipmap. (Easy with the color replacement brush.) In the sim, just watch for the color change (it's gradual at the transition zone) as you move away. For near distances you can measure the distance based on screenshots and the known dimensions of the object. For greater distances using a placemark in Google Earth is quick. You just read the lat lon in the sim and use these values to locate the placemark, and then use the ruler to measure the distance to the known location of the object.

What I found surprising is the relatively short distance at which the first few mipmaps are used. My super approximate (order of magnitude :)) estimate is that the first few mipmaps switch in multiples of 10 times the scale value. As you move away the smaller mipmaps are used at a greater multiple of the scale. It may be an exponential function. I'm not sure the foregoing matters in most cases, but I was also surprised to find that I could do a much better job for my purpose making the smaller mipmaps myself in Photoshop compared to the ones generated by ImageTool. This can be important for a light effect, giving it a consistent soft edge but I can't think of an immediate need when working with textures for objects. But who knows!
 
Back
Top