Re: 3D (isometric)

new topic     » goto parent     » topic index » view thread      » older message » newer message

Gwenael wrote:

>Hi again!
>Thanx for the URL!
>I made a little procedure to do +-3D Isometric (Starcraft-like) texturing,
>But it's very very slow and I need to speed it up!
>Can You help me please ??
<snip>

First of all I do not think your routines generate, strictly speaking,
truly isometric views.

Apart from that, they are also inefficient (slow) and often produce
imperfect images. Michael, another New Zealander, already took out his
bloody big bush knife and hacked off about three percent of fat from
the monster. Not enough.

Last night I spent several hours on a slightly different version of
pseudo-isometric tools. They are typically 50 to 100 times faster than
yours, but they are also very clever, finely balanced set, so save the
original copy before you start hacking into it.

Feed your bitmap into the iso() function first. It produces a raw
rectangular image that in turn has to be processed by the second
routine, iso_display() procedure. It will spit out the final, already
trimmed image. If you use these two routines with a good set of tools
to suitably massage the original image (you can try my map.e,
somewhere on the Recent Contribution Page or in the Archives, for
reasonably fast linear/non-linear scaling routines), you may have a
start of a workable system. If I find a free evening or two in the
next few weeks, I might have go at it myself, but don't hold your
breath... Enjoy. jiri


--  file  : iso.e
--  author: jiri babor
--  date  : 99-02-10
--  email : jbabor at paradise.net.nz
--  topic : fast pseudo-isometry

without type_check

global function iso(sequence bmp)
    sequence s
    integer m,n
    m = length(bmp[1])
    n = length(bmp)
    s = repeat(repeat(0,m+n),m+n-1)
    for y=1 to n do
        for x=1 to m do
            s[n+x-y][x+y] = bmp[y][x]
        end for
    end for
    return s
end function

global procedure iso_display(integer x,integer y,sequence s)
    sequence t,u
    integer di1,di2,i1,i2,L
    L = length(s[1])
    i1=length(bmp)+1
    i2=i1
    di1 = -4
    di2 = 4
    for r=1 to length(s) by 4 do
        t = s[r]
        u = {}
        for i=i1 to i2 by 2 do
            u &= t[i]
        end for
        pixel(u,{x+(i1-1)/2,y})
        i1 += di1
        if i1<1 then
            di1 = -di1
            i1 += di1
        end if
        i2 += di2
        if i2>L then
            di2 = -di2
            i2 += di2
        end if
        y += 1
    end for
end procedure

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu