Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

New way of rendering

CorrailCorrail Member Posts: 4
Hi all!

I'm thinking of a new way of rendering. My idea is the following:


Setting up a vertex program which only does tranformations
Setting up a fragment program which only does transformations

Drawing all primitives of a scene with an id (for example passing a pointer using the Color)

Caching the calculated vertices of all primitives

Determining which primitives are drawn in the frame buffer (which Colors are in the frame buffer if the primitives are drawn with the pointer as its color)

Setting up a vertex program which does lithing, shadowing, ...
Setting up a fragment program which does lighting, shadowing, bump-mapping, ...

Drawing all primitives which are in the frame buffer (no transformation is needed because the vertices are cached)

What do you think about it? Any comments?

Thanks a lot
Corrail

Comments

  • chick80chick80 Member Posts: 349
    Pheraphs I'm missing some step... what's the innovation in that?

    nICO

    [hr]
    [italic]How beautiful, if sorrow had not made Sorrow more beautiful than Beauty itself.[/italic]
    JOHN KEATS


  • CorrailCorrail Member Posts: 4
    : Pheraphs I'm missing some step... what's the innovation in that?
    :
    : nICO
    :
    : [hr]
    : [italic]How beautiful, if sorrow had not made Sorrow more beautiful than Beauty itself.[/italic]
    : JOHN KEATS
    :
    :
    :

    I don't know but I didn't found any API calls (OpenGL or DirectX) which do this!

    Corrail
  • chick80chick80 Member Posts: 349
    Pheraphs I didn't understand right what you want to do, but personally I think this is a good method:
    before rendering do a frustum culling test on the objects bounding boxes to see if the object is in view: in this way you don't have to render non seen objects (see http://www.cs.unc.edu/~hoff/research/vfculler/viewcull.html for a good explanation of frustum culling or, if you use DX look at the SDK Culling sample).
    You should recalculate the culling state only when the object moves or when the camera moves (in the last case you should recalculate it for ALL the objects).
    Now you can draw the object with the normal functions (DrawPrimitive for DX) or you can use a vertex shader to render the object.
    As for the transformation calculation you can keep the transform matrix of the object in a variable, so you don't have to recalculate it every frame, but only when the object moves.
    Note that if you use a vertex shader to transform the vertex position it should be slightly faster then using standard rendering functions as vertex shaders are handled by the GPU that is optimized for matrix calculations. Anyhow if you do the transform in the vertex shader you should also implement the lightning in the vertex shader and you cannot use the standard lightning functions to light your object.

    The method you proposed is not so good because you're doing two render passes after all, and in the first pass you render all of the objects.

    bye
    nICO



    [hr]
    [italic]How beautiful, if sorrow had not made Sorrow more beautiful than Beauty itself.[/italic]
    JOHN KEATS


Sign In or Register to comment.