Hard Light Productions Forums

Modding, Mission Design, and Coding => The Modding Workshop => Topic started by: Shivan Hunter on November 19, 2012, 03:33:39 pm

Title: Exporting from Wings3D to PCS2- normals/lighting issues
Post by: Shivan Hunter on November 19, 2012, 03:33:39 pm
I'm trying to export a weapon model (the simplest one here (https://www.box.com/s/fmn4yiy24y488s1uc1cw)) from Wings3D to PCS2. No matter what I do, there are problems with the normals- the model may be inside out, and the lighting is always coming from the wrong side, like this:

(http://i.imgur.com/cLs9B.png)

I've tried several workflows:

Wings -> DAE -> PCS2 (inside out and wrong light direction)
Wings (inverted normals) -> DAE -> PCS2 (right side out, still wrong light direction)
Wings (inverted normals) -> DAE -> Blender 2.63 -> DAE -> PCS2 (wrong light direction and Y/Z axes switched)

I've also tried various combinations of inverting normals, using 3DS to go from Wings to Blemder, and trying weird crap in Blender, and nothing works. Does anyone know a working process to go from Wings3D to PCS2 (preferably through Blender to I can do edgesplit stuff)?
Title: Re: Exporting from Wings3D to PCS2- normals/lighting issues
Post by: Kobrar44 on November 19, 2012, 05:00:39 pm
Which version of Wings and PCS do you have? I have never had such problems with importing from wings..
Title: Re: Exporting from Wings3D to PCS2- normals/lighting issues
Post by: Shivan Hunter on November 19, 2012, 05:20:01 pm
Wings3D 1.2 (I'll try a newer, crappier version to export from and report back)
PCS2 downloaded from here (http://www.hard-light.net/forums/index.php?topic=77292.0).

[EDIT] Nope, same problems as before with new Wings3D.
Title: Re: Exporting from Wings3D to PCS2- normals/lighting issues
Post by: Rampage on November 20, 2012, 12:04:57 am
I never liked the Wings3D to COLLADA exporter.  Instead I export to 3DS and reimport into Blender and finalize the mesh there.

R
Title: Re: Exporting from Wings3D to PCS2- normals/lighting issues
Post by: Shivan Hunter on November 20, 2012, 12:53:11 am
Did that (which IIRC was my usual workflow a while ago). Still has normal problems. Is there something I can do in Blender to flip the vertex normals, but not which way the polies face?

[EDIT] Just to mention: I used "recalculate normals" which gave me the original result (both inverted and lighting wrong), and using "flip normals" after that gave me a right-side-out model with lighting wrong. All this points to this being a PCS2 bug, not a Blender/Wings/COLLADA bug. Is there a workaround?
Title: Re: Exporting from Wings3D to PCS2- normals/lighting issues
Post by: The Dagger on November 20, 2012, 11:39:22 am
You can manually select only the problematic faces and use "flip normals" in edit mode. Blender can also display the normals, that should be usefull to find the inverted ones. "Recalculate normals" has never done wonders to me, I always do it manually (it takes longer but it works). Also I've had some trouble with Blender's new Collada Exporter, which was implemented in 2.64 IIRC. I use an older version to convert it.
Title: Re: Exporting from Wings3D to PCS2- normals/lighting issues
Post by: FreeSpaceFreak on November 20, 2012, 12:08:53 pm
Did that (which IIRC was my usual workflow a while ago). Still has normal problems. Is there something I can do in Blender to flip the vertex normals, but not which way the polies face?

Probably not, as those two are one and the same thing (last time I checked, anyway).

Quote
[EDIT] Just to mention: I used "recalculate normals" which gave me the original result (both inverted and lighting wrong), and using "flip normals" after that gave me a right-side-out model with lighting wrong. All this points to this being a PCS2 bug, not a Blender/Wings/COLLADA bug. Is there a workaround?

Blender's 'recalculate normals' never caused me any problems, unless my mesh was messed up. You may want to check if it's manifold, centered correctly, and unscaled (the object scale should be X 1.0, Y 1.0, Z 1.0 in Blender). A right-side-out model with lighting wrong... never seen that before, are you sure it's not an optical illusion?
Title: Re: Exporting from Wings3D to PCS2- normals/lighting issues
Post by: Shivan Hunter on November 20, 2012, 02:10:18 pm
The Dagger: Look at the picture I linked. Light in PCS2 comes from the top/front of the model; that light is coming from the bottom/back, which means the normals are wrong on all the polies.

FreeSpaceFreak: Vertex normals determine how lighting is calculated. Which way the poly faces is based on which vertices are defined first in the poly; IIRC, if they're listed counterclockwise facing the camera, the poly is facing the camera and is rendered. If they're listed clockwise facing the camera, the poly is "backwards" and isn't rendered if backface culling is on. I remember this from when I tried to get into OpenGL.

Either the vertex normals, or the order of the verts listed in each polygon, needs to be flipped- the only "flip normals" functions that I see do both of these.

I'm simply describing what I see in PCS2 and the only thing I think could be happening to the normals. Could it be something else? I admit I'm not a master modeler so I could easily be missing something.

[EDIT] I'm convinced at this point that it's not a layer 8 or ID-ten-T error. I made a cube in Wings3D, mapped it (PCS2 doesn't like unmapped meshes), and exported it to DAE. PCS2 tried to open it and it was inside out, and the lighting was inverted. I flipped the polies using Wings3D's "invert" function and exported again, and the result was similar to the pic I posted above; right-side-out model, inverted lighting. There may be problems with my mesh but they're not causing this particular error.
Title: Re: Exporting from Wings3D to PCS2- normals/lighting issues
Post by: MatthTheGeek on November 20, 2012, 02:34:00 pm
Why are you talking to me I haven't said anything.
Title: Re: Exporting from Wings3D to PCS2- normals/lighting issues
Post by: Shivan Hunter on November 20, 2012, 02:39:03 pm
Just got up. Brain no read usernames good.
Title: Re: Exporting from Wings3D to PCS2- normals/lighting issues
Post by: Aardwolf on November 20, 2012, 03:19:59 pm
Well, I looked at some "correct" models in PCS2 and I can confirm that when it's working right the light is from the top.

Hm... if you "flip normals" what it's doing is changing the vertex ordering within the polygons, which has the effect of changing it from back-facing to front-facing, or vice versa... but the per-vertex normal vectors might be unaffected by that?

Dang. I'm pretty sure I did it once (from Wings3D to POF, with normal vectors), but it was so long ago I don't really remember how I did it.
Title: Re: Exporting from Wings3D to PCS2- normals/lighting issues
Post by: rhettro on November 20, 2012, 03:56:17 pm
If you create a cube in Wings and export it to Blender as an OBJ file, do you still have issues?
Title: Re: Exporting from Wings3D to PCS2- normals/lighting issues
Post by: Shivan Hunter on November 20, 2012, 04:13:12 pm
but the per-vertex normal vectors might be unaffected by that?

They are affected. What I want is vertex normals facing outside and polies facing outside. What I can get is polies facing outside and bad lighting, which means vertex normals are facing the opposite direction, facing inside, or polies facing inside and bad lighting- which means vertex normals are facing the opposite direction, facing outside (which is correct). This means that the flip operations I'm using flip both the vertex normals and the vertex order.

One of these is being read wrong; I think PCS2 gets the vertex order wrong but the vertex normals right, resulting in a model with one right and the other wrong. Either PCS2 needs to work correctly or I need to produce a model in Wings3D or Blender with one right and the other wrong, so PCS2 can "correct" it by screwing it up.

rhettro: Yes, same issues as before. At this point I'm pretty sure the problem is in PCS2's COLLADA importer since everything else seems to display correctly.
Title: Re: Exporting from Wings3D to PCS2- normals/lighting issues
Post by: Aardwolf on November 20, 2012, 10:46:08 pm
Oh huh... I vaguely remember there being 2 versions of the DAE exporter in Blender, one of which was worthless.
Title: Re: Exporting from Wings3D to PCS2- normals/lighting issues
Post by: Shivan Hunter on November 21, 2012, 11:26:22 am
Yes, there was 1.3 and 1.4.1 IIRC... one of them worked and one wouldn't import to PCS2 at all. Since this one at least can import data, I'm assuming it isn't the non-working one. Wings3D also used to work without the lighting issues, so I'm going to try an older PCS2 build, maybe this new one has some problems.

[EDIT]: The "Feb 19, 2011 build" has the same problem as I'm getting here, and 2.0.1 and 2.0.3 from FSMods cannot import DAE files.
Title: Re: Exporting from Wings3D to PCS2- normals/lighting issues
Post by: Spicious on November 22, 2012, 04:06:12 am
Have you tried ticking a different number of "Mirror DAE Axes" boxes in the preferences?
Title: Re: Exporting from Wings3D to PCS2- normals/lighting issues
Post by: Shivan Hunter on November 22, 2012, 11:02:47 am
Thank you! That worked! I was mirroring the Y axis, and it turns out I shouldn't be. I still need to export the model with the faces inverted, but that's an idiosyncrasy I can deal with.

Maybe PCS2 doesn't suck