Page 3 of 6

Posted: Fri Jun 11, 2010 3:16 pm
by Griff
oops, sorry DH, i hadn't read the thread properly, i was lolling at the cargo pod bigger than the ship bit but didn't twig it was because the ship was already converted.
yes, i think there was copy of the script.js still accidentally left in the thargoids oxp, just copy that into your oxps config folder, edit it and change the role = bit so it matches your ships role in your oxp's shipdata.plist

Posted: Fri Jun 11, 2010 11:04 pm
by DaddyHoggy
OK, so thanks to Griff, Tycho 8 is in game.

But - lighting seems to be very odd - I've checked in AC3D and all the normals appear to be facing outwards and at the angles I'd expect them to be but this doesn't appear to be true for the model in-game (note the cylindrical spikes on the end of the wing tips - uniformly lit)

Image

On the other side its even worse - two surfaces appear to be completely missing around where the wings enter the body of the ship, but again in the original .ac model they appear and the normals appear to be facing outwards.

Image

Have I done something wrong - or is this a potential conversion issue from AC3Ds conversion of native .ac to .obj file and subsequent conversion to a .dat?

Final (semi-related) question regarding lighting - is there a way to get Oolite to smooth the shading between facets?

Posted: Fri Jun 11, 2010 11:21 pm
by DaddyHoggy
Hmmm, the more I look, the more facets seem to be missing...

:cry:

Image

Posted: Fri Jun 11, 2010 11:37 pm
by JensAyton
DaddyHoggy wrote:
But - lighting seems to be very odd - I've checked in AC3D and all the normals appear to be facing outwards and at the angles I'd expect them to be but this doesn't appear to be true for the model in-game (note the cylindrical spikes on the end of the wing tips - uniformly lit)
There are several possible reasons. Gimmeh file!

(BTW, you can show normals in Oolite using the debug console: console.debugFlags = 0x100, or in 1.74 console.debugFlags = console.DEBUG_DRAW_NORMALS.)
DaddyHoggy wrote:
Final (semi-related) question regarding lighting - is there a way to get Oolite to smooth the shading between facets?
In short, yes. In long, even more yes.

Setting smooth to true in shipdata.plist will do this, but for all edges (or rather, all vertices). There is no threshold value.

To work around this, you’ll need to use smooth groups to define sharp edges. The impression I get is that AC3D is rather unsophisticated in this respect, but you can make use of those five materials you have. Open the OBJ file in a text editor, find each “usemtl” line, and define a smooth group with an “s <number>” line, like this:

Code: Select all

usemtl acmat_0
s 1

f 1/2/3 4/5/6 7/8/9
...
This leaves the tip of the nosecone. There’s no way to make a single vertex “pointy”. Ideally, you’d have a bunch of vertices with the same position, one for each polygon, but that could be tricky to achieve. A reasonable alternative is to use a very small disk or cone.

Posted: Fri Jun 11, 2010 11:58 pm
by DaddyHoggy
I may have lied about all the normals facing outwards (on the missing surfaces) having *really* checked the normals in AC3D, I will re-export and have another go.

Do you still want the .dat file to investigate why there's no shading on the cylindrical wing tips? (these normals definitely radiate outwards as you'd expect/hope - I've triple checked).

With regards the nose tip - early on I combined all the little surfaces to a single vertex to get rid of them - and its not a reversible process (I've also discovered - never use the merge function in AC3D - this is also a one-way trip :roll: :cry: )

I don't use the debug console (this is an oxp yes?) - as I used to mainly play Oolite on my Ubuntu machine and I never got it to work. But if I'm going to start building OXPs this is obviously going to have to change...

Re: smoothing - the last time I exported the model I baselined it back to plain white (default) - so all those extra materials disappeared (and now it's merged I can't reapply this on the individual groups because they don't exist any more).

I think - now I know how to use AC3D (enough to teach my students how to use it) my next ship will be in Wings3D...

Posted: Sat Jun 12, 2010 12:10 am
by DaddyHoggy
smooth = "true"; in shipdata.plist

doesn't do much for the ship's main hull and has made a difference to the nacelles and wing tips...

Image

(haven't re-exported so some faces still missing)

Posted: Sat Jun 12, 2010 12:21 am
by JensAyton
DaddyHoggy wrote:
Do you still want the .dat file to investigate why there's no shading on the cylindrical wing tips?
OBJ file would be more useful.

Posted: Sat Jun 12, 2010 9:57 am
by Smivs
Ahruman wrote:
DaddyHoggy wrote:
Final (semi-related) question regarding lighting - is there a way to get Oolite to smooth the shading between facets?
In short, yes. In long, even more yes.

Setting smooth to true in shipdata.plist will do this, but for all edges (or rather, all vertices). There is no threshold value.
I'm not familiar with this Smooth element in the shipdata .plist. How exactly is it scripted? And is there a particular point in the plist it should go, eg after the Model or Material data? Could you possibly give an example please?

Posted: Sat Jun 12, 2010 10:01 am
by Thargoid
The keys within a ships entry in shipdata.plist can be in any order you like. It depends on writing style, some people do lists in alphabetical order, some grouped by function (weapons keys together etc) and some just haphazardly. It doesn't matter at all, the game parses the plist just the same.

As for the smooth entry itself, details are here (now we have a wiki of sorts back).

Posted: Sat Jun 12, 2010 10:22 am
by Smivs
Thargoid wrote:


As for the smooth entry itself, details are here (now we have a wiki of sorts back).
OK, problem is that's in XML and I tend to use Open Step. Should it be something like:-

Code: Select all

smooth = yes;
?

Posted: Sat Jun 12, 2010 10:24 am
by DaddyHoggy
smooth = "true";

Will do the job.

Posted: Sat Jun 12, 2010 10:36 am
by Thargoid
Either will do.

The trunk shipdata.plist itself uses =yes, except for the ball turret which uses ="yes" (presumably by mistake). =1 should also work I think.

Posted: Sat Jun 12, 2010 11:34 am
by DaddyHoggy
Facet normals corrected:

smooth = "true";

Image

smooth = "false";

Image

Nacelles and wing spikes only lit "properly" when smooth is set to true.

Ahruman - if I can get to my box account I'll put obj file there share the link - standby...

Posted: Sat Jun 12, 2010 12:04 pm
by Smivs
I tried

Code: Select all

smooth = yes;
and that does work too. It makes quite a difference as you can see from these two very similar shots of my Clipper. The top one is 'normal' the bottom smoothed.

Image

Funny thing is I can't decide which is best!

Posted: Sat Jun 12, 2010 12:18 pm
by JensAyton
Smivs wrote:
Funny thing is I can't decide which is best!
Without shadow of a doubt the top one. Indiscriminately applying smoothing to a model with sharp corners may look nice from certain angles, but from others it will look awful. (For instance, if it’s heading towards the sun there will be a gradient from the front to the back in a way that makes no sense at all for a flat surface.) Just Say No.