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

Add glass reflection visible from external view #314

Closed onox closed 8 years ago

onox commented 9 years ago

Duplicate the glass and give it a very small distance from the interior glass, so that there is no z-fighting. Add an effect based on Effects/model-combined-transparent.

Tune the parameters to get something like: http://tigert.1g.fi/kuvat/MIK/2006-07-30-parnu/_DSC2655.jpg

gilbertohasnofb commented 9 years ago

Is this possibly related to #13 or not at all?

onox commented 9 years ago

This is about the large windshield and the glass in the doors. I just noticed there is already a "glas" object. ("glas_interior" and "glas_interior_sides" are for the interior).

And now I notice Models/Effects/glass.eff does already exist! :open_mouth:

onox commented 9 years ago

@wlbragg It seems object "glas", "leftwindow", and "rightwindow" have a Effects/interior/c172p-interior-glass-shadow effect applied to them. What does this do? If I remove that effect and try to apply Effects/glass to them, I'm not getting any reflection at all. Are the normals pointing outward?

wlbragg commented 9 years ago

rightwindow.. have a Effects/interior/c172p-interior-glass-shadow effect applied to them. What does this do?

interior-glass-shadow applies the cubemap shadow to glas leftwindow rightwindow.

interior-glass-reflection-front applies the cubemap reflection to glas_interior.

interior-glass-reflection-side applies the cubemap reflection to leftwindow_interior rightwindow_interior glas_interior_sides

glas_interior and glas are duplicate, offset, front windows (only one effect per window) same with leftwindow, rightwindow and glas_interior_sides leftwindow_interior rightwindow_interior

interior rain visual is applied through reflection effect (I think).

outside rain effect and sky reflection is already applied through bumpspec "Effects/model-combined-deferred"

Did it get broke along the way?

onox commented 9 years ago

No I mean this:

fgfs-screen-338

Look at the rainbow reflection on the canopy. That should be handled by Models/Effects/glass.eff in our repository, but when I tried to apply it to the "glas" object, I didn't see the cool reflection.

onox commented 9 years ago

Is this cube map shadow thing an ALS effect to be seen from inside the cockpit or from external views?

onox commented 9 years ago

outside rain effect and sky reflection is already applied through bumpspec "Effects/model-combined-deferred"

Transparent objects need to use Effects/model-combined-transparent (which is used by Models/Effects/glass.eff) not Effects/model-combined-deferred as far as I know.

onox commented 9 years ago

glas_interior and glas are duplicate, offset, front windows (only one effect per window)

You say they are duplicate, but shouldn't the normals be opposite? Normals pointing inwards for "glas_interior" and outward for "glas".

wlbragg commented 9 years ago

Everything I posted except bumpspec is all internal.

wlbragg commented 9 years ago

Internal shadows and internal reflection and rain drops. OK, rainbow, yes I am familiar with it. Give me a second to look at it and see what I know about it.

wlbragg commented 9 years ago

I just noticed this

Any surface using the glass effect will automatically register itself as transparent for use in Rembrandt.

onox commented 9 years ago

I don't know much about all these ALS effects, but to me it looks like you need an "interior" glass that uses Effects/glass for fancy windshield rain/fog effects + another "interior" glass that uses Effects/model-interior for cockpit shadow + an "exterior" glass that uses Effects/model-combined-transparent for shiny rainbow canopy effect?

I have read on the wiki about needing two glass objects (1x "interior" and 1x "exterior"), but now it seems we need 2x "interior" + 1x "exterior" :confused:

wlbragg commented 9 years ago

The recommended effect for glass surfaces seen from outside is model-combined-transparent.eff.

Appears so.

wlbragg commented 9 years ago

I'm familiar with a lot of it but there is "A LOT OF IT"!

onox commented 9 years ago

I'll ask Thorsten if he can check whether we're using all those ALS effects correctly.

wlbragg commented 9 years ago

This is the bumpspec http://wiki.flightgear.org/index.php?title=Howto:Aircraft_reflection_shader&redirect=no

Do you know where the docs for rainbow are?

onox commented 9 years ago

Probably here: http://wiki.flightgear.org/ALS_technical_notes

wlbragg commented 9 years ago

Unrelated: http://wiki.flightgear.org/Howto:Glass_reflection_effect_for_instruments

wlbragg commented 9 years ago

I thought it was there too but don't see it.

onox commented 9 years ago

I've send a PM to Thorsten, hopefully he can tell if we're doing anything wrong.

wlbragg commented 9 years ago

Here is the forum thread showing it being used and the threads leading up to it. http://forum.flightgear.org/viewtopic.php?f=47&t=25456&start=75#p235963

wlbragg commented 9 years ago

http://forum.flightgear.org/viewtopic.php?f=47&t=25456&start=90#p236002 Is this what you tried?

wlbragg commented 9 years ago

This is similar to bumpspec.eff, I didn't add the bumpspec.eff that already existed and that is where I got deferred instead of transparent.

onox commented 9 years ago

It could be that the interior effect (for shading) can be applied to the "glas_interior" object (which has normals pointing inward AFAIK) and then we flip the normals of "glas" (that's the outer glass object) and apply the shiny rainbow reflection effect to it :smile:

But Thorsten needs to answer this because I'm guessing here.

wlbragg commented 9 years ago

No glas is for shadows, can't use it. We have to have two layers for internal effects.

wlbragg commented 9 years ago

I just switched the bumpspec to inherit transparent instead of deferred and it still looks to be applying the bumpspec and external reflections correctly. Still lots to look at though. I need to check external rain, etc. and do some image comparisons.

wlbragg commented 9 years ago

Yes, I am sure Thorsten can answer this in a few seconds.

wlbragg commented 9 years ago

bumpspec to inherit transparent instead of deferred and it still looks to be applying the bumpspec and external reflections correctly

This is all fuselage objects, not glass. Why use one over the other? If we can use transparent to fuselage objects, why not just add glass to it. My next test.

wlbragg commented 9 years ago

I have a feeling we are going to need another layer for external effects.

wlbragg commented 9 years ago

onox, you still there?

wlbragg commented 9 years ago

Try adding the object glas to line 291 in Models/c172p.xml ...

is that what your looking for?

onox commented 9 years ago

@wlbragg No, that's the Effects/model-interior effect. I want "glas" to have the Models/Effects/glass.eff effect. But when I tried it, it didn't work.

I have a feeling we are going to need another layer for external effects.

That's what I'm confused about as well. Do we need 1x external glass + 2x internal glass or 1x external (shiny rainbow reflection) + 1x internal (interior + rain/fog effects)?

And now I'm going to watch TV!

wlbragg commented 9 years ago

brain fart!

wlbragg commented 9 years ago

No, that is model-transparent and it inherits from model-transparent.

glass.eff inherits from model-combined-transparent

wlbragg commented 9 years ago

Try it and look at the glass reflection on the outside, I think that is what your looking for and as far as I can tell it isn't breaking anything but I am not sure were suppose to be able to apply two different effects to the same glass unless it is because it is two sided?

wlbragg commented 9 years ago

There is a file in Models/Effects/ called glass.eff, I am not sure where or when that file got put there. It may have been by me, but I think it is not being used by anything Unless that is what the code block defining the following starting at line 374 is using. landinglightcover landinglightcoverLD landinglightcoverRD landinglightcoverBD landinglightcoverCollapse.

I am pretty sure the internal glass reflections inherit directly from fgdata/effects/glass and it is possible so can the above.

onox commented 9 years ago

This is what Thorsten said in a PM (I think he would have no problem with this post being public):

Glass should always be single-sided surfaces anyway to avoid trouble (or so Emilian says).

So you have one glass layer from outside, one from inside.

The outside layer for the rainbow should use model-combined-deferred.eff (because that does fogging and all the stuff you see from outside), the inside layer should use glass.eff (because that does the forward light scattering effects which you can only see from inside).

wlbragg is using model-interior.eff in addition to get the impression of a shadow falling onto the interior glass - something that I had not intended at all, but which looks neat nevertheless. You don't need that though. Eventually, I might also add the support for the interior shadow to the glass effect.

onox commented 9 years ago

So if we decide to not have shadow falling onto the interior glass, we should flip the normals of "glass", "leftwindow", and "rightwindow". And then on lines 353 of Models/c172p.xml use Effects/glass?

onox commented 9 years ago

I tried to do it myself and export to c172p.ac file, but the whole model became ugly and appeared with the wrong cockpit livery, so better drop this issue if you don't consider yourself a Blender guru :smile:

wlbragg commented 9 years ago

Maybe this will help a little. effects

There are other things attached to each of these effects.

wlbragg commented 9 years ago

I noticed with the Cessna 172P detailed that the glass dosen't really show.

from http://forum.flightgear.org/viewtopic.php?f=4&t=25157&start=2055#p247971

onox, please try my suggestion above

Try adding the object glas, leftwindow and rightwindow to code block around line 291 in Models/c172p.xml <!-- Transparent Surfaces for Rembrandt rendering -->

and let me know what you think. I don't think this includes the rainbow effect but it does appear to correct this users observation and I don't think there is a negative effect in doing this, (I have to verify this). It may be that we want the full glass effect with rainbow and the likes as you pointed out. But for now I am really curious what you think about this effect on the glass.

onox commented 9 years ago

If I do that I don't see any difference.

wlbragg commented 9 years ago

Mine does, it looks like it puts some kind of reflection or noise on it. It is subtle and I can only see it at an angle.

onox commented 9 years ago

In Rembrandt? To be honest I only checked for differences under ALS.

wlbragg commented 9 years ago

No, in ALS.

wlbragg commented 8 years ago

The outside layer for the rainbow should use model-combined-deferred.eff (because that does fogging and all the stuff you see from outside), the inside layer should use glass.eff (because that does the forward light scattering effects which you can only see from inside).

Your post from Thorsten. Remember we just switched deferred to transparent. I'm going to keep at this until we get it.

onox commented 8 years ago

On the wiki it recommends model-combined-transparent:

The recommended effect for glass surfaces seen from outside is model-combined-transparent.eff.

wlbragg commented 8 years ago

@onox, I really think we have this as good as it can be with the shape of our glass. I studied several aircraft that look good and have tried the settings they used (all slightly different). I made some more adjustments and I think this is done. See #521

ref1 ref2 ref3 ref4 ref5

onox commented 8 years ago

It's mainly the lack of reflection on the front window I'm concerned about. See for the V-22 for example:

fgfs-screen-303 fgfs-screen-304

onox commented 8 years ago

Perhaps we should ask Thorsten on the mailing list to test our aircraft and tell us if we're asking ALS to do the impossible or whether we made some stupid mistake.