c172p-team / c172p

A high detailed version of the Cessna 172P aircraft for FlightGear
GNU General Public License v2.0
80 stars 43 forks source link

Make fuselage and wings dirty #1003

Open onox opened 6 years ago

onox commented 6 years ago

ALS effect added in issue #737

The wings, leading edge, fuselage, and tail can be made dirty (splashed bugs and dirt) separately. See https://github.com/c172p-team/c172p-detailed/pull/973#issuecomment-367163370

onox commented 6 years ago

This issue can be picked up by first time contributors. It's 1 to 4 numbers (properties) that need to get a realistic value. Logic can be written in Nasal or a JSBSim system. Feel free to ask any questions you might have.

onox commented 6 years ago

Thanks @gilbertohasnofb, better label.

legoboyvdlp commented 6 years ago

If it is just a matter of making them acquire dirt over time with a "wash aircraft" button, it shouldn't be much trouble. If nobody else has claimed it, I'll do it.

wlbragg commented 6 years ago

@legoboyvdlp that is fine with me. Please investigate the effects of dirt on the flight dynamics and find out how much of an effect, if any, it has on a small aircraft like this. If it turns out to be costly in fuel or performance then we should also model that effect in the FDM over time if you don't use the "Wash aircraft" feature often. This also might go hand in hand with icing, which undoubtedly would be a little more complex.

legoboyvdlp commented 6 years ago

If it turns out that it does significantly affect performance, would it be alright if I added icing as well in the same pull request, given that ice definitely affects performance?

If dirt doesn't do much, then that won't be necessary.

legoboyvdlp commented 6 years ago

My flight school's 172SPs were getting really dirty, lots of bugs. I flew one just before it went in for a 100 hour. They spent nearly 5 hours cleaning and waxing the airframe. The next day I had an indicated airspeed that was about 5 knots higher at the same power setting and fuel burn

From airliners.net

A figure of a 1-2% increase of parasitic drag was quoted.

Years ago I gave a lot of float plane instruction in a J3 with an 85 hp engine. If the student was heavy and there were a lot of bugs, it wouldn't fly. Clean off the bugs and it would. That's potentially because bugs would create disturbed air and detach the flow from the top of the wing quicker then it would normally happen. So lift is significantly reduced

Also, for icing: https://skeptics.stackexchange.com/questions/17663/can-a-sandpaper-thick-layer-of-ice-reduce-lift-by-30-percent-and-increase-drag-u

legoboyvdlp commented 6 years ago

So yes, it does affect the performance - more significantly than I thought.

gilbertohasnofb commented 6 years ago

I find this figure of 1-2% very unbelievable if I can be honest. The cruise speed of a J3 is normally around 70 knots, which means that 1-2% would be 0.7-1.4 knot. First, I doubt you can read this value so precisely in the airspeed gauge. Secondly, there are many other parameters than can influence differences in airspeed between two flights. Were the throttle and mixture exactly in the same position? Was the temperature the same so that the engine was performing identically? etc. The human mind seeks causation for any apparent correlation. I think these are too anecdotal and unlikely to be taken into consideration. My opinion is then that this should be only a cosmetic effect.

legoboyvdlp commented 6 years ago

That's parasitic drag, not airspeed though, and the 1% figure is for the 172SP. But if you prefer not I can just make the effect.

gilbertohasnofb commented 6 years ago

Apologies, misread that. But that makes the effect even less pronounced I suppose.

wlbragg commented 6 years ago

in a J3 with an 85 hp engine. If the student was heavy and there were a lot of bugs, it wouldn't fly. Clean off the bugs and it would.

If parasitic buildup indeed does affect drag as much as you say it might. I can envision this scenario. At a few different point in the development process for both the j3 and 172 hydro, with the smaller engine, escape from the water was iffy depending on wind speed and overall weight. I can see where a small amount of extra drag could have a substantial influence, especially when on that edge. @gilbertohasnofb if drag caused by a dirty aircraft can be quantified, it is so very little code to add that drag to the FDM I would do it. It won't be a complicated nasal chunk of code. All it would be is a dirt effect norm parameter in a gain or switch statement tied on one end to the dirt factor and the other end to one line of code in the drag section of the fdm. When I add a full dirt system to the j3 I think I will for sure add the drag as the dirt builds up. Again, if it truly is quantifiable! I've been adding more and more minute drag features to the j3 as I go along, because it is so easy and fun to model these things. In the j3 I have extra drag added for the following

          <property>gear/drag-coef[1]</property> <!-- 36 Bush Wheels" -->
           <property>gear/drag-coef[2]</property> <!-- Floats -->
           <property>gear/drag-coef[3]</property> <!-- Amphibious -->
           <property>gear/drag-coef[4]</property> <!-- Ski -->
           <property>gear/drag-coef[5]</property> <!-- Ski Lite -->
           <property>gear/drag-coef[6]</property> <!-- Sprayer -->
           <property>gear/drag-coef[7]</property> <!-- Door Open/Off -->
           <property>gear/drag-coef[8]</property> <!-- Window Open/Off -->
           <property>gear/drag-coef[9]</property> <!-- Amphibious gear extended -->
gilbertohasnofb commented 6 years ago

Well if you want to do that go ahead, in particular if anyone can come up with concrete values. IMO anything which is unquantifiable is just hogging our system, regardless of being light on resources or not, and a few lines here can end up making a large chunk in a project that lasts for a long time. But this is just my view and I leave it totally to you guys.

wlbragg commented 6 years ago

anyone can come up with concrete values. IMO anything which is unquantifiable is just hogging our system,

I agree.

It wouldn't hurt to get a few more FDM people's input here on the worth of modeling or accounting for these small influences. Another way to look at it is, several small influences to the drag in the FDM can turn into a big influence. Personally I am inclined to go for authenticity. It is not quantifiable alone or at least in combination with other factors, then I say leave it out. But if it is then I would add it as it only increases the realism.

legoboyvdlp commented 6 years ago

I'm working on the Nasal side of this (not the FDM - couldn't find any quantifiable data).

Is adding 0.1 levels of damage per 10 minutes of flight (speed > 50 knots) acceptable? It will also have a slider and wash button as in the J3Cub.

gilbertohasnofb commented 6 years ago

FYI: not to complicate this but we have access to all of this

That's great we have access to that! @legoboyvdlp see if you would like to use that, but perhaps we should first implement the system itself for all terrain and then later consider to add a function to detect different terrains and change the dirt accumulation factor using that. But IMO we should really work first on the simple system as to get it right.

Another food for thought, I would take my time with this to do it justice. To do anything but a simple slider right now I think your going to mis out on making it nice. The biggest challenge I think will be the graphic textures we make for it.

I agree that we might need more time than we have right now, but as long as @legoboyvdlp doesn't mind that this might not make it into the release then we can continue to work on this (though at a low priority since we have many other things to finish before). But about the slider, I am completely against it for the reasons I explained. I would rather not have this being merged and slowly work on a proper dynamic system.

that also applies to the window glare effect we want. A big part of that being a real success depends on excellent graphics for the masks. [...] Oh, and the fuselage cutting and effect of oil would go hand in hand with this project. But I don't have the time to take it on right now. I don't want to rush either one of these effects.

No rush at all, I agree that we should postpone both of these. This is also a hectic period in RL for me.

wlbragg commented 6 years ago

But about the slider, I am completely against it for the reasons I explained. I would rather not have this being merged and slowly work on a proper dynamic system.

I agree with this, what I meant, is more that we could do a "simple and basic" system (maybe just time) for now if we're trying to get this in the release. But I'm not sure even that is going to look good enough without much time spent on the different dirt textures and mesh parts we may need. It would be a great addition to the next release after this one, after all we're going to need something to work on, right? :rofl:

legoboyvdlp commented 6 years ago

Well, I can finish the Nasal part anyway and leave it to you guys to do the rest of the 3d / 2d part, then it can be merged next release? How's that? :smile:

gilbertohasnofb commented 6 years ago

It would be a great addition to the next release after this one, after all we're going to need something to work on, right? rofl

Totally! :rofl:

Well, I can finish the Nasal part anyway and leave it to you guys to do the rest of the 3d / 2d part, then it can be merged next release? How's that? smile

Sounds great lego, there is no reason you cannot keep working on whatever you want. I think that @wlbragg's main concern was that you don't get disappointed if this doesn't make it into this very release.

legoboyvdlp commented 5 years ago

To be clear:

Dirt should only accumulate on the ground, (why not have dirt only occur in places where the wheels would throw dirt onto the fuselage?)

Dirt should accumulate faster on non-asphalt surfaces

And why not save the time when you shutdown the sum then measure the time difference and add a little dirt (over the whole aircraft) based on that. :)

Oil stains on the bottom probably would only occur when the oil is full, given oil consumption is apparently higher when full IIRC some must leak out? So, we would need a dirt map for the bottom fuselage, one near the wheels, and one for general dust? Bugs on the window would be nice but I understand that is not possible.

And it also needs to work on all variants. If you are on water with the amphitheatre variant the spray should wash the aircraft while the wheels should add dirt to the floats?

Haven't we got a tire smoke effect for dirt runways and the like, so maybe dirt could accumulate faster when that is active, and slower when it isn't and you are on the ground?

Sorry for the huge message, trying to sort out how to do this :)

wlbragg commented 5 years ago

All of this sounds reasonable to me.

legoboyvdlp commented 5 years ago

Any reason why we are using grain and grain-magnification instead of ALS's built-in dirt support?

http://wiki.flightgear.org/Howto:Add_effects_to_an_aircraft#Dirt

Just checking if there is a reason before I switch to the new way of doing dirt.

This is the reason why I was getting the dirt increasing in size instead of increasing in density... wheras dirt-factor should allow density to increase, maybe based on the alpha value of the dirt map?

Notice the ALS method also allows us up to three channels - e.g. we could have oil stains encoded in one, bugs in another, and general dust and dirt in another?

wlbragg commented 5 years ago

Any reason why we are using grain and grain-magnification instead of ALS's built-in dirt support?

Nope I didn't know the other existed. If you think it is a better fit, go for it. Verify that using canvas is not more overhead than the ALS dirt which is incredibly cheep. Also note the ALS examples for dirt that I ever used never had any custom textures created for our specific aircraft needs. Meaning if they looked bad it was probably because of the art.

legoboyvdlp commented 5 years ago

It's not using Canvas - its using the ALS dirt effect as opposed to the grain effect which is currently being used. The Vostok-1 is the only one using the ALS dirt effect (which is relativitely newer) that I know of so far. There may well be others?

wlbragg commented 5 years ago

Sorry @legoboyvdlp my mistake. I read it wrong. I wonder why the ALS Dirt effect isn't added to ALS Technical notes http://wiki.flightgear.org/ALS_technical_notes#The_grain_texture that is where I always turn for reference. I knew there was a dirt effect but only saw the "grain" and assumed it one in the same. Yes, we should use dirt effect. Good catch !

legoboyvdlp commented 5 years ago

@gilbertohasnofb @wlbragg I was wondering if either of you would have time to make any artwork?

As far as I see, the dirt has to be on the same texture as the aircraft (that is, unlike the grain texture it isn't going to be spread across the aircraft).

If we want just plain dirt, then it needs to be in the red channel, while alternatively if we also want oil etc (e.g. stains behind the exhaust accumulating over time?) it would need to be encoded in different channels.

If you can do the texturing of the dirt, I can start work on the system part - its long overdue, but I'll be free from Friday 😉

wlbragg commented 5 years ago

the dirt has to be on the same texture as the aircraft

I think you mean it has to be in the same location as the object to be textured is on the original texture sheet. But this will be a new texture sheet with dirt on the red channel and a different channel for a different substance. Same as the normals map or the interior lightmaps! If @gilbertohasnofb can do the textures even as a regular texture, I think I can get them to the correct channels on a new "dirt" texture sheet.

legoboyvdlp commented 5 years ago

Yep, that's exactly right - basically a light map for dirt :smiley: dirt-map?