Author Topic: Model Origin  (Read 5247 times)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Model Origin
« on: May 09, 2019, 09:57:48 pm »
Patrice,

You've probably noticed that some of the models are not seen at their best angles and/or positions when first loaded. We have to first rotate and/or zoom them for best aesthetic effect.

Do you think we should introduce a new global #origin meta that will specify the camera's initial translation/rotation values to be set immediately on model load? This will also be the orientation to which Reset view will bring the model when clicked.
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1980
    • zapsolution
Re: Model Origin
« Reply #1 on: May 10, 2019, 08:10:19 am »
Yes, that could be handy, especially when deaĺing with models that haven't been yet reworked.
When i work on a model, the first thing i am doing is to find its barycenter to move the origin there, to ease symetrical editing alignements.
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Model Origin
« Reply #2 on: May 10, 2019, 11:11:30 am »
OK then, I'll see what I can do. I'll probably reuse your light settings saving routine to update the material file when the orientation has been adjusted. That'll be our third editing option in ObjReader. :)

Re. barycentric origin: please note that some models may originally be parts of a 3D scene, like e.g. artifacts in a game level or .LWO objects in an .LWS scene. When exported from a professional 3D editor as-is, they preserve their original pos and rot data in the exported file. Now if you would like to add another object from the same scene to the model you've exported, you'll have no problem because their mutual orientation within the new 2x derivative model will be preserved automatically.

Now note also that regardless of the original pos data in the model, OR recalcs its center and scale (but not rotation) at load time for best fit in the OR viewport ignoring the actual data in the model and leaving the model file untouched. What we can do is also save the original pos, rot, and scale data in the model's PROPM structure to be able to later enrich the menu with a File->Add model to scene option. Then on adding another model to the existing scene (assuming both models have correct mutual initial disposition and scale), OR will be able to regard the two models as two pre-orientated meshes of the newly created 2x derivative model, and recalc their mutual barycenter and rescale them again to best fit the new model in the OR viewport.

Résumé: use C4D hard-coded reorientation with caution if you want to export one or more mesh parts as separate models but may later want to be able to reassemble them again into a common model.
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1980
    • zapsolution
Re: Model Origin
« Reply #3 on: May 10, 2019, 01:53:47 pm »
What cause me most havoc when dealing with new models is the existing lighting(s) that was used for a specific scene.
So far the easiest way for me to get rid of them, is to import them in Accutrans, and use "calculate smooth normal" to solve this.

That would be nice if we could have the same feature in OR.
« Last Edit: May 10, 2019, 01:55:24 pm by Patrice Terrier »
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Model Origin
« Reply #4 on: May 10, 2019, 05:21:30 pm »
0. BEWARE!!! AccuTrans automatically merges meshes if they have the same material!!!

1. Are you aware AccuTrans has a setting that defines how small the angle between the surface normals should be for the surfaces to be smoothed without creases? I usually use angles between 30o and 60o but sometimes I can go up to 179o in the most extreme cases. (see the snapshot below)

2. Quality calc isn't so simple and trivial as it may seem at a first glance. ObjReader implements the simplest algo for the rare cases when the model lacks normals completely. But you can see for yourself how much worse that algo is than the one that's used in AccuTrans or 3ds Max and compatibles.

The problem is that OR may reuse the same vertices in different triangles whose normals should not be smoothed out (averaged) between themselves to preserve the crease where necessary. Therefore, such vertices should be duplicated (cloned), and their normals should be recalculated for those triangles separately, and their respective indices should go into the index array separately as well.

The algo is described in detail in many places on the net. But alas, so far I have never come across its clear and concise practical implementation in an open source project that I can copy. I've been keeping an eye on this issue for years, and I will implement it in OR if and when I find the source of inspiration.
« Last Edit: May 10, 2019, 05:23:07 pm by Michael Lobko-Lobanovsky »
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1980
    • zapsolution
Re: Model Origin
« Reply #5 on: May 11, 2019, 11:48:02 am »
About points 0 and 1, i am well aware of these, thanks!
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Model Origin
« Reply #6 on: May 11, 2019, 01:50:45 pm »
About points 0 and 1, i am well aware of these, thanks!

Don't be angry with me; we're getting old and may therefore start to overlook the obvious without ever noticing it. So, just to be on the safe side... :)
________________________________________

Now I want to make a confession. But first, please promise me you will carry on eliminating unwanted backfacing poly artifacts whenever possible as you always did before! ;)

Well here's my confession: I have implemented Illuminate both sides in the shaders. 8)

From now on we will be able to use it to suppress the offending polies if we can't possibly get rid of them.

Please have a look at the screenshots below. This horrible hair mesh cannot be possibly cured either manually or automatically (at least in AccuTrans) of a ton of random backfacing polies it hosts.

Note that two-sided lighting makes the artifacts practically unnoticeable even in semi-transparent meshes that have a full set of accompanying textures (bump, AO, spec, etc.) such as this hair mesh:
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1980
    • zapsolution
Re: Model Origin
« Reply #7 on: May 11, 2019, 03:57:07 pm »
Send me this horrible hair, i may have a solution to solve this problem in OR without changing anything.  8)
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Model Origin
« Reply #8 on: May 11, 2019, 04:38:46 pm »
No problem, here it is. :)

But don't try to doctor it with Cull backfaces; I won't buy it. ;) Culling is gonna make the hair too thin for all practical purposes. And A2C is already there together with a matching alpha threshold. :P
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1980
    • zapsolution
Re: Model Origin
« Reply #9 on: May 11, 2019, 08:00:09 pm »
Ok, i can't get any better than you, without a major mesh editing  >:(
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Model Origin
« Reply #10 on: May 11, 2019, 08:44:01 pm »
Ok, i can't get any better than you ...

Any better than what you're seeing in your OR on loading the hair mesh as-is for the first time?

Or any better than what I can do with my new GLSL illuminate-both-sides feature as seen in my earlier screenshot? ;)

  >:(

Don't get too upset, my friend. :)

Now you can have it all for free with absolutely no sweat. Just don't abuse the option because otherwise we might end up as just another source of pitiful crooked .OBJ junk...
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)