Re: converting 3d in 2d

From: Eagle1 (luca(*punto*)
Date: 05/05/04

  • Next message: ZMan: "Re: converting 3d in 2d"
    Date: Thu, 6 May 2004 00:34:23 +0200

    Thanks a lot.... i don't have too much experience in directx programming...
    First of all sorry for my english... i'll try to make it more correct as
    possible while explaining my problem...
    I have done a cad program where you can draw your objects such as stairs,
    racks ecc.. all in 2d, now in the first version the 3d was made by drawing
    the objects directly, without using any 3d library (i have all object data
    in the three axis) and after drawing all the object an algorithm clear all
    the hidden lines, this works well but is slow and i can't apply surfaces,
    texture, lights ecc. Now i have done the ver 2.0 rewritting the code in c#
    and adding some functionalities, in this version i'd like to implement (if
    it is possible) the 3d side using directx so i can draw my object faster and
    in the future add lights and texture.
    And now the problem... when i'm looking the 3d object in my screen i must
    have the possibility to take a snapshot of the scene, draw it in 2d and to
    quote the resulting object.
    Although my english I hope you understood my problem, if you have any
    suggestion please tell me...

    "ZMan" <news-replies@thezbuffer> ha scritto nel messaggio
    > By window form do you mean on a regular window - excuse the obvious
    > but you know you can render the directx output into a window, or even any
    > rectangular area on a window.
    > So assuming you have other reasons to put it into a window what you are
    > going have to do is essentially write yourself a software renderer. Some
    > things will be easy, others not so easy.
    > For example - drawing the lines and polygons - in this case you just have
    > perform the same transformations as DirectX does. Once you apply the
    > view and projection matrices what you end up with is a set of 2-d
    > coordinates (I think between -1.0 and +1.0) that you can pass into GDI or
    > whatever API you want.
    > However, you are either going to have to write your own triangle rendering
    > code and implement a z-buffer or you will have to sort all the triangles
    > render then from back to front to ensure you only see the correct ones.
    > If you want to implement lighting you are going to have to write your own
    > triangle code to ensure the pixels are the right color. And if you have
    > vertex or pixel shaders you will have to implement those yourself too.
    > Bottom line it will be very slow for anything other than simple scene.
    > There may be some software renderer products out there that can do this
    > you - e.g. From what I understand
    > its not too hard to port DirectX code into this renderer.
    > Maybe if you explain why you want to render it this way we can come up
    > a better solution using MDX rather than redrawing it all yourself.
    > Zman

  • Next message: ZMan: "Re: converting 3d in 2d"