Author Topic: There are many ways to go to Rome.  (Read 53515 times)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: There are many ways to go to Rome.
« Reply #195 on: April 24, 2019, 05:51:54 am »
I am walking one step after another, and so far UV map is my first editor's step.
OK probably I'm running too fast. My idea was to try and design a viable universal undo/redo scheme right from the start, so that each new editing feature we're adding wouldn't require reshuffling lots of earlier code to adapt to new functionality.

But no, your first editor was the lighting editor. So now you have two editors to cater for in one undo/redo stack and you're likely to have still more of them in the future. ;)

Quote
About tiled texture i have to search a model from my collection to experiment with, because so far i couldn't remember of any.
I'll try to create a simple test model+texture for you this afternoon with one set of UVs shifted to cross the border of two tiles midways (like in my previous elementary example), and yet another one, shifted entirely to, say, tile 3 or 4 absolutely out of Tor's current reach. Tor will have to cope with both UV sets and allow us to control their map bullets/hot spots in their natural environment as easily as it currently does entirely within the boundaries of tile 0. We shouldn't simply discard the whole integer part of UVs to narrow them down to tile 0, but rather extend Tor's display area to be able to draw the virtual tiles when needed, and its hot spot overlay, to draw the entire matching UV wireframe in its true UV coords.

I believe there is absolutely no other way to implement it efficiently in the zoom control viewport other than by tiling the texture cross-wise in the direction(s) where the UVs actually protrude.

Quote
To create the UV projection ...
We do not need to create projections. They have already been created for us by the people who designed the model textures and stored their projected VT values in the model files. We need only to remap those values from their relative FPU representations to the textures' true pixel widths and heights. We can now do this for tile 0 but we have to also be able to do it for the virtual widths and heights of the entire rows of tiles where the model UVs actually protrude.

And Tor should also be made ready to display not only tile 0, but also the entire cross of tiles with the UV map extending from physical tile 0 into the surrounding virtual tiles. Think of how your physical desktop window coordinates on your primary monitor are extended into the virtual desktop on your adjacent secondary monitors.
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: There are many ways to go to Rome.
« Reply #196 on: April 24, 2019, 08:02:06 am »
My friend

As you know it, i am reworking all the models without exception before posting them on our forum, thus if one doesn't fit into our existing paradigm is doesn't figure into the collection.
Quote
And Tor should also be made ready to display not only tile 0, but also the entire cross of tiles with the UV map extending from physical tile 0 into the surrounding virtual tiles.
About Harley-quinn, the original UV map is preserved even after editing the texCoord (or the changes won't work), thus i don't think that we must spend too much time on this, as long as the editor allows us to edit the WYSIWYG part.

As you can see in the code below, i am restoring the floor part of the textCoord before updating.

            // WE UPDATE THE UV texCoord HERE
            long idx = gnm_indexBuffer[gT.wasIndex];
            // SetTexCoordinate
            rx = gtm_vertexBuffer[idx].texCoord[0] - rxCoord(idx);
            ry = gtm_vertexBuffer[idx].texCoord[1] - ryCoord(idx);

            gtm_vertexBuffer[idx].texCoord[0] = rx + float(gT.wasX / float(nW - 1));
            gtm_vertexBuffer[idx].texCoord[1] = ry + float(1.0f - float(gT.wasY / float(nH - 1)));



I made these changes to use your fast_fmodf, but i can't see any measurable speed enhancement  :-[
float rxCoord(IN long idx) {
    return gtm_vertexBuffer[idx].texCoord[0] - ((int)(gtm_vertexBuffer[idx].texCoord[0] / 1.0f)) * 1.0f;
    //return gtm_vertexBuffer[idx].texCoord[0] - floor(gtm_vertexBuffer[idx].texCoord[0]);
}

float ryCoord(IN long idx) {
   return gtm_vertexBuffer[idx].texCoord[1] - ((int)(gtm_vertexBuffer[idx].texCoord[1] / 1.0f)) * 1.0f;
    //return gtm_vertexBuffer[idx].texCoord[1] - floor(gtm_vertexBuffer[idx].texCoord[1]);
}
« Last Edit: April 24, 2019, 08:16:29 am by Patrice Terrier »
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: There are many ways to go to Rome.
« Reply #197 on: April 24, 2019, 08:48:03 am »
My friend,

Do you realize and acknowledge that currently, Tor isn't able to display the correct disposition of the triangle ABC as per my earlier message? It isn't even aware that the coords of C are in fact located in Tile 1 rather than Tile 0 because all it sees is the castrated fmod'ed coords of Cprime. Therefore, it is 100% going to distort the UV map by drawing the triangle as ABCprime. How are we then to know that what we're seeing in the zoom control viewport is exactly what happens in the mesh texture mapping, and how are we to locate the correct hot spots, and where to drag the "virtual" Cprime hot spot even if in the end we're somehow able to guess that Cprime is in fact the misplaced C apex? ::)
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: There are many ways to go to Rome.
« Reply #198 on: April 24, 2019, 09:14:01 am »
Michael

In the case of Harley_quinn, i have checked the UV map produced by Tor and C4D's, they are both the same except a little offset of 1 pixel on both X,Y (the pen size), that is easy to fix.

To say the truth i can't aknowledge anything without experimentation, because it sounds a little like Hebrew to me.  :-[

A model example is the only thing that could help me to figure what to do, after comparison with the UV map produced on it by C4D, that was my leading edge reference.

And as far as i can imagine, tiling mode is NEVER used to create AO's texture.
« Last Edit: April 24, 2019, 09:52:14 am by Patrice Terrier »
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: There are many ways to go to Rome.
« Reply #199 on: April 24, 2019, 11:48:28 am »
Quote
And as far as i can imagine, tiling mode is NEVER used to create AO's texture.
That's correct, but AO is the only texture that can't be tiled because no two parts of the same mesh may have one and the same shadow pattern. Therefore, the use of AO in an .OBJ model requires that the mesh's all other textures be generated similar to AO as clamped to edge, and host the mesh's entire UV topology without overlapping regions. But it only applies to those model formats that support only one UV set per mesh. There are however many formats that support from two to an infinite number of UV sets per mesh.

Re. acknowledgment, I'm hoping to demonstrate it on my test model later today or tonight. :)
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: There are many ways to go to Rome.
« Reply #200 on: April 24, 2019, 11:57:07 am »
Quote
and host the mesh's entire UV topology without overlapping regions
Yes, overlapping regions is a terrible mess when working with AO's, forcing me to split the mesh into distinct individual pieces within C4D.

I have learned this the hard way ::)

Patrice
(Always working with the latest Windows version available...)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1980
    • zapsolution
Re: There are many ways to go to Rome.
« Reply #201 on: April 24, 2019, 12:05:51 pm »
See the overlapping sections when creating the UV's map for the "harley_quinn" colants material.

To solve this, the crossed legs must be splitted into two distinct meshes.
Because the editor couldn't help in such a case.
« Last Edit: April 24, 2019, 12:15:20 pm by Patrice Terrier »
Patrice
(Always working with the latest Windows version available...)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1980
    • zapsolution
Re: There are many ways to go to Rome.
« Reply #202 on: April 24, 2019, 07:04:42 pm »
Here is what i have done so far to select/move the hot spot with the LMB (and to complete arrow keys move).

Tell me what you think of the selection tolerance (line 734).
Note: we could replace PtInRect from line 737 with ptInCircle.

Make sure to put the new "dot.png" into the "Reader" folder.
« Last Edit: April 24, 2019, 07:07:47 pm by Patrice Terrier »
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: There are many ways to go to Rome.
« Reply #203 on: April 24, 2019, 07:15:26 pm »
Yes Patrice,

I understand all the implications clearly. Probably C4D's AO ray tracer algo can't cope with such situations without texture remapping, and her collants were ray-traced for AO in a better editor or were hand-painted altogether.

In the meantime, I can't yet spare much time for 3D design but I found a relatively simple and very amateurish MilkShape .MS3D model with all the tex mapping horrors in its Detail2 mesh you could only imagine. Its conversion to an .OBJ went well, so now you can see for yourself that Tor's UV map has nothing in common with the original UV map (screened below at 0.15 and 1.0 magnification) as seen in MilkShape's texture editor:

.... <snip> ....
vt -2.0832 0.5766
vt -2.0832 0.6574
vt -2.0819 0.6114
vt -2.0819 0.7019
vt -2.0802 -1.6344
vt -2.0802 -0.4796
vt -2.0802 0.5114
vt -2.0802 1.6662
vt -2.079 0.1397
vt -2.079 0.4164
vt -2.0775 -0.9489
.... <snip> ....


though those are the correct values that map well into the model if I load the new .OBJ back into MilkShape. (it can load a ton of old 3D formats but is limited only to 64K verts or tris, whichever is the highest)

P.S. Thanks for the update!
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: There are many ways to go to Rome.
« Reply #204 on: April 24, 2019, 07:49:53 pm »
The tolerance seems OK for the bullet this size. However, the cursor fist seems to obscure the exact location where I might want to drop the bullet at. And one more thing: when I'm dropping the bullet by releasing the LMB, the tri(s) seem(s) to redraw at a slightly different location than they were drawn when last dragged. Which means that, when I am to decide if I should drop the bullet at a given location or not, I'm still not seeing exactly what the wireframe will look like when I release the LMB.

(Nice work, my friend! I still don't know what's going to come out of it in the end but I certainly like the process even if it might be somewhat too laborious for you) :)
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: There are many ways to go to Rome.
« Reply #205 on: April 24, 2019, 08:57:41 pm »
For the mouse cursor you can try this in the CallBack_ZoomCtrl

    //case WM_SETCURSOR:
    //    GetWindowRect(hWnd, &rw);
    //    GetClientRect(hWnd, &lpr);
    //    GetCursorPos(&p);
    //    if ((p.y < rw.top + lpr.bottom) && (p.x < rw.left + lpr.right)) {
    //        SetCursor(LoadCursor(NULL, IDC_CROSS));
    //        nRet = 1;
    //    }
    //    break;
« Last Edit: April 24, 2019, 09:03:27 pm by Patrice Terrier »
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: There are many ways to go to Rome.
« Reply #206 on: April 24, 2019, 09:55:37 pm »
Do we really need a cursor at all when we're dragging the bullet that's already a cursor in itself all right?
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: There are many ways to go to Rome.
« Reply #207 on: April 24, 2019, 10:01:04 pm »
I have checked StarFury (thanks for the download), this is a model that i would have reworked totaly in C4D before using it in OR.

Currently i am focusing on textures that are AO compatible, because this is a mandatory to produce state of the art OR 3D models, everything else is not on my schedule for now.  8)
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: There are many ways to go to Rome.
« Reply #208 on: April 24, 2019, 10:16:31 pm »
Got it.
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: There are many ways to go to Rome.
« Reply #209 on: April 24, 2019, 10:29:05 pm »
Quote
Do we really need a cursor at all when we're dragging the bullet that's already a cursor in itself all right?

I am using a sprite/marker to rely on the existing GDImage default processing.
And because a sprite could have multiple states, to match different purposes.

About the mouse cursor itself we can use a custom one if you prefer, rather than the standard arrow.

Patrice
(Always working with the latest Windows version available...)