Board index FlightGear Development Aircraft

reversed lighting issue

Questions and discussion about creating aircraft. Flight dynamics, 3d models, cockpits, systems, animation, textures.

reversed lighting issue

Postby TWRackers » Mon Oct 01, 2007 8:03 pm

I have a model file in VRML 1.0 format of a vehicle which should be rendered in a uniform shade of gray. For some reason FlightGear (current version) is showing the highlights from the sun on the wrong side of the vehicle, i.e. the side that should be shadowed. Any hints on what might be going wrong here? Is it likely (a) a FlightGear problem, or (b) a VRML file problem? I tried importing the file into Blender and exporting it as a .ac file, but that completely screwed up the rendering on FlightGear (whole panels disappeared).
TWRackers
 
Posts: 25
Joined: Mon Oct 01, 2007 7:57 pm

Postby DFaber » Tue Oct 02, 2007 6:54 am

Hello TWRackers,

sounds like you have a problem with the direction of normals.

Try to recalculate the normals in blender (in Edit Mode, Viewport menu "Mesh", then "Normals" and "recalculate outside". You can see the Effect in UV Face select mode.


Greetings

Detlef Faber

http://www.sol2500.net/flightgear
DFaber
 
Posts: 687
Joined: Fri Dec 01, 2006 7:51 pm
Location: Aachen, Germany
Version: GIT
OS: Linux

Postby TWRackers » Wed Oct 03, 2007 4:34 pm

Thanks for the tip. I tried your tip using Blender, exported the model as a new .ac file, and also as a new copy of the .wrl (VRML 1.0) file. Both new files CRASH FlightGear completely without displaying any sort of error message. Now what do I do? Note that I'm relatively new to FlightGear, and completely new to Blender.
TWRackers
 
Posts: 25
Joined: Mon Oct 01, 2007 7:57 pm

Postby DFaber » Thu Oct 04, 2007 6:27 am

Strange, I never heard of a model actually killing FlightGear. Is it possible for you to upload the model and post a link here?
Icould have a look then.

Greetings

Detlef Faber

http://www.sol2500.net/flightgear
DFaber
 
Posts: 687
Joined: Fri Dec 01, 2006 7:51 pm
Location: Aachen, Germany
Version: GIT
OS: Linux

Postby TWRackers » Thu Oct 04, 2007 9:09 pm

Unfortunately, no, not without some form of non-disclosure agreement, and it's not worth the trouble. Maybe I'll pursue it some day in the future. Thanks anyway for the tips.
TWRackers
 
Posts: 25
Joined: Mon Oct 01, 2007 7:57 pm

Postby TWRackers » Thu Oct 04, 2007 11:14 pm

Okay, pardon my venting, but how on earth does anyone make sense out of these 3D models?

I was given a VRML 1.0 file to work with. Shape is right, but the illuminated surfaces are the ones facing AWAY from FlightGear's sun. So I tried changing the various color settings in the VRML file. FlightGear completely ignores them all; I couldn't get the appearance of the model to change in the least. FlightGear has decided it's going to be shades of gray with backwards highlights and that's that.

So I import the model imto the current version of Blender and export it as an .ac file. Now vehicle is rotated around, many panels are missing, those that are present still appear to be lit up on wrong side. Following tip in earlier post, attempt to recalculate normals to outside, re-export as .ac file. No affect whatsoever. It's as if nothing was changed in model. Admittedly, I couldn't see anything change in Blender either.

Try exporting model as .dxf file. Now all panels are visible, but are solid flat black. Model is now a stealth aircraft. And axes are rotated odd. Rotate model inside Blender, re-export as .dxf. Nothing has changed, vehicle is still rotated same as before. FlightGear is ignoring any orientation information in .dxf file.

FlightGear homepage says it accepts .ac files, .dxf files, VRML 1.0 files, and others. Can't find list of what "others" are. Reference to "plib" web site tells me nothing.
TWRackers
 
Posts: 25
Joined: Mon Oct 01, 2007 7:57 pm

Postby DFaber » Fri Oct 05, 2007 6:48 am

I guess you still have your faces normals reversed. The sun shines on the right side of your plane and those vertices are lit, but the face is only visible when watched from the left side.

Blender displays faces as double sided while you are in edit mode. But in FG the faces are only single sided.

For a start, get the model into blender, enter edit Mode and hit "a" to select all vertices. Now just klick on the "flip normals" button in the Mesh Tools panel.

The axes are correct for FG display if you have the front of your model in Blenders side view, and the side of your model in Blenders front view. You may wish to rotate the model to fit, or specify a <yaw-offset-deg> in the models .xml file.
To rotate the model in blender hit "r", then the axis you wish to rotate around and after that the degrees (r-x-90, for example)

To check the Appearence, try changing to UV Face select Mode and hit "a" to select all faces.
Now look at the mesh and check the aligning of the Faces. If there are Faces you can see through, they are reversed. Go back to edit mode, select the Vertices that make up the face and hit the "flip Normals" button.

Now re-export your Model to .ac

Greetings
Detlef Faber
FlightGear Development:
http://flightgear-de.net

German FlightGear Forum
http://forum.flightgear-de.net
DFaber
 
Posts: 687
Joined: Fri Dec 01, 2006 7:51 pm
Location: Aachen, Germany
Version: GIT
OS: Linux

Postby TWRackers » Fri Oct 05, 2007 4:10 pm

Okay, in UV Face mode I could see the faces flipping if I recalculated inside, then outside. I then re-exported to a .ac file and changed my .xml file to refer to the .ac file instead of the .wrl file. When I run FG, at the point it's loading the aircraft it prints "Unknown exception in the main loop. Aborting..." and dies. What could cause that?
TWRackers
 
Posts: 25
Joined: Mon Oct 01, 2007 7:57 pm

Postby AndersG » Fri Oct 05, 2007 4:26 pm

TWRackers wrote:Okay, in UV Face mode I could see the faces flipping if I recalculated inside, then outside. I then re-exported to a .ac file and changed my .xml file to refer to the .ac file instead of the .wrl file. When I run FG, at the point it's loading the aircraft it prints "Unknown exception in the main loop. Aborting..." and dies. What could cause that?


Check your XML file for syntax errors. Those can sometimes cause such problems. xmllint or similar are very useful tools when working with XML files for FlightGear. You can also try to feed fgfs the parameter --log-level=debug to (maybe) get a better idea of what happens right before the crash.

/Anders
AndersG
 
Posts: 2433
Joined: Wed Nov 29, 2006 9:20 am
Location: Göteborg, Sweden
Callsign: SE-AG
OS: Debian GNU Linux

success at last (more or less)

Postby TWRackers » Fri Oct 05, 2007 4:33 pm

I re-exported the same model to a new VRML 1.0 file, which generated the same error. After manually editing the .wrl file and removing everything which FG objected to before it died, I finally got FG to accept the file, and the lighting is finally correct. But I think it's turned around 180 degrees, so I have to address that now. Getting closer....
TWRackers
 
Posts: 25
Joined: Mon Oct 01, 2007 7:57 pm

Postby AndersG » Fri Oct 05, 2007 4:39 pm

Adjusting the position and orientation of the model can be done by an <offset>-element following the <path>-element in the model xml file. E.g.

<offsets>
<heading-deg>-10</heading-deg>
<pitch-deg>10</pitch-deg>
<roll-deg>42</roll-deg>
<x-m> 39.60 </x-m>
<y-m> 0.40 </y-m>
<z-m> -19.55 </z-m>
</offsets>

Have you found data/Docs/model-howto.html yet?

/Anders
AndersG
 
Posts: 2433
Joined: Wed Nov 29, 2006 9:20 am
Location: Göteborg, Sweden
Callsign: SE-AG
OS: Debian GNU Linux

Postby TWRackers » Fri Oct 05, 2007 4:48 pm

AndersG wrote:Adjusting the position and orientation of the model can be done by an <offset>-element following the <path>-element in the model xml file. E.g.

<offsets>
<heading-deg>-10</heading-deg>
<pitch-deg>10</pitch-deg>
<roll-deg>42</roll-deg>
<x-m> 39.60 </x-m>
<y-m> 0.40 </y-m>
<z-m> -19.55 </z-m>
</offsets>

Have you found data/Docs/model-howto.html yet?

/Anders
I'm constantly getting contradictory instructions as to whether the tag should be <heading-deg> or <heading-offset-deg> or <yaw-offset-deg> or whatever. In this case <heading-deg> was the only one that worked. I haven't found the howto you mentioned; is it on my system? I haven't looked.... Oh, there it is, except it's under Docs-mini. I'll have to take a look at it. Thanks for the tips.
TWRackers
 
Posts: 25
Joined: Mon Oct 01, 2007 7:57 pm

Postby AndersG » Fri Oct 05, 2007 5:20 pm

TWRackers wrote:I'm constantly getting contradictory instructions as to whether the tag should be <heading-deg> or <heading-offset-deg> or <yaw-offset-deg> or whatever. In this case <heading-deg> was the only one that worked.


Yes, the source of that confusion is that in view configurations (usually in the -set.xml file for an aircraft) the offsets are named <heading-offset-deg> etc. ..

/Anders
AndersG
 
Posts: 2433
Joined: Wed Nov 29, 2006 9:20 am
Location: Göteborg, Sweden
Callsign: SE-AG
OS: Debian GNU Linux


Return to Aircraft

Who is online

Users browsing this forum: No registered users and 2 guests