Author Topic: Peugeot-Onyx (concept car)  (Read 42661 times)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Peugeot-Onyx (concept car)
« Reply #45 on: January 13, 2018, 06:22:55 pm »
Evening Patrice,

I think the list is rather complete. I have a few more effects in mind to add now that we're using a timer officially. But first of all I want to finish off billboarding. I'm still not through with it.

Now please tell me how is your Radius argument changed in your void GL_ChartPoint (IN float Radius, IN float rValue) function? Is it a constant for all the bubbles you're currently drawing in your 3D chart that defines how large the common bubble mesh (circle) is with respect to the other meshes in the scene? Or is it a variable you're modifying somehow elsewhere in your code e.g. to control a particular bubble's "perspective" size?

P.S. Can you confirm that all your other apps that use billboards (Bubble, Asleep, HUD, SUNLIGHT) utilize the exact same code we're using to control ObjReader's current camera? By "exact same" I mean exact to the same order of precedence of gluLookAt/glRotate(X/Y/Z) calls in the renderer and same code to derive dX and dY deltas to control rotation angles in response to mouse button down moves across the screen?
« Last Edit: January 13, 2018, 08:35:18 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: Peugeot-Onyx (concept car)
« Reply #46 on: January 13, 2018, 07:31:11 pm »
Quote
Can you confirm that all your other apps that use billboards (Bubble, Asleep, HUD, SUNLIGHT) utilize the exact same code we're using to control ObjReader's current camera? By "exact same" I mean exact to the same order of precedence of gluLookAt/glRotate(X/Y/Z) calls in the renderer and same code to derive dX and dY deltas to control rotation angles in response to mouse button down moves across the screen?

No, the BassBox plugins are using indeed a mini particle engine, 3D Chart is much simpler.
The initial value of radius is g_Chart.radius = 1.0f  :-[

I think that we must translate (invert) the camera pos, just before billlboard, the problem is to compute the correct z location.
I shall try it to see what i could get...

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

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Peugeot-Onyx (concept car)
« Reply #47 on: January 13, 2018, 08:06:17 pm »
Quote
I think that we must translate (invert) the camera pos

What you call "// Convert to OpenGL matrix notation" in your GL_BillBoard() is in fact the so called "matrix transpose", i.e. getting the inverse of current modelview (rotation) matrix. Multiplying the current matrix by its (transposed) inverse in the glMultMatrixf(&mm[0]) (in fact, glMultMatrixf(mm) in C notation) yields effectively an un-rotated identity modelview matrix with all of its three rotation angles reset to 0. At the same time, its translation/scaling components as set by gluLookAt() remain intact, and that is why the ONYX plate stays well sized and zoomable but glued to the same point of projection onto the screen plane -- in other words, doesn't follow the model's general rotation pattern any more.

This is sufficient for an FPS camera (pun not intended; FPS here means "first-person shooter") that moves relative to the static model, but it isn't, for an orbiting camera like in ObjReader that stays put at the world's [0,0,0] while the model is dragged/rotated following mouse movements.

So, for what it's worth GL_BillBoard() takes us only halfway through to our goal in ObjReader. We must go further and move the billboard quad to a correct point in the 2D screen space and also project it correctly to emulate its X rotation (cylindrical a.k.a. Y axis-aligned billboard -- "tree-like"), X/Y rotation (spherical billboard -- "particle-like"), or leave it as-is without projection distortion (HUD a.k.a. "text-like" billboard).

All manual transformations are highly dependent on the order of glTranslate, glScale and glRotate calls, and also on the methods of obtaining pitch/yaw/roll angles in response to mouse dragging.

These are the issues with the billboard problem we're currently facing in ObjReader.
« Last Edit: January 13, 2018, 08:11:20 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: Peugeot-Onyx (concept car)
« Reply #48 on: January 13, 2018, 08:48:21 pm »
Mike--

We can move this billboard problem onto the back burner, until the rabbit pops up from the top hat...

Would you like to have the latest changes i have done, i didn't send it to you before, because i didn't wanted to interfer with your current work  :-X
« Last Edit: January 13, 2018, 08:51:03 pm by Patrice Terrier »
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Peugeot-Onyx (concept car)
« Reply #49 on: January 13, 2018, 09:01:57 pm »
I'd love to have them a.s.a.p. I have yet to learn how to use your custom color picker under field conditions. :) I haven't touched it since the days of SkinBox. :)

I remember I saw a possible solution to our billboard problem somewhere and I've been looking for it all over the net in the recent 48 hours but I still haven't found it. But I will. :)
« Last Edit: January 13, 2018, 09:08:04 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)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Peugeot-Onyx (concept car)
« Reply #50 on: January 13, 2018, 09:37:45 pm »
Got it Patrice, thanks a lot!

I'll be looking for the billboard solution for another 24 hours and I'll re-implement it if found. If not, I'll drop that for the time being and will try to add some more time-animated effects mostly with dynamic GL_TEXTURE matrix.

I'll also suggest adding an Autodesk Max-like scene mesh to the render view that'll allow us to skin the scene better and also use its bottom plane for real shadow projection purposes.

:)

P.S. Yes, I've downloaded the MP4 to watch it off-line. The DL speed was only ca. 180KB/sec and I couldn't watch it in real time. The overall effect is cool but it could be better with a true scene mesh I mentioned above. 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: Peugeot-Onyx (concept car)
« Reply #51 on: January 13, 2018, 09:46:25 pm »


The time will come when we are going to have our own neon glow effect not worse than the one used in TRON. ;)
« Last Edit: January 13, 2018, 09:48:38 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)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Peugeot-Onyx (concept car)
« Reply #52 on: January 14, 2018, 11:44:25 pm »
Billboard link:

Thanks Patrice, I've seen it -- not our case, alas!  ;)

Ambient reflection and emission  :)

Cool!!! Good luck with the rework!  :)

__________________________________________________________________



Та-daaaaaaa!!!...




As I said, the idea isn't mine but the implementation is entirely my own. And I'm quite satisfied with it because it works in all the three cameras without any code changes -- even though it has a tiny glitch in the two non-FPS cameras. When looked upon from the very top in close proximity to the Y axis, the flare goes small and apparently flips backwards (it's a Y-axis aligned cylindrical billboard, after all!) but in all other positions and rotations it looks really impressive. :)

For now it is implemented in C in the Objector's fixed-function pipeline procedure only.

But no no no, don't rush me! First of all I need a coupla days of rest, and I need to wash up the dishes that have piled up in my kitchen sink, and I need to go out to the nearby food store to buy me some fresh food and drink, and the last but not the least, I need some good, sound, uninterrupted, peaceful sleep! ;D
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: Peugeot-Onyx (concept car)
« Reply #53 on: January 15, 2018, 12:11:33 am »
 Bravo my friend, have a good sleep, i can wait for a couple days, but not any longer   :) ;) :D ;D
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Peugeot-Onyx (concept car)
« Reply #54 on: January 16, 2018, 09:55:33 am »
Patrice,

For now we are going to have a restriction on all our billboard and flare meshes hardwired in our .OBJ files:

Be they cylindrical, spherical or textual (HUD-like) by operation, they must all be equilateral squares.

Not elliptical, not circular, not even arbitrarily rectangular. Just regular equilateral foursquare. And they must be texture mapped to the four corners of square images, transparent or opaque.

The reason for this is that currently we aren't using full-featured AABB's (axis aligned bounding boxes) but rather only the mesh center points and bounding sphere radii stored in our mesh structures. Note that we aren't using the billboard's literal corner vertices hardwired in its mesh but rather its center point only, respective to which we reconstruct the four displaced (rotated) corner vertices on the fly using the only one other mesh structure member suitable for this purpose -- the mesh radius. These two mesh structure members are sufficient to reconstruct an equilateral foursquare to an exact size the billboard mesh has in the model without extra hints or parameters. But this is impossible to do for an arbitrary billboard circle mesh without an extra Boolean parameter to hint that it is in fact a circle. Neither is it possible for an arbitrary rectangle without at least one extra numeric parameter specifying its aspect ratio.

This isn't going to be much of a restriction in practice since extra margins can always be clipped with transparency. Yet this rule should be observed, else we won't be able to reproduce the exact metrics of our billboard and flare meshes meticulously hardwired in our models.
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: Peugeot-Onyx (concept car)
« Reply #55 on: January 16, 2018, 12:03:39 pm »
Thanks for the feedback!

I think that having square quads is already a big step forwards...
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Peugeot-Onyx (concept car)
« Reply #56 on: January 16, 2018, 08:21:00 pm »
Patrice,

Theoretically, dynamic vertex creation for billboards/flares can be emulated in GLSL fragment shaders at run time similar to what I showed in my GLSL demos on this site. However, it would be difficult for me to write such shaders myself. Moreover, I strongly suspect that each such emulation would require a unique per-billboard size fragment shader of its own.

My suggestion is to start using GLSL geometry shaders for that purpose. Geo shaders can generate vertex primitives that the regular fragment shaders would automatically accept as if the verts were coming from the model's usual vertex buffers.

GLSL allows the use of geo shaders starting with #version 330 and up. AFAIR we already agreed in the past to use advanced GLSL shaders in due time. I think the time has come. :)

Your thoughts?

______________________________________

;D : (some problems detected in ObjReader though; not all other flares in the group are maintaining correct sizes  :-\)
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: Peugeot-Onyx (concept car)
« Reply #57 on: January 16, 2018, 08:27:42 pm »
My thoughts, is that being mostly a GLSL rookie, i have to follow your advice.
Do what you think is better, if that doesn't match your level of expectation, then we can always revert back.
Patrice
(Always working with the latest Windows version available...)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1980
    • zapsolution
Re: Peugeot-Onyx (concept car)
« Reply #58 on: January 17, 2018, 09:20:49 am »
I have reworked the IPS, it will shows up only in "demo mode".
And display almost the same values than in FRAPS, and nVIDIA FPS counter ...

« Last Edit: January 17, 2018, 11:45:48 am by Patrice Terrier »
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Peugeot-Onyx (concept car)
« Reply #59 on: January 17, 2018, 11:54:35 am »
Patrice,

I've looked into your IPS counter. I do not agree with what and how you're trying to calculate in you render proc. This is not a proper approach and this certainly is not an FPS rate.

Please consider this:

Code: [Select]
    static DWORD nFPS = 0, nNext = GetTickCount() + 1000;

    ............... <snip> .................

    if (gP.nUseFPS) {
        DWORD now = GetTickCount();
        if (now >= nNext) {
            nNext = now + 1000;
            Path_Combine(zMsg, L"FPS ", STRL(++nFPS));
            nFPS = 0;
        } else {
            ++nFPS;
        }
        ZI_DrawGLText(gP.hGL, gP.glfont, 10, 5, zMsg, 0xFF00FF00);
    }

No no, your thanks would be too much for me. Just remember how generous and undemanding I was ...  ;D
« Last Edit: January 17, 2018, 12:26:40 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)