Board index » delphi » 3D - HUH - HELP ME

3D - HUH - HELP ME

IS there anyone who has some kind of tutorial of basic 3d routines.
I need things like 3d BOX (wire frame), textured objects, vector styled
things and even basic point rotating code in 3d.
                                     Thanks
                                       Daniel Skrobo
                                              (dskr...@jagor.srce.hr)
P.S.
   That documentation shuld be written for dummies like me but if you
think that is not send it anyway
   Sorry for any grammar errors ..

 

Re:3D - HUH - HELP ME


Quote
Daniel Skrobo wrote:

> IS there anyone who has some kind of tutorial of basic 3d routines.
> I need things like 3d BOX (wire frame), textured objects, vector styled
> things and even basic point rotating code in 3d.

Try archie search for PCGPE. It contains all this and a bit more ;)

Cheers
  Dmitri

--
-------------------------------------------------------------------
 Dmitri Poujlivyi                 mailto:dmi...@god.bel.alcatel.be
 OLS Research Integration Team              De Villermontstraat 38
 Alcatel Telecom                            2550 Kontich   Belgium
 tel (+32/3) 450 3324                         fax (+32/3) 450 3551
-------------------------------------------------------------------

Re:3D - HUH - HELP ME


Quote
> IS there anyone who has some kind of tutorial of basic 3d routines.
> I need things like 3d BOX (wire frame), textured objects, vector styled
> things and even basic point rotating code in 3d.

I have not such a tutorial... And I never found a GOOD tutorial, that's why I
have written a lot of 3D code alone... But first code were REALLY bad and would
not work... But with time I've found the way :-)) The best way is to found a
book about 3D. But I will explain you how to do, it's not so complicated:

First you have to define your object, do like that to define a cube, for
example:

{ define point type }
TYPE
TPoint = record x, y, z : integer; END;

{and then the cube}
CONST
a=30 ;  { value of one cube "line" }
cube      : ARRAY[1..8] of tpoint =
            (  (-a, -a, -a), (a, -a, -a), (a, a, -a), (-a, a, -a),
               (-a, -a,  a), (a, -a,  a), (a, a,  a), (-a, a,  a)  );

Now you have to convert 3D to 2D, you have two principles ways, first you can
convert into isometric, it means that you have the z axis perpendicular to
screen, then you have  (x, y, z)  -> (x', y') :

Procedure Convert2D(p : tpoint; VAR x, y : integer);
Begin
  x=:point.x;
  y:=point.y;
End;

You can do some perspective too.

And after you just have to perform some 3D rotation to your points. If you want
more info, just tell me because I cant go further right now... I have some
lessons...

Bye,
Alexis (discovery/EfS!)

Quote
>                                      Thanks
>                                        Daniel Skrobo
>                                               (dskr...@jagor.srce.hr)
> P.S.
>    That documentation shuld be written for dummies like me but if you
> think that is not send it anyway
>    Sorry for any grammar errors ..

Re:3D - HUH - HELP ME


In article <1996Nov26.100729.5347@news>,

Quote
 <Alexis.Dom...@etudiants.unine.ch> wrote:

:

: > IS there anyone who has some kind of tutorial of basic 3d
: > routines.

Check out SimTel for the 3DGPL, in msdos/graphics I believe.  (note
that it needs modification to work under DJGPP, possibly others)

: > I need things like 3d BOX (wire frame), textured objects, vector
: > styled things and even basic point rotating code in 3d.

: I have not such a tutorial... And I never found a GOOD tutorial,
: that's why I have written a lot of 3D code alone... But first code
: were REALLY bad and would not work... But with time I've found the
: way :-)) The best way is to found a book about 3D. But I will
: explain you how to do, it's not so complicated:

[simple wireframe deleted]

: Now you have to convert 3D to 2D, you have two principles ways, first you can
: convert into isometric, it means that you have the z axis perpendicular to
: screen, then you have  (x, y, z)  -> (x', y') :

All 3D to 2D mappings are of the form "(x, y, z)  -> (x', y')"  :-)

: Procedure Convert2D(p : tpoint; VAR x, y : integer);
: Begin
:   x=:point.x;
:   y:=point.y;
: End;

That is not an isometric projection, that is parallel projection.
Isometric projection has X at 30 degrees to horizontal, Z at 150
degrees and Y going up.  The axes for an isometric projection look
like the following

        |
        |
        | Y
        |
~~--__  |  __--~~
  Z   ~~"~~   X

The parallel projection you describe looks like this

|
| Y
|             (Z disappears into the screen)
|
|_________
     X

: You can do some perspective too.

Which is basicly dividing X and Y by Z.

: And after you just have to perform some 3D rotation to your
: points.

X' = X * cos(A) + Y * sin(A)
Y' = -X * sin(A) + Y * cos(A)

Easily derivable for the other two axes (XZ and YZ)

You will want to do this before projection, otherwise it will look
very strange.

Steve
--
 ____ ____
/ __//___ \  Steve Piner - spi...@sans.vuw.ac.nz
\__ \ |  _/-----------------------------------------------------
/___/ |_|    (yes, I know it's a BUAF, but it's *my* BUAF) :-)

Other Threads