1. 3D (isometric)
- Posted by Gwena=?ISO-8859-1?Q?=EBl?= Joret <mb11363 at TVD.BE> Feb 09, 1999
- 420 views
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 ?? *********convert* (to use with mode 259) global function convert(atom x, atom y, atom z) atom X,Y X=(x/400)*400+(y/400)*400 Y=(1-x/400)*300+(y/400)*300-2*z return {X,Y} end function *********map3d* (it uses "convert") include image.e global procedure map3d(sequence bitmap, integer x1, integer y1,integer z1,integer x2,integer y2,integer z2 ,integer x3,integer y3, integer z3) atom dis1, dis2, cons1, cons2, cons3, addx1, addy1, addz1, addx2, addy2, addz2, u1, v1, w1, u2, v2,w2 sequence bmp, dumb1 bmp=read_bitmap(bitmap) all_palette(bmp[1]/4) dis1=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)+(z1-z2)*(z1-z2)) -- = Distance between (x1,y1,z1) and (x2,y2,z2) dis2=sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3)+(z1-z3)*(z1-z3)) -- = Distance between (x1,y1,z1) and (x3,y3,z3) cons1=2 -- I should'nt use cons1 & cons2, it slow up a lot, but if I don't do that, the textured space is very ugly cons2=2 cons3=length(bmp[2])/dis1/cons1 addx1=(x2-x1)/dis1/cons1 addy1=(y2-y1)/dis1/cons1 addz1=(z2-z1)/dis1/cons1 addx2=(x3-x1)/dis1/cons1 addy2=(y3-y1)/dis1/cons1 addz2=(z3-z1)/dis1/cons1 u1=x1 v1=y1 w1=z1 for i = 1 to length(bmp[2]) by cons3 do u1=u1 + addx1 v1=v1 + addy1 w1=w1 + addz1 u2=u1 v2=v1 w2=w1 for j= 1 to length(bmp[2][i]) by length(bmp[2][i])/dis2/cons2 do u2=u2 + addx2 v2=v2 + addy2 w2=w2 + addz2 dumb1=convert(u2,v2,w2) pixel(bmp[2][i][j],dumb1) end for end for end procedure *********An Exemple* (change the bitmap!) include get.e integer key if graphics_mode(259) then end if map3d("leeloo.bmp", 1,1,1,100,1,1,1,100,1) key=wait_key() ********************
2. Re: 3D (isometric)
- Posted by Mike <michael at IGRIN.CO.NZ> Feb 10, 1999
- 411 views
>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 ?? >*********convert* (to use with mode 259) >global function convert(atom x, atom y, atom z) > atom X,Y > X=(x/400)*400+(y/400)*400 > > return {X,Y} >end function >X=(x/400)*400+(y/400)*400 isn't this the same as X=x+y ? >Y=(1-x/400)*300+(y/400)*300-2*z could simplify to Y = (400 - x + y) * 0.75 - z - z Yikes! I hope my math is OK!! michael at igrin.co.nz
3. Re: 3D (isometric)
- Posted by MrSmily at AOL.COM Feb 10, 1999
- 419 views
>>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 ?? >>*********convert* (to use with mode 259) >>global function convert(atom x, atom y, atom z) >> atom X,Y >> X=(x/400)*400+(y/400)*400 >> >> return {X,Y} >>end function > > >>X=(x/400)*400+(y/400)*400 >isn't this the same as X=x+y ? > >>Y=(1-x/400)*300+(y/400)*300-2*z >could simplify to Y = (400 - x + y) * 0.75 - z - z > >Yikes! I hope my math is OK!! > >michael at igrin.co.nz Actually, I got something like this for Y: Y=(1-x/400)*300+(y/400)*300-2*z Y=300-300*x/400+300*y/400-(z+z) Y=300-.75*x+.75*y-z-z Y=300+.75*(y-x)-z-z MrSmily at aol.com
4. Re: 3D (isometric)
- Posted by Jiri Babor <J.Babor at GNS.CRI.NZ> Feb 11, 1999
- 401 views
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