Author Topic: Ultima  (Read 28925 times)

ficedula

  • *
  • Posts: 2178
    • View Profile
    • http://www.ficedula.co.uk
Ultima
« Reply #50 on: 2001-09-02 19:08:00 »
Well, that doesn't happen on my programs, so it's something with the way you've set OpenGL up. So I can't really tell without seeing your code.

I'm guessing it's something to do with the way you've set up your projection matrix. How *have* you set up your projection?


Anonymous

  • Guest
Ultima
« Reply #51 on: 2001-09-02 20:46:00 »
lol. i feel so left out. oh well. hope i win the Powerball this month and ill have enough money to buy 1 million GF3s. Till then, i have to transfer a lot of files.

Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
Ultima
« Reply #52 on: 2001-09-03 18:18:00 »
code:

    Dim pfd As PIXELFORMATDESCRIPTOR
    Dim RetVal As Long
   
    pfd.nSize = Len(pfd)
    pfd.nVersion = 1
    pfd.dwFlags = PFD_SUPPORT_OPENGL Or PFD_DRAW_TO_WINDOW Or PFD_DOUBLEBUFFER Or PFD_TYPE_RGBA
    pfd.iPixelType = PFD_TYPE_RGBA
    pfd.cColorBits = 16
    pfd.cDepthBits = 16
    pfd.iLayerType = PFD_MAIN_PLANE
   
    RetVal = ChoosePixelFormat(picFront.hDC, pfd)
    SetPixelFormat picFront.hDC, RetVal, pfd
    hGLRC2 = wglCreateContext(picFront.hDC)
    wglMakeCurrent picFront.hDC, hGLRC2
   
    RetVal = ChoosePixelFormat(picSide.hDC, pfd)
    SetPixelFormat picSide.hDC, RetVal, pfd
    hGLRC3 = wglCreateContext(picSide.hDC)
    wglMakeCurrent picSide.hDC, hGLRC3
   
    RetVal = ChoosePixelFormat(picTop.hDC, pfd)
    SetPixelFormat picTop.hDC, RetVal, pfd
    hGLRC4 = wglCreateContext(picTop.hDC)
    wglMakeCurrent picTop.hDC, hGLRC4
   
    RetVal = ChoosePixelFormat(picOutput.hDC, pfd)
    SetPixelFormat picOutput.hDC, RetVal, pfd
     hGLRC = wglCreateContext(picOutput.hDC)
    wglMakeCurrent picOutput.hDC, hGLRC
   
   
    glEnable GL_DEPTH_TEST
    glFrontFace GL_CCW
             
    Dim SpecRef(3) As GLfloat
       
    SpecRef(0) = 0.5
    SpecRef(1) = 0.5
    SpecRef(2) = 0.5
    SpecRef(3) = 0.5
   
    glEnable GL_COLOR_MATERIAL
    glColorMaterial GL_FRONT, GL_AMBIENT_AND_DIFFUSE
    glMaterialfv GL_FRONT, GL_SPECULAR, SpecRef(0)
    glMateriali GL_FRONT, GL_SHININESS, 128

   glEnable glcTexture2D
    glClearColor 0#, 0#, 0#, 0#
    glEnable glcDepthTest
    glShadeModel smSmooth
    glEnable GL_BLEND
    glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA

   glClearColor 1, 1, 1, 0

[/quote]

I hope that's what you asked for...

- Alhexx

- edit -
Deleted comments in source

[This message has been edited by Alhexx (edited September 03, 2001).]


ficedula

  • *
  • Posts: 2178
    • View Profile
    • http://www.ficedula.co.uk
Ultima
« Reply #53 on: 2001-09-03 21:36:00 »
No, it's not. I want to know how you've set up your projection matrix. If you don't know what I'm talking about, maybe you haven't set one up, which is your problem.

You'd change the projection matrix using glMatrixMode(GL_PROJECTION);
got anything like that in your source?


Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
Ultima
« Reply #54 on: 2001-09-04 00:45:00 »
Hm, nope - the above code is everything is set up. So how can I set up the matrix to make it work well?
(I hope I'm now annoying you with that trash...)

- Alhexx


ficedula

  • *
  • Posts: 2178
    • View Profile
    • http://www.ficedula.co.uk
Ultima
« Reply #55 on: 2001-09-04 02:00:00 »
OK ... time for another OpenGL lesson.

There are 3 matrixes in OGL: Modelview, Projection and Texture.

The Modelview is the one you're familiar with; it holds rotations, translations, scalings, and so on, that are applied to any points (polygons) you draw - ie. glVertex commands.

The Texture matrix does exactly the same thing, but for texture coordinates (glTexCoord commands). It's not used very often of course, because it's fairly rare that you need to change texcoords at all, never mind do anything fancy like translate or rotate them. Nevertheless, the matrix IS still there if you need it.

The Projection matrix affects points, like the Modelview matrix, but in a different way. The Projection matrix basically sets how the final image is "projected" onto the 2D screen window.

So, one thing the projection matrix is used for, is setting how "wide" the field of view for the scene is. Also, the "aspect ratio" of the display - you can use that to stretch out the display up or sideways. It's also related to, for example, how many "units" wide and high you can see on the screen at once. For example, if you draw a point at (1,0,1), will that appear *just* to the right of middle, or over on the far right of the screen? That's the sort of thing it controls. A *bit* like a "zoom" control.

Finally, the projection matrix ALSO controls the depth clipping planes. In other words, how far away an object has to be before it's totally ignored and not drawn - also, how CLOSE to the "camera" an object has to be before it's ignored and not drawn.

Hence, if an object is disappearing when it gets close up, then your near depth clipping plane is set too far in front of the camera.

To set up a projection matrix, the easiest way is (when you're setting up OpenGL, ie. after it's been initialized and you're just setting up default stuff like lighting):

glMatrixMode(GL_PROJECTION);
{Switch to editing projection}
glLoadIdentity;
{Default matrix load}
gluPerspective(90, Width/height, 1, 1000);
{Set up projection properly}
glMatrixMode(GL_MODELVIEW);
{Switch back to editing normal matrix}

gluPerspective - look it up in the help files. It's the easiest way to set up projections.

Why bother setting near and far depth clipping? Accuracy. Think about it: If you only deal with objects between 1 and 10 "units" distance away, you can store the distances (depths) with MUCH greater accuracy, than if you need to deal with objects between 1 and 10000 "units" away. In that case, because the numbers are larger, you'd have much less accuracy - possibly very little or no decimal point accuracy at all.

So you set up the depth clipping depending on what you're viewing. If no object EVER gets more than say 100 units distance away from the camera, then tell OpenGL that! It can then devote less space to storing the integer part of the distance, and more to storing the fractional part - giving more accuracy, and better quality depth calculations.

OK ... I think that's all you need to know (and a bit more!)  :)


Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
Ultima
« Reply #56 on: 2001-09-04 22:13:00 »
Yeah, that's it...but now I've got another fine problem... I've created a fish-eye-view   :D

http://www.8ung.at/alhexx/yuffie_fish_eye.gif" border=0>

- Alhexx

- edit -
Had to correct the link for the pic

[This message has been edited by Alhexx (edited September 04, 2001).]


ficedula

  • *
  • Posts: 2178
    • View Profile
    • http://www.ficedula.co.uk
Ultima
« Reply #57 on: 2001-09-04 22:26:00 »
First of all, try a different FOV setting (first parameter to gluPerspective).

Secondly, have you set the aspect ratio correctly?

Thirdly, have you got the min/max depth distances ok? Remember, if you set the max depth too high, you lose a lot of precision for when polygons are close together.


Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
Ultima
« Reply #58 on: 2001-09-06 16:20:00 »
Ops, I've forgotten sth: I wanted to post this, too:


code:
    glMatrixMode mmProjection
    glLoadIdentity
    gluPerspective 90, picOutput.Width / picOutput.Height, 0.001, 1000
    gluLookAt 0, 0, 1.5, 0, 0, 0, 0, 1, 0
    glMatrixMode mmModelView
[/quote]

That are my current settings, but since I've got some ideas by you now, I'm going to try a bit around...

- Alhexx

- edit -
PicOutput is the output window for the 3d view.  :)

[This message has been edited by Alhexx (edited September 06, 2001).]


ficedula

  • *
  • Posts: 2178
    • View Profile
    • http://www.ficedula.co.uk
Ultima
« Reply #59 on: 2001-09-06 18:40:00 »
You could try a FOV of 45 rather than 90.

Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
Ultima
« Reply #60 on: 2001-09-07 16:49:00 »
Okay, I'll do that.

- Alhexx


Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
Ultima
« Reply #61 on: 2001-09-08 14:17:00 »
Fice: Yeah, it worx! It looks a *bit* different as w/o setting up the projection matrix... I'm going to release a new version of Ultima the next days...

BTW: How are the default settings for the Projection Matrix (when I don't set it up manually)?

BTW 2: Yeah, Fice's got 995+ Posts! Go for the 1K !!!

- Alhexx


ficedula

  • *
  • Posts: 2178
    • View Profile
    • http://www.ficedula.co.uk
Ultima
« Reply #62 on: 2001-09-08 14:28:00 »
The default setting for all matrices is the Identity .... but I'm not quite sure what that translates to in terms of projection views. Probably a standard ratio of 1:1, FOV of 45, something like that.

2 posts to go...

[This message has been edited by ficedula (edited September 08, 2001).]


Anonymous

  • Guest
Ultima
« Reply #63 on: 2001-09-08 20:46:00 »
go no life fice!

Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
Ultima
« Reply #64 on: 2001-09-14 21:51:00 »
(He's already No Life  :D )

Finally, I've uploaded a new version of Ultima.
You can acces my page from:
 http://alhexx.cjb.net" TARGET=_blank>http://alhexx.cjb.net


 - Alhexx


Anonymous

  • Guest
Ultima
« Reply #65 on: 2001-09-14 22:31:00 »
Hey alhexx does that set the file name length thing?

Anonymous

  • Guest
Ultima
« Reply #66 on: 2001-09-14 22:39:00 »
Runtime error '76'. Path not found. I hate my computer >=(

Anonymous

  • Guest
Ultima
« Reply #67 on: 2001-09-14 22:40:00 »
hehe my bad. nevermind

Anonymous

  • Guest
Ultima
« Reply #68 on: 2001-09-14 22:43:00 »

Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
Ultima
« Reply #69 on: 2001-09-15 15:14:00 »
fine name length: Ehm, no idea? I think I did, but I'm not 100& sure  :D

As for the link: I prefer that everybody uses my site (b'cause of the counter  :wink: )

(Does it finally work on your comp?)

- Alhexx


ficedula

  • *
  • Posts: 2178
    • View Profile
    • http://www.ficedula.co.uk
Ultima
« Reply #70 on: 2001-09-15 15:36:00 »
Alhexx: What he means is, there's no link on your PAGE to the new version.

Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
Ultima
« Reply #71 on: 2001-09-15 18:00:00 »
Whoa!  :D
I've checked my site today, and I found A LOT of bugs in it. Now I've uploaded a fixed version...

- Alhexx


Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
Ultima
« Reply #72 on: 2001-10-06 09:57:00 »
Sorry, had to push this topic up :grin:

And Sorry, there's no new Version available, but:

I need some info for the next version:
1. It'd be fine if everyone who uses ultima, could post a reply here, which contains:
 - 1: The info that (s)he uses Ultima.
 - 2: His/Her screen resolution.


I need the info 'bout the screen resolution, b'cause I've got to rearrange the window...and I'm not sure if the Ultima Window isn't too big for some users...


Another point: I'm implementing a 'whole-model-converter', and I need some info (I guess this goes out to Fice and mirex) :

How do I get the default model pos? The first frame of the model's .a file?

 - Alhexx

Darkness

  • *
  • Posts: 2181
    • View Profile
    • http://www.x0r.net
Ultima
« Reply #73 on: 2001-10-06 15:29:00 »
i use it (whenever possible) at 1024x768

ficedula

  • *
  • Posts: 2178
    • View Profile
    • http://www.ficedula.co.uk
Ultima
« Reply #74 on: 2001-10-06 22:12:00 »
Default model pos? There aint any. Otherwise stuff would be a lot easier :wink:

The HRC by itself provides NO information about how to position each part (well, there's a bone length, but by itself that's useless). In order to position the parts correctly you need to use a frame from an animation (.A file). How to use the .A file? Aha ... that's the tricky bit. Gimme a while to write up a description ... it's not TOO complex, but it does need to be done *just* right or you end up with a complete mess.

Which .A files to use? No easy explanation ... if you've got the latest version of Ifalna then you could use the .FILTER file I put together for that.