Howto talk:Add effects to an aircraft

From FlightGear wiki
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)


Okay, would you be fine with a suggestion to check the ambient color / non-lit surface relation to make sure the shadows come out okay when making a model :::without any suggestions of values?
Personally, I've never been able to make ambient white work to my satisfaction in any renderer (which, again, likely means only that the lighting balance isn't optimal).
Thorsten (talk) 12:53, 25 June 2017 (EDT)

Another suggestion

Quote: "Objects are parts of a 3d model which are grouped together. They consist of a mesh, material[s] assigned to the faces of that mesh and, optionally, the texture associated with it. They have a unique name assigned. In the FG effect framework, an effect is always assigned to an object. ..." The first sentence leads in the following to some misunderstanding. Suggestion: "A 3d-model is made of at least one or more objects. An Objects consists a mesh, material[s]..."

"The relevance of grouping into objects..." sounds like it would happen in the GPU or by OSG. That's not correct. The GPU doesn't group it, you have to do it yourself. You can join different objects to one object by press Ctrl+J in Blender. Or you can group different objects to one object Ctrl+G. This allows to still animate one of this grouped objects, but keeping the load for the gpu low. Advantage: A complex aircraft like a helicopter with different animated parts as an example EC 135 P2.

--HHS (talk) 12:51, 28 June 2017 (EDT)

If you animate one object of a group, it needs its own unique set of transformation matrices - hence it triggers a new draw with these matrices. Regardless of the grouping - so I'm not sure it does internally what you hope to achieve.
Thorsten (talk) 13:17, 28 June 2017 (EDT)
Actually liveries are loaded much faster. It was a tip of some our OSG/ Graphics gurus we had in the past. Can't remember if it was xiii, Tim Moore or I4dnf.
It seems the source disappeared.
--HHS (talk) 13:54, 28 June 2017 (EDT)