Author Topic: Early WIP on v2.55  (Read 140399 times)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1983
    • zapsolution
Re: Early WIP on v2.55
« Reply #210 on: November 18, 2018, 02:19:26 pm »
Quote
Your "wallpaper" (in fact, just another billboard in sight) has always been making me dizzy
This is a point of divergence between you and me, because preserving the aspect of an image has always been my moto.

I want to let it work like in my SkinnedChart or my Mbox64 projects, especially when moving to full screen.

I never understood people watching a cinemascope movie on their TV in stretched mode.

To please both of us, this could become an option ;)

ZI_Iconise computation could be used to clip the texture to match the viewport size on the fly (cell size), then no more black section on the side parts (so far for OpenGL i have choosen to adjust mostly on the height to avoid bluring the image too much).

Note: WinLIFT is also always preserving the background wallpaper aspect, but in this case taking both width and height into consideration, thus we could do the same. See the attached screen shots using the Marilyn wallpaper as a skinned background (see the ue of ComputeAspect).

Code: [Select]
       if (UseStretchMode == 1) { // PAINT_STRETCH_MODE
          skGetBitmapSize(g_CtlBack, bmW, bmH);
          ComputeAspect(bmW, bmH, nWidth, nHeight, xP, yP, xS, yS);
          SelectObject(hDCsrce, g_CtlBack);
          AlphaBlendEx(hDCdest, xP, yP, xS, yS, hDCsrce, 0, 0, bmW, bmH, 2); // 4.70 DWM support
          if (g_nUsingDWM) {
             nLeft   = skGetSystemMetrics(SK_DWM_LEFT);   if (nLeft) { skFillRect(hDCdest, 0, 0, nLeft, nHeight, 0); }
             nTop    = skGetSystemMetrics(SK_DWM_TOP);    if (nTop) { skFillRect(hDCdest, 0, 0, nWidth, nTop, 0); }
             nRight  = skGetSystemMetrics(SK_DWM_RIGHT);  if (nRight) { skFillRect(hDCdest, nWidth - nRight, 0, nRight, nHeight, 0); }
             nBottom = skGetSystemMetrics(SK_DWM_BOTTOM); if (nBottom) { skFillRect(hDCdest, 0, nHeight - nBottom, nWidth, nBottom, 0); }
          }
       } else { // Paint in tile mode
          skTilePaint(hDCdest, g_CtlBack, 0, 0, nWidth, nHeight);
       }

« Last Edit: November 18, 2018, 03:43:50 pm by Patrice Terrier »
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Early WIP on v2.55
« Reply #211 on: November 18, 2018, 04:59:29 pm »
Your Marilyn just proves what I was saying in my 2nd option above. The image must be resized in real time (or preferably manufactured in advance) in a much higher resolution than any viewport configuration (aspect ratio) it may ever be applied to, and clipped by the view frustum rather than stretched to fit it on the fly.

The matter is that OpenGL is much much slower to generate even an unmipmapped texture of such size than GDI+ is capable to stretch-blit its images in memory in each DWM recomposition. We could try and regenerate the wallpaper texture in response to the OR window WM_SIZING events but I'm absolutely sure it will make window corner dragging painfully slow and non-resilient.

As a fourth option to what I've already proposed, I can suggest extending your WM_SIZING min/max watch with a capability to restrict the main window resizes to just the wallpaper aspect ratio, so that when a side or corner is being dragged, all the four sides of the main window extend or shrink proportionately to match and maintain the wallpaper's original aspect ratio automatically -- and consequently, resize it in the OpenGL ortho projection exactly in its own aspect ratio rather than in an arbitrary main window proportions.

This is going to drive me (and people like me) even madder than your black margins but at least everybody would understand sooner or later why it's being done so by the app creators and what for. Contrary to that, the black margins are not going to have any similar sane explanation and purpose no matter what you say in English or French. ;)
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: Early WIP on v2.55
« Reply #212 on: November 18, 2018, 08:43:07 pm »
By all means Patrice,

You're free (and encouraged!) to experiment in whatever way you're most interested, and if such results are aesthetically satisfactory (black border-less and with all the peripheral scan colors intact, in this particular case) then we can use them as optional rendering modes for particular scene content.

However most of the GLSL coolest effects with translucency (like e.g. glass surface specular reflection, or refraction, or diffraction, etc.) are implemented not against simple 2D billboard backgrounds but within a 3D world enclosed in a skybox, skysphere, or at least skydome. OpenGL simple stock transparency isn't used at all. Instead, multiple render passes are run into all sorts of buffers (depth, stencil, lighting, etc.) and their final swap on the screen is deferred till the final PP step. Then all the buffers are sampled against the existing scene geometry and its attributes (including emulated translucency), and decisions are taken as to what objects should be seen directly, and which of them should be rendered first to be "seen" through other "translucent" surfaces and in what order, and how these surfaces should distort and fake reflection/refraction of other objects' 3D and planar geometry including the background.

In other words, the shaders should be immediately aware not only of scene geometry but also of the enclosing background. OTOH there would be no background in the scene at all from OpenGL's standpoint if it has been taken out of the scene and placed in parallel, but still alien, unreachable and incommunicado worlds of GDI+ drawing and DirectX compositing.

I am going to introduce sky boxes and probably sky domes in OR a.s.a.p. after FBO because proper rendering of advanced GLSL 3D effects is impossible against flat 2D backgrounds of our current wallpaper type.
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1983
    • zapsolution
Re: Early WIP on v2.55
« Reply #213 on: November 19, 2018, 12:20:09 pm »
Mike

Good news, i have solved my ratio problem, while keeping your genBackgroundList() optimization. :)

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

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Early WIP on v2.55
« Reply #214 on: November 19, 2018, 12:32:55 pm »
Thanks for the good news!

I'm a little busy today with real life issues but I'll be home in the evening. Please post or upload your mods for me to study.
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1983
    • zapsolution
Re: Early WIP on v2.55
« Reply #215 on: November 19, 2018, 01:51:01 pm »
Here are my changes.

1 - constants.h
//#define ClientW       1166 + 20 // 1188 //1024 + 164
//#define ClientH       600 + 20 + 73 // PAT: 10-10-2018
//#define ClientWGL     1032 + 20
#define ClientH       672
#define ClientWGL     1042
#define ClientW       ClientWGL + 136
[/color]

2 - case WM_SIZE (line 1381 in Main.cpp)
    case WM_SIZE:
        gP.glWidth = max(LOWORD(lParam), 1);
        gP.glHeight = max(HIWORD(lParam), 1);
        //gP.glRatio = ((float)gP.glWidth / (float)gP.glHeight) * 0.5f; // To preserve wallpaper aspect in glOrtho
        gP.glRatio = ((float)gP.glWidth / (float)gP.glHeight) * 0.54f;  // PAT: 11-19-2018, more accurate ratio computation

        gl_AdjustNearPlane();
        gl_Resize(gP.glWidth, gP.glHeight);

        if (IsWindowVisible(gP.hMain)) { // PAT 11-19-2018
            genBackgroundList();
        }


        gP.redraw = -1; // Redraw the OpenGL scene
        gl_DrawScene();
        break;


For your information, the black borders get visible only when the resized width reaches the limit of the glOrtho(-gP.glRatio, gP.glRatio, -1.0, 1.0, -1.0, 1.0); computation.
But this is the best solution to preserve the correct aspect ratio, and this is what i am using in my other applications.

Note: If you want to use stretching rather than aspect preservation, just rem out genBackgroundList(); in the WM_SIZE above.
And if you make it a new option, please keep the aspect preservation for default.

Added
I did post you a copy of the answer i got from Bob, about your speed DL limitation problem, he says you should see an improvement now :(
 
« Last Edit: November 19, 2018, 06:55:55 pm by Patrice Terrier »
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Early WIP on v2.55
« Reply #216 on: November 19, 2018, 07:15:58 pm »
Patrice,

Thank you for walking an extra mile to resolve my DL problem. Everything's in perfect order now, and I was able to download your recent Construction_ship.zip literally instantly as a test. The image attachments are also working for me again now: the firewall has been so bad on me recently that I couldn't even enlarge the thumbs by clicking on them. ;)

What he says about SSL might be a good idea. The site traffic would then use unbreakable encryption in real time, and a secure https:// address. I'd recommend buying a certificate, of course provided you can afford it materially.

I'm back home now and am going to dive into our code again in about 30 or 40 minutes after a quick bite. :)
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: Early WIP on v2.55
« Reply #217 on: November 19, 2018, 08:16:36 pm »
Well,

Your resize code fix works for me. (the black borders I haven't seen for ages are back again in their places ;))

It'll stay as the default but I'll be adding my own #ifdef MLL_DEV variant if I find it more pleasing to my eyes than yours.

I'm still stuck with the selection render pass shader for the mesh info tip. The shader setup is exceptionally simple but the other shaders in the system apparently leave OpenGL in such a weird state that I can't figure out how to reset it ATM.

I can't use a draw list approach here for speed reasons because I need to render all of the model's geometry rather than just four corners of the screen quad like in the wallpaper and ellipse hit test passes. Compiled draw lists are simple to set up (just compile once and forget) but they are perhaps an order of magnitude or two slower than GLSL shaders, especially for complex geometry.
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1983
    • zapsolution
Re: Early WIP on v2.55
« Reply #218 on: November 19, 2018, 10:18:04 pm »
I agree that the problem for sky boxes and spheres is something rather different, but for looking at a model from the outside, that is currently 100% of our model collection, preserving the aspect when using a photographic texture is the best solution in my not so humble opinion.  :D
« Last Edit: November 20, 2018, 12:19:09 am by Patrice Terrier »
Patrice
(Always working with the latest Windows version available...)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1983
    • zapsolution
Re: Early WIP on v2.55
« Reply #219 on: November 19, 2018, 10:42:34 pm »
Quote
Windows has a set of stock WinAPI's to handle save/restore to/from editable text .INI files. I see no reason in re-inventing a proprietary configuration system for an open source application.
Nothing proprietary, i just prefer to use Bload/Bsave direct from memory, and this is the same concept to create a binary .ORB version.
« Last Edit: November 19, 2018, 10:48:11 pm by Patrice Terrier »
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Early WIP on v2.55
« Reply #220 on: November 20, 2018, 12:17:05 am »
No,

BLOAD/BSAVE are too straight forward for an elegant solution. There's a hellofalot of trickery awaiting us to optimize the binary format dramatically for size, both in memory and on disk. 8)

<nostalgia>

My very early (probably 3 or 4 years ago) experimentation with glass reflection/refraction shading in Objector. :-*

</nostalgia>
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: Early WIP on v2.55
« Reply #221 on: November 22, 2018, 01:03:53 pm »
I was able to fix the color coding shader. 8)

I also put the main window nVidia/ATi/Intel icons into operation.
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: Early WIP on v2.55
« Reply #222 on: November 22, 2018, 03:10:39 pm »
The Mesh info tip option is fully implemented.

See below how a tiny 64-tris-only mesh named holo_emitter_hull stored at index 16087 in the mesh list is detected at the cursor current position within the viewport that's displaying a 32K mesh model. 8)
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: Early WIP on v2.55
« Reply #223 on: November 22, 2018, 04:17:15 pm »
Here's my patch with the mesh info tip and gfx icon implementation.

Enable/disable the mesh info tip feature in the Design menu as needed.
« Last Edit: November 25, 2018, 12:40:52 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: 1983
    • zapsolution
Re: Early WIP on v2.55
« Reply #224 on: November 22, 2018, 07:00:00 pm »
Thanks for the patch !
Patrice
(Always working with the latest Windows version available...)