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

Some objects on the panel are too brightly lit #1238

Open legoboyvdlp opened 5 years ago

legoboyvdlp commented 5 years ago

The vertical speed indicator, the needles, directional gyro, etc are all too brightly lit by the shadow effect.

This is apparently due to the rotate animation.

Workaround: reduce brightness on all these objects

gilbertohasnofb commented 5 years ago

@legoboyvdlp thanks for the report! (and don't forget your labels and milestones :wink: )

legoboyvdlp commented 5 years ago

image

wlbragg commented 5 years ago

That is a case where the bright objects are ALS effect and correct, the other objects that are darker are not ALS influenced and thus darker (incorrectly).

ALS Aircraft RollReference Anything that rotates non-ALS

This has been discussed ad nauseam and I have pleaded with Thorsten (OK that may be a bit strong) to get all the rotations added to ALS effect. But it isn't going to happen anytime soon, if ever.

So the correct answer is not to tone down the correct lighting, but in this case would be to brighten the incorrect lighting. I don't know how that could be done as you really don't know when the sun is behind you on the instruments.

gilbertohasnofb commented 5 years ago

@wlbragg I still think that if we darken the white needles a bit, either through texture or through the material properties, we can improve this situation a bit. I will make some experiments this weekend if I get a chance.

wlbragg commented 5 years ago

@wlbragg I still think that if we darken the white needles a bit, either through texture or through the material properties, we can improve this situation a bit.

Except then when those objects are not being calculated to be in the light, they will be really dark.

wlbragg commented 5 years ago

This incorrect lighting is on all objects that get rotated and don't have the shadow cube applied.

Think of it like this, no shadow cube - the face of the object must be getting light calculations from a vector pointing at the light source, in this case the sun. with shadow cube - same thing except the cubes dark and opaque surfaces are filtering the amount of that same light source. So I really don't see how to solve this. It's currently being discussed in the dev thread right now. Maybe Thorsten can shed some more light on it and I am possibly not understanding something else I could be doing.

gilbertohasnofb commented 5 years ago

So I really don't see how to solve this. It's currently being discussed in the dev thread right now. Maybe Thorsten can shed some more light on it and I am possibly not understanding something else I could be doing.

So let's leave this open for a bit longer and if Thorsten says this is not possible then we close it as won't fix. Sounds good?

wlbragg commented 5 years ago

@gilbertohasnofb from the forum

flat shading - always apply a 50% opaque shadow across a moving object it'll usually look okay for both shaded and unshaded background (if small enough)

This is smiler to your concept of changing the texture or darkening the white needles except we do it with the shadow cube that we apply to the moving objects. I'll make a cube as instructed and see if it is enough to satisfy our eyes.

wlbragg commented 5 years ago

@gilbertohasnofb @legoboyvdlp I made a shadow cube that is all 50% transparent as suggested an applied it to the panel objects that are rotated,

When you get some time please test and let me know what you think. If you think it helps or not. I didn't do a PR, just a branch Issue-1238.

gilbertohasnofb commented 5 years ago

@wlbragg I think this was a huge step forward. The gauges look much better IMO under most conditions. Under direct sunlight, they are substantially darker then before. But I think that the bright needles under shadow stood out much more (and thus looked far worse) than having darker needles under direct sunlight. On most instruments you don't have any true white for comparison, so they look natural even under direct sunlight, except for the AI, TC and HI, all of which have white parts which are non-moveable and thus look fully white. The result isn't bad at all and as I said is possibly better than what we had, but maybe we can still improve it a bit. Here are two screenies, one under shadow looking lovely, and one under sunlight showing my points above:

fg-1 fg-0

wlbragg commented 5 years ago

@gilbertohasnofb

For a comparison, the cube that is active now is a solid 50% opaque cube.

<positive-x>Aircraft/c172p/Models/Effects/interior/shadow-sudo_pz.png</positive-x>
<negative-x>Aircraft/c172p/Models/Effects/interior/shadow-sudo_pz.png</negative-x>
<positive-y>Aircraft/c172p/Models/Effects/interior/shadow-sudo_pz.png</positive-y>
<negative-y>Aircraft/c172p/Models/Effects/interior/shadow-sudo_pz.png</negative-y>
<positive-z>Aircraft/c172p/Models/Effects/interior/shadow-sudo_pz.png</positive-z>
<negative-z>Aircraft/c172p/Models/Effects/interior/shadow-sudo_pz.png</negative-z>

There is also one that is commented out that is identical to the regular shadow cube (black and white). Except where there was black it is now 50% opaque, the rest is white.

<positive-x>Aircraft/c172p/Models/Effects/interior/shadow-sudo_px.png</positive-x>
<negative-x>Aircraft/c172p/Models/Effects/interior/shadow-sudo_nx.png</negative-x>
<positive-y>Aircraft/c172p/Models/Effects/interior/shadow-sudo_py.png</positive-y>
<negative-y>Aircraft/c172p/Models/Effects/interior/shadow-sudo_ny.png</negative-y>
<positive-z>Aircraft/c172p/Models/Effects/interior/shadow-sudo_pz.png</positive-z>
<negative-z>Aircraft/c172p/Models/Effects/interior/shadow-sudo_nz.png</negative-z>

I don't know if that is more appropriate as the darkening will only happen when the shadow is cast across the face. But then it is the same thing as the regular shadow cube only not so strong. The incorrect shadow on the rotations will still be wrong.

wlbragg commented 5 years ago

By the way, this was the first, most simplest of possible solutions per Thorsten. This was the entire response to the question, "How do we fix it"?

  • flat shading - always apply a 50% opaque shadow across a moving object - it'll usually look okay for both shaded and unshaded background (if small enough(

  • declare a separate effect file for the moving object. The effect takes the cube center relative to the object coordinates and at least one rotation (we conceptually can extend to three). Make these coordinate offsets properties, when you translate the object change the properties such that the shadow remains correct (since you are free to assign rotations in arbitrary sequence and mix with translations, getting the same result for a fixed rotation/translation sequence might be tough math - but conceptually it's possible)

  • sit down and solve the math to do the whole thing in eye coordinates inside the shader code, if you manage, it'll work regardless of what transformations are applied (I don't remember if that was merely 'really difficult' or actually 'impossible' with the information the core provides to shaders, but the latter could potentially be fixed)

wlbragg commented 5 years ago

The second suggestion I have done with fixed translations of absolute positioned objects. What I didn't do or realize was you could potentially do it with a moving translation and I also didn't know you could conceivable do it with one rotation which is really all we should need. I need to take some time with this and see if i can get it to work. If this works as I understand it should, then we could conceivably have a regular shadow cast on everything.

wlbragg commented 5 years ago

The third option is in my opinion the correct fix for this. It is what I have been trying to get Thorsten to do. Apparently it is no easy solution or he would probably have already done it. I have a son who just got his Masters in math and another son with a major in computer science and is one of the most gifted programmers I know, (I taught him everything he knows, "NOT", I wish). You'd think I could get the math solved and the equations put into the shader with that kind of available talent.

gilbertohasnofb commented 5 years ago

@wlbragg The third option would be the best way to go, for sure. Let's hope Thorsten will figure it out after taking another shot at it.

You'd think I could get the math solved and the equations put into the shader with that kind of available talent.

:rofl: You could make use of your fatherly ~authority~ charm and simply ~force~ request them to write the shader for us!