Howto talk:Add effects to an aircraft

From FlightGear wiki
Revision as of 16:02, 25 June 2017 by I4dnf (talk | contribs)
Jump to navigation Jump to search

Some Disagreement

Quote: "Generally it is a good idea for textured models to use a white diffuse color (1,1,1) in the material and a grey ambient with a value of 0.3 to 0.5 according to the desired darkness of shadows. The specular color should usually be white (1,1,1) too, unless there's a compelling reason not to (a metallic material where specular color should match the diffuse color, or a lighter shade thereof). The most common mistake for beginners is to neglect the ambient channel, in which case shadows tend to appear too bright,..."

I have to disagree to the text above here.

1.) textured objects and especially untextured objects need the same ambient color as the diffuse color. A white diffuse color (1,1,1) with a different ambient color like (0.3,0.3,0.3) will appear grey when model shader is not applied. With model shader applied I don't see any difference on shadows with different ambient color setting. Since we support three different renderer, and an aircraft should at least support the two active maintained renderer DEFAULT and ALS with or without model shader applied, an ambient color of (1,1,1) for textured objects and equal diffuse color for untextured objects is recommended.

2.) the color of the specular can be used to simulate dull, matt painted surfaces like we will find on military aircraft or when the aircraft is getting dirty. The specular color should be than less than 0.5.

--HHS (talk) 09:30, 25 June 2017 (EDT)


I'm not sure this has anything to do with the model shader - ambient white color just gives me very bad appearance of unlit surfaces, regardless the renderer or the quality level.

I don't see why a white diffuse color with a grey ambient color would appear grey when the model shader is not applied. The default shader does a standard Blinn-Phong, and lit surfaces will get color values above 1 in all renderers - the lighting is very intensity saturated (in all renderers)

(Heck, I actually agree with you that conceptually the ambient color *should* be equal to the diffuse color and that the ambient light value should take care of everything... the problem is that the renderer has to come up with an ambient light value that renders /most/ models okay, and that has determined the ambient light we apply. If we would convert all models to unit ambient lighting, I could dial down the light in the renderers, and we'd be fine again. The situation is a mess as it stands, and I am very unhappy with it and am just trying to make the best out of it).

Thorsten (talk) 10:46, 25 June 2017 (EDT)


Here is the effect with model-shader en-/disabled, with ALS on/ off. I only set the model-shader to zero, everything else is higher than zero!
You can see the settings, the upper three values are the ambient color settings, which can be set per runtime on the c182s. The airport is Pennridge Airport KCKZ
Shows the effect of the ambient color settings with model shader applied en-/disabled, with ALS or Default.It does not show when shader-effects generally are disabled.


When shader-effects equal zero and ALS OFF you get the effect you described:
Ambient Color settings with shader effects equal zero, ALS off
(Funny sidenote: shader-effects = zero and ALS OFF gives less fps than shader-effects = zero and ALS ON)
--HHS (talk) 11:43, 25 June 2017 (EDT)
That's because texture is multiplied by ambient in the default shader[s]:
default.vert:
vec4 constant_term = gl_FrontMaterial.emission + ambient_color * (gl_LightModel.ambient + gl_LightSource[0].ambient);
gl_FrontColor.rgb = constant_term.rgb; gl_FrontColor.a = 1.0;
default.frag:
vec4 color = gl_Color; this is gl_FrontColor set in the .vert.
fragColor = color * texel + specular;
As for the specular, even then it is white, but multiplied with an intensity factor (for example that's how you'd set it up in blender, and the exporter would convert it by multiplying the color setting with the intensity). I meant to emphasize that _only_ metallic materials might have a "coloured" specular component.
I4dnf (talk) 12:01, 25 June 2017 (EDT)