Jump to content
The Dark Mod Forums

LWO format and quads


stgatilov

Recommended Posts

I'm looking into the following warning:

Quote

WARNING:ConvertLWOToModelSurfaces: model 'models/darkmod/architecture/doors/door_stained_glass_104x56.lwo' has too many verts for a poly! Make sure you triplet it down

I think it is fairly easy to automatically break such polygons into triangles, as long as they are:

  1. planar: otherwise different triangulations produce different geometry, so better forbid such ambiguity.
  2. convex: breaking nonconvex polygon into triangles is too much hassle.

Briefly looking into debugger on a few cases, I got an impression that most of the offenders are simple quads.

 

I wanted to ask if there are other LWO-related things to improve/fix.
For instance, I see that smoothing groups stored in LWO file are ignored by D3 engine. Isn't it inconvenient?

LWO is a very rich format, it allows storing patches, bones, and lots of other stuff. Just look into specs (attached). D3 is using a small subset of it.
By the way, how popular is this format today? How easy is it to convert into it from other programs?

lwo2.html

  • Like 2
Link to comment
Share on other sites

Afaik Doom 3 does support smoothing in lwo but is based in material angle smoothing like in Lightwave and MODO not 3DMax based smoothing groups. Personally I don't see what more you can use lwo for in TDM, does it support vertex animation? I'm asking because for bones you have MD5 and for vertex animation you have MD3 but is a very old format with very few tool support.

I don't know how generic you can make lwo, so other tools can use its full power, IMO is really useful for those using Modo and old lightwave but for any others I cannot say how good is the format supported, in the case of MODO is the second best supported format after the main .lxo format, in the case of Maya/3DMax and Blender afaik have no support at all for it, unless you use a plugging or addon. 

IMO lwo support in idtech 4, as a static format, was really for MODO, why, because Seneca one of the main idSoftware 3D artists, is a Modo fan/aficionado and I bet he pushed for the inclusion of the format in the engine. But today I would recommend .fbx instead more universal support.

 

Tools that I personally know support Lwo:

Lightwave (the inventor of the format) import - export

MODO (made by old lightwave engineers) import - export

Blender 2.66a (hidden need to enable .lwo addon) import only

Ultimate Unwrap 3D  import - export

Edited by HMart
Link to comment
Share on other sites

Here are some previous posts on support for smoothing/vertex normals:

It's an avoidable problem if you can use ASE instead, but it's a bit of a gotcha, especially if you're trying to convert files obtained from OpenGameArt or Sketchfab or wherever.

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Link to comment
Share on other sites

Let's spawn @chedap here.

As far as I see, there are 3 ways to specify smoothing/unsmoothing in LWO format:

  1. Same/duplicate vertices --- that's obvious.
  2. Smoothing groups (SMGP).
  3. Max smoothing angle (ANG4).

Doom 3 code glues vertices together, if they have 1) same color, 2) same texture coordinates, and 3) normals match within acos(1 - r_slopNormal), which is about 11.5 degrees.
The condition 3 is disabled if renderbump is on (no idea what it is, but chedap mentions it).

It efficiently means that way 1 is broken (duplicate vertices have no effect on unsmoothing), way 2 does not work (ignored by D3 code), and way 3 is sorta hardcoded, because the coefficient recorded in the file is ignored.

I think it is possible to change something about it, but new rules will enable only if model contains some special text (e.g. "use-smooth-groups").

Link to comment
Share on other sites

8 hours ago, HMart said:

But today I would recommend .fbx instead more universal support.

Using closed proprietary format in a free open source game? The game which cannot even link steam integration libs due to its open-source license? The format managed by monopolist company which is known to sue companies for making independent interoperability tools for its formats? 🤬
Not gonna happen 🙄

I would say COLLADA is a better choice. But of course only a small subset of it, since it is damn huge (included B-reps, shaders, and what else). And since this format is not efficient for loading (it is made for interoperability), it should be preprocessed into something native and easy-to-load anyway. So some D3 export tool would still exist even for COLLADA. I would even say that DarkRadiant is a better location for such export tool.

Link to comment
Share on other sites

10 hours ago, stgatilov said:

Using closed proprietary format in a free open source game? The game which cannot even link steam integration libs due to its open-source license? The format managed by monopolist company which is known to sue companies for making independent interoperability tools for its formats? 🤬
Not gonna happen 🙄

I would say COLLADA is a better choice. But of course only a small subset of it, since it is damn huge (included B-reps, shaders, and what else). And since this format is not efficient for loading (it is made for interoperability), it should be preprocessed into something native and easy-to-load anyway. So some D3 export tool would still exist even for COLLADA. I would even say that DarkRadiant is a better location for such export tool.

Oh ok! Didn't knew about that! Collada is a another choice indeed, is supported by all major tools but I've read others saying, is a very finicky format to work with, because of how complex/over engineered it is and that some tools don't follow the collada speck well causing some files from one tool to not work on another. 

Link to comment
Share on other sites

Well, anyway COLLADA is not for the engine.
It can be used as intermediate format if it becomes hard to convert to .lwo directly from popular tools.

I'm have again come to conclusion that .lwo is a very good static model format for direct loading by the engine. It is 1) already supported, 2) small size, 3) fast to load, 4) supports some advanced features which we can start using if we like.

So the main question is if there is some particular problem with how D3 imports LWO files.

Link to comment
Share on other sites

Nobody uses Collada these days, for reasons already mentioned. The usual choice is .fbx or .obj, whether it's Unreal, Unity, or others. Either stick with these, or you'll be designing for yourself, not for actual users.

I'm pretty much stuck with .ase, but it works well for me, and I haven't encountered a scenario where a higher polycount would affect video memory much, even though these files can be quite big over certain number of polys.

Edited by peter_spy
  • Like 1
Link to comment
Share on other sites

On 8/29/2020 at 8:51 PM, HMart said:

Afaik Doom 3 does support smoothing in lwo but is based in material angle smoothing like in Lightwave and MODO not 3DMax based smoothing groups.

Blender 2.66a (hidden need to enable .lwo addon) import only

 

On 8/30/2020 at 12:02 AM, VanishedOne said:

It's an avoidable problem if you can use ASE instead, but it's a bit of a gotcha, especially if you're trying to convert files obtained from OpenGameArt or Sketchfab or wherever.

Blender 2.80 supports exporting LWO with full angle-based smoothing as of the latest version of my (building on the work of others) LWO export script for Blender. There is no support for explicit smoothgroups AFAIK, other than by splitting vertices.

In terms of fully open formats, Alembic looks interesting. It is free, and supported by almost everything according to Wikipedia. I don't know how its features stack up against other formats though, or whether it would be suitable for both static and animated meshes.

Link to comment
Share on other sites

1 hour ago, peter_spy said:

Nobody uses Collada these days, for reasons already mentioned. The usual choice is .fbx or .obj, whether it's Unreal, Unity, or others. Either stick with these, or you'll be designing for yourself, not for actual users.

Well, if some other people second your opinion that .obj would useful, I can add support for it in the future.
It is very old, well-known and rather minimalistic format with specification freely available.

Would it be useful to add some integration of .mtl files too?
Maybe it's possible to convert some simple subcases to .mtr file automatically.

By the way, .obj format is textual. It is good for debugging, but bad for storage. It has binary equivalent, which has .mod extension.
Are .mod files as widespread as .obj files?

Quote

I'm pretty much stuck with .ase, but it works well for me, and I haven't encountered a scenario where a higher polycount would affect video memory much, even though these files can be quite big over certain number of polys.

Do you mean models in .ase take more video memory than same models in .lwo format?
I cannot think why it could be so.
Yes, they take more storage (perhaps even compressed) and more time to read, but in the end they have the same number of vertices and indices in memory... or not?

Quote

In terms of fully open formats, Alembic looks interesting. It is free, and supported by almost everything according to Wikipedia. I don't know how its features stack up against other formats though, or whether it would be suitable for both static and animated meshes.

I think it is bad choice for static meshes.
Its main goal is to store animated scenes in a way that anyone can read it (basically, each frame is stored as separate data, like in motion jpeg). Such animated scenes are damn huge of course, but for movie industry it is OK. In game industry, I think it is only useful for complicated non-skeletal animations, e.g. precomputed liquid simulation.

  • Like 1
Link to comment
Share on other sites

22 minutes ago, OrbWeaver said:

Blender 2.80 supports exporting LWO with full angle-based smoothing as of the latest version of my (building on the work of others) LWO export script for Blender.

I'm not sure what you mean by "full angle-based smoothing". Does the script ensure that non-smoothed edges have angle greater than 11.5 degrees, and smoothed edges have angle less than 11.5 degrees?

Quote

There is no support for explicit smoothgroups AFAIK,

Well, it means it would be useless to support them on TDM side.

Quote

other than by splitting vertices.

Splitting vertices works in general, but TDM will merge them back, so it does not help.

Link to comment
Share on other sites

41 minutes ago, stgatilov said:

By the way, .obj format is textual. It is good for debugging, but bad for storage. It has binary equivalent, which has .mod extension.
Are .mod files as widespread as .obj files?

Shit, didn't know that .obj is text-based :( That would kinda double the functionality of the .ase... But, I guess would make sense to add because many apps support it (more than .ase) I don't think .mod is as popular, but that will need some further research too. As for materials, in other game engines you don't need .mtr files for .obj, but these editors do have a GUI option to assign materials to models. Having that for .obj (or even for .ase alone) would be pretty useful.

1 hour ago, stgatilov said:

Do you mean models in .ase take more video memory than same models in .lwo format?
I cannot think why it could be so.
Yes, they take more storage (perhaps even compressed) and more time to read, but in the end they have the same number of vertices and indices in memory... or not?

You're right, I didn't think of it this way. I was indeed thinking about disk space (uncompressed, they actually take little space when zipped). But it would make sense to occupy the same amount of video memory as .lwo, in the end.

Link to comment
Share on other sites

4 hours ago, stgatilov said:

I'm not sure what you mean by "full angle-based smoothing". Does the script ensure that non-smoothed edges have angle greater than 11.5 degrees, and smoothed edges have angle less than 11.5 degrees?

There are three options available at the point of export:

  • Full smooths everything, giving the same result as ASE models. If you want unsmoothed faces in this mode you would need to split them (although from what you say, this wouldn't actually help).
  • None leaves the whole model flat shaded, irrespective of split or non-split faces.
  • Use Autosmooth settings smooths the model based on the Autosmooth checkbox and angle field in the Blender mesh properties. Angles less than the threshold will be smoothed, greater angles will be flat-shaded. I assume this is the most useful setting, since the exported model should look the same as it did in Blender, which is why it is the default.
Quote

Well, it means it would be useless to support them on TDM side.

There's nothing to prevent us from adding explicit smoothgroup support to the exporter if there is a user demand for it. I would need a clear description of what the data should look like in the LWO file, and of course the usual caveats would apply i.e. no guarantee about timescale etc, but it's possible. That's assuming that Blender actually has the concept of smoothgroups though; to be honest I have no idea about that.

I suspect that the Autosmooth behaviour would probably cover the vast majority of situations, though.

Link to comment
Share on other sites

IMO the smoothing groups is a basic feature and should be available. It's a rare thing in modeling that you would want to use one smoothing group for all the faces, or leave them faceted. Using a threshold can be enough in some cases, but for more detailed models will not be enough. In particular, if you bake normals from a high-poly model, you need to have full control over smoothing groups. All this is available for .ase already.

Edited by peter_spy
Link to comment
Share on other sites

In Blender you set Auto Smooth with a threshold, which smooths out everything below given angle, and then you can additionally mark any edges as sharp in edit mode. Additionally you have custom normals. I believe all that was exported correctly to .lwo last time I checked.

It's only a model...

Link to comment
Share on other sites

Great, then it sounds like it works as it should. What do you mean by custom normals? Can you change normals per face or vertex? I have such an option in 3dsmax, but either .ase exporter or the engine itself doesn't seem to support it.

Edited by peter_spy
Link to comment
Share on other sites

I'm sorry it was ASE not LWO that exported custom normals. It turns out we had exact same conversation two years ago.

By custom normals I mean weighted normals like here on the right:

image.thumb.png.70b590cf379d5e9eccc0cf7bc6c77ded.png

Or normals pointing in one direction (or pointing away from center like in the image below):

image.png.60a15c77430e4d4252aa8c19a4c82176.png

  • Like 2

It's only a model...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • Petike the Taffer  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
×
×
  • Create New...