Results 1 to 1 of 1

Thread: Strached Model / Software Renderer

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Strached Model / Software Renderer

    Hi,
    I'm writing a software renderer.
    I can not understand why my box is streched when I move it.
    Projection issue?

    Code:
    function v3dMakeProjection(v:v3dVector):v3dVector;
    var outV:v3dVector;
        centerX,centerY:longint;
        fNear,fFar,fFov,fAspectRatio,fFovRad:single;
    begin
     
     
                    fNear := 0.01;
                    fFar := 1000.0;
                    fFov := 90.0;
                    fAspectRatio := vScreen.height / vScreen.width;
                    fFovRad := 1.0 / tan(fFov * 0.5 / 180.0 * 3.14159);
     
            outV:=v;
     
            centerX:=vscreen.width div 2;
            centerY:=vscreen.height div 2;
     
           
            outV.x:=fAspectRatio*fFovRad*outV.x / outV.z  * (vScreen.width /  2) + centerX;
            outV.y:=-fFovRad * outV.y / outV.z  * (vScreen.height / 2) + centerY;
            // outV.z:=( (fFar/(fFar-fNear)) - ((fFar*fNear) / (fFar-fNear)) ) * outV.z;
     
            v3dMakeProjection:=outV;
    end;


    What I'm doing wrong?


    http://www.sistavip.com/pub/forum.pas




    to Compile you need the GFX Framework "vipgfx4"
    https://sourceforge.net/projects/vipgfx/files
    Attached Images Attached Images
    Last edited by Key-Real; 17-03-2022 at 07:25 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •