Board index FlightGear Development Scenery

SketchUp Models Single/Double Sided

Questions and discussion about enhancing and populating the FlightGear world.

SketchUp Models Single/Double Sided

Postby VicMar » Mon Jul 18, 2011 3:24 pm

Scenery models made in SketchUp and exported direct to .ac using the Skp to .ac exporter (compiled by Zakalawe and modified by D-79), are causing an avoidable drop in fps rates.

I have altered the exporter slightly, to make the model 'faces' single sided, rather than double sided. With single sided models, if you look from inside the object, or from underneath, the 'wrong side' of faces are invisible. If you do the same with double sided models you can see the 'wrong' side of the faces.

To test the effect this has made, I made a very simple model (a cube, coloured red, with no face underneath) in SketchUp which was exported direct to .ac using the Skp to .ac exporter. This model showed in FG as double-sided, i.e. both sides of each face were visible and had to be rendered by FG.

I made a copy of that model and exported it exactly the same way except that it was exported using the new version of the exporter.

For comparison, I placed 6 of the double-sided models in a bunch in the middle of an EGKA runway, my fps dropped from 60 to 40.

When I did the same with the single sided models, my fps only dropped from 60 to 50.

I think this is a considerable saving on fps, particularly when approaching an airport, where it can be expected a number of airport buildings may have been placed.

My testing has been on an iMac, running OSX 10.5.8.

I would appreciate it if someone using the other operating systems would run a few tests for me.

There are 2 main things which need to be taken into account.
1. Some semi-transparent and transparent textures do not render correctly. There is also the possibility that any opposite faces seen through another texture will be invisible. Because of this, though there is a work around which is a pain to do (given if you ask for it), I recommend the new version of the exporter is not used on buildings where there are see-through textures involved. I would like to know if this problem also exists on the other OSs, so by all means try a model with see-through textures as well please.

EDIT2. When both the old and new exporters are in the SketchUp 'Plugins' folder, on Mac at least, the new version is used by default. I would like to know if this is the same with other OSs please. I am trying to find out if there is a way for both exporters to be offered in the menu, but currently only 1 is.This item has been cured in the latest download version.


The new version is named: ac3dS_export.rb and can be downloaded from http://vicmar.weebly.com/downloads.html

Please let me know how it goes.

Cheers,
Vic
Last edited by VicMar on Mon Jul 18, 2011 10:01 pm, edited 1 time in total.
Time flies like an arrow
Fruit flies like a banana
User avatar
VicMar
 
Posts: 2045
Joined: Sun Apr 06, 2008 5:53 pm
Location: Lancing. UK (EGKA)
Callsign: VicMar
Version: 2018.3.1
OS: OS X 10.12.6

Re: SketchUp Models Single/Double Sided

Postby i4dnf » Mon Jul 18, 2011 4:56 pm

Hi Vic.
I think I found the way to make it appear differently in the menu:
at the end of the script replace this:
Code: Select all
if ($ac3d_export_loaded != true)
  UI.menu("Plugins").add_item("Export to AC3D") { AC3D::export }
  $ac3d_export_loaded = true
end

with this
Code: Select all
if ($ac3dfg_export_loaded != true)
  UI.menu("Plugins").add_item("Export to AC3D (FlightGear)") { AC3DFG::export }
  $ac3dfg_export_loaded = true
end

and also replace the line (should be line 19):
Code: Select all
module AC3D

with
Code: Select all
module AC3DFG


Unfortunately I don't have sketchup to test, but in principle it should work.
i4dnf
Retired
 
Posts: 743
Joined: Wed Sep 09, 2009 7:17 am
Location: LRBS
Callsign: YR-I4D
Version: GIT
OS: Gentoo Linux ~amd64

Re: SketchUp Models Single/Double Sided

Postby VicMar » Mon Jul 18, 2011 6:34 pm

Excellent. Thanks for the tip.

I am off to try it out now.
Time flies like an arrow
Fruit flies like a banana
User avatar
VicMar
 
Posts: 2045
Joined: Sun Apr 06, 2008 5:53 pm
Location: Lancing. UK (EGKA)
Callsign: VicMar
Version: 2018.3.1
OS: OS X 10.12.6

Re: SketchUp Models Single/Double Sided

Postby Gijs » Mon Jul 18, 2011 6:38 pm

All we need now is an option in the rightclick-menu/context-menu to set a face to "double sided", just like Blender :D
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9374
Joined: Tue Jul 03, 2007 2:55 pm
Location: Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: SketchUp Models Single/Double Sided

Postby i4dnf » Mon Jul 18, 2011 6:53 pm

Gijs, Sketchup faces are doublesided always. In fact internaly (in sketchup), a face can have different materials on it's 2 opposing sides (i.e. from the inside yellow, from outside blue, and it's still the same face). This is a very nice feature I believe, but might give headaches when using sketchup for modelling ;).
i4dnf
Retired
 
Posts: 743
Joined: Wed Sep 09, 2009 7:17 am
Location: LRBS
Callsign: YR-I4D
Version: GIT
OS: Gentoo Linux ~amd64

Re: SketchUp Models Single/Double Sided

Postby VicMar » Mon Jul 18, 2011 7:05 pm

OK.
I have incorporated i4dnf's change into the newest version. Come to think of it, he has contributed more to this exercise than I have so far. It is much appreciated.

You can now have the original exporter, and the new version at the same time.

The new version is the one which says 'Single_Faced' in brackets.

The download of this tweaked version is in the same place as before.

@ Gijs,
I think I will have to ask SketchUp for that option. If they would even consider it, I dare say it would go into the pro version, and even then I wouldn't expect it to be developed soon. I know there is an option when you export to Collada (.dae) to have single or double sides, but we (FG modelers) have that option now anyway. Picking individual faces would be much more of a change. However, I'm game. I will put it forward as a suggested improvement. I'll wait a bit though, just in case we come up with any more suggestions to add in.

Cheers,
Vic
Time flies like an arrow
Fruit flies like a banana
User avatar
VicMar
 
Posts: 2045
Joined: Sun Apr 06, 2008 5:53 pm
Location: Lancing. UK (EGKA)
Callsign: VicMar
Version: 2018.3.1
OS: OS X 10.12.6

Re: SketchUp Models Single/Double Sided

Postby Gijs » Mon Jul 18, 2011 7:45 pm

I know SU faces are doublesided by default, I meant an option to set whether the AC-exporter should export a face as doubleside, or singlesided. That doesn't require any support from the SketchUp-team, but I guess it gives quite a headache to store the setting for each single face, prior to exporting... Probably not worth it ;)

@Vic, feel free to upload your file to the wiki and incorporate it in the article: http://wiki.flightgear.org/SketchUp_to_AC3D_exporter
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9374
Joined: Tue Jul 03, 2007 2:55 pm
Location: Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: SketchUp Models Single/Double Sided

Postby i4dnf » Mon Jul 18, 2011 7:49 pm

Or you could separate the parts that use textures with alpha, and export them separately with the other exporter, and then import the 2 objects in blender to make them a single file again.
i4dnf
Retired
 
Posts: 743
Joined: Wed Sep 09, 2009 7:17 am
Location: LRBS
Callsign: YR-I4D
Version: GIT
OS: Gentoo Linux ~amd64

Re: SketchUp Models Single/Double Sided

Postby VicMar » Mon Jul 18, 2011 7:59 pm

i4dnf comes up with yet another work around. :D
I can't test it because I can't remember how to get my textures into Blender.

I will try to make my work around understandable, then add that, along with the new exporter version, to the wiki.

Mean time all feedback welcomed.

Cheers,
Vic
Time flies like an arrow
Fruit flies like a banana
User avatar
VicMar
 
Posts: 2045
Joined: Sun Apr 06, 2008 5:53 pm
Location: Lancing. UK (EGKA)
Callsign: VicMar
Version: 2018.3.1
OS: OS X 10.12.6

Re: SketchUp Models Single/Double Sided

Postby i4dnf » Mon Jul 18, 2011 8:25 pm

As long as the textures are in the same folder as the .ac file, blender loads them just fine. Otherwise you'll see pink patches if there should be a texture and blender can't find it, but blender won't touch the data by itself, i.e. it will keep the reference to the texture even though it can't load it.
ALT+z switches you to textured view mode in blender.
Glad I could help ;)
P.S. @Vic, you should edit the first post and note that the 2nd issue was fixed, if it was fixed ;).
i4dnf
Retired
 
Posts: 743
Joined: Wed Sep 09, 2009 7:17 am
Location: LRBS
Callsign: YR-I4D
Version: GIT
OS: Gentoo Linux ~amd64

Re: SketchUp Models Single/Double Sided

Postby VicMar » Sat Jul 23, 2011 9:41 am

Here is my latest (and easiest) version of the work around for semitransparent (ST) textures:

1. Export your model with the old exporter first.
2. Name the resulting .ac file for reference, but not with your model name.
3. Export your model again using the new exporter version and name it for use in FG.
4. Identify your ST texture in both versions, and copy the old version from the ST's 'numsurf' to the last entry 'kids' inclusive.
4a. If, at this point you find the materials have different mat numbers, you will have to use the old exporter version, unless you want to change the SURF numbers yourself. The mat numbers will usually be identical unless you are resubmitting an old model with significant changes.
5. Paste those over the same data in the new version.

That will have changed the SURFs for each set of locations from 0x10 to 0x30, which will make your STs look the same as with the old exporter.

If there are only a few SURFs to change, you can do that by hand, but it sure is a chore. Previously this was the long-winded way which I didn't want to announce. Especially if there were hundreds of numserfs which needed conversion.

I hope that helps.

Cheers,
Vic
Time flies like an arrow
Fruit flies like a banana
User avatar
VicMar
 
Posts: 2045
Joined: Sun Apr 06, 2008 5:53 pm
Location: Lancing. UK (EGKA)
Callsign: VicMar
Version: 2018.3.1
OS: OS X 10.12.6


Return to Scenery

Who is online

Users browsing this forum: No registered users and 0 guests