Looking for developers (Development Foros MSX)MSX Resource Center            
                       
English Nederlands Espa�ol Portugu�s Russian                  
 Noticias
   Página principal
  Almacén de noticias
  Temas de noticias

 Recursos
   Foros MSX
  Artículos
  Analisis
  Informe de ferias/RUs
  Álbum de fotos
  Ferias y encuentros
  Encuestas
  Enlaces
  Buscar

 Software
   Descargas
  Tienda Online

 MRC
   Quiénes somos
  Únete a nuestro equipo
  Donar
  Políticas
  Contacta con nosotros
  Enlázanos
  Estadísticas

 Buscar
 
  

  

 Login
 

Login

Contraseña




¿Aún no tienes una cuenta? ¡Conviértete en miembro del MSX Resource Center! ¡Únete a nosotros!.


 Estadísticas
 

Hay 47 invitados y 0 miembros en línea

Eres un usuario anónimo.
 

Foros MSX


Foros MSX

Development - Looking for developers

Ir a la página ( Página anterior 1 | 2 | 3 | 4 | 5 )
Autor

Looking for developers

GhostwriterP
msx addict
Mensajes: 320
Publicado: Enero 12 2005, 22:06   
Did i mention i do like the deformation effect you created with your basic program.
It is really fun . But dont draw the entire cube just the planes.

flyguille
msx master
Mensajes: 1237
Publicado: Enero 12 2005, 22:15   
XX = cos(zv)*cos(yv)
YX = cos(yv)*sin(zv)
ZX = -sin(yv)
XY = sin(xv)*sin(yv)*cos(zv)
XY(2) = cos(xv)*sin(zv)
YY = sin(zv)*sin(xv)*sin(yv)
YY(2) = cos(xv)*cos(zv)
ZY = sin(xv)*cos(yv)
XZ = cos(zv)*cos(xv)*sin(yv)
XZ(2) = sin(zv)*sin(xv)
YZ = sin(zv)*cos(xv)*sin(yv)
YZ(2) = sin(xv)*cos(zv)
ZZ = cos(xv)*cos(yv)

XS = (XP*XX + YP*YX + ZP*ZX)
YS = (XP*XY + XP*XY(2) + YP*YY + YP*YY(2) + ZP*ZY)
ZS = (XP*XZ - XP*XZ(2) + YP*YZ * YP*YZ(2) + ZP*ZZ)


mmm. variable naming is up to 2 chrs in GWBASIC.....
so using matriz (2)

anyway i wonders why, now is needed 4 multiplications more per point.
GhostwriterP
msx addict
Mensajes: 320
Publicado: Enero 12 2005, 22:18   
You can add them in the 1st step!
GhostwriterP
msx addict
Mensajes: 320
Publicado: Enero 12 2005, 22:20   
XY = sin(xv)*sin(yv)*cos(zv) + cos(xv)*sin(zv)

YY = sin(zv)*sin(xv)*sin(yv) + cos(xv)*cos(zv)

XZ = cos(zv)*cos(xv)*sin(yv) - sin(zv)*sin(xv)

YZ = sin(zv)*cos(xv)*sin(yv) - sin(xv)*cos(zv)


manuel
msx guru
Mensajes: 3635
Publicado: Enero 12 2005, 22:25   
Routines for projecting to a plane from 3D coordinates are really simple:

This is in Pascal:

PROCEDURE Project(CONST q:Vector;VAR p:Vector); {Project 3D -> 2D screen}
BEGIN
p.x:=Inp(q,Sv.u)*Sqr(ZoomFactor);
p.y:=Inp(q,Sv.v)*Sqr(ZoomFactor);
p.z:=0.0;
END;

where:

FUNCTION Inp(CONST vec1,vec2:Vector):real; {Calc inproduct between 2 vectors}
BEGIN
Inp:=vec1.x*vec2.x+vec1.y*vec2.y+vec1.z*vec2.z;
END;

and:

TYPE Vector=RECORD
x:real;
y:real;
z:real;
END;

This definately works, but is very unoptimized.

In case this is an obsolete post because it's already all known: sorry

flyguille
msx master
Mensajes: 1237
Publicado: Enero 12 2005, 22:26   
well, i modified the listing... and your new formula have exactly the same problem but more noticeable.

10 ZC = 2.5: XC = 300 : YC = 150 : AX = 80: AY =40
20 XV = 0: YV=0: ZV=0 : PI=3.14:SCREEN 9
30 CLS:GOSUB 1000
35 FOR XP=-1 TO 1 STEP .25
40 FOR YP=-1 TO 1 STEP .25
50 ZP=-1:GOSUB 2000:PSET(XS,YS),15:FOR ZP=-1 TO 1 STEP .25
60 GOSUB 2000:LINE-(XS,YS),15
70 NEXT ZP,YP,XP
71 FOR XP=-1 TO 1 STEP .25
72 FOR ZP=-1 TO 1 STEP .25
73 YP=-1:GOSUB 2000:PSET(XS,YS),15:FOR YP=-1 TO 1 STEP .25
74 GOSUB 2000:LINE-(XS,YS),15
75 NEXT YP,ZP,XP
80 FOR YP=-1 TO 1 STEP .25
81 FOR ZP=-1 TO 1 STEP .25
82 XP=-1:GOSUB 2000:PSET(XS,YS),15:FOR XP=-1 TO 1 STEP .25
83 GOSUB 2000:LINE-(XS,YS),(XP+1)*7
84 NEXT XP,ZP,YP
89 A$=INPUT$(1)
90 IF A$="A" THEN YV=YV-.05:IF YV<-1 THEN YV=1
100 IF A$="S" THEN XV=XV+.05:IF XV>1 THEN XV=-1
110 IF A$="D" THEN YV=YV+.05:IF YV>1 THEN YV=-1
120 IF A$="W" THEN XV=XV-.05:IF XV<-1 THEN XV=1
130 IF A$="Z" THEN ZV=ZV-.05:IF ZV<-1 THEN ZV=1
140 IF A$="X" THEN ZV=ZV+.05:IF ZV>1 THEN ZV=-1
150 GOTO 30
1000 XX = cos(zv)*cos(yv):YX = cos(yv)*sin(zv):ZX = -sin(yv)
1010 XY = sin(xv)*sin(yv)*cos(zv):XY(2) = cos(xv)*sin(zv):YY = sin(zv)*sin(xv)*sin(yv)
1020 YY(2) = cos(xv)*cos(zv):ZY = sin(xv)*cos(yv):XZ = cos(zv)*cos(xv)*sin(yv)
1030 XZ(2) = sin(zv)*sin(xv):YZ = sin(zv)*cos(xv)*sin(yv):YZ(2) = sin(xv)*cos(zv)
1040 ZZ = cos(xv)*cos(yv)
1100 RETURN
2000 ZS = (XP*XZ - XP*XZ(2) + YP*YZ * YP*YZ(2) + ZP*ZZ)
2010 XS = (XP*XX + YP*YX + ZP*ZX) * (ZS+ZC) * AX + XC
2020 YS = (XP*XY + XP*XY(2) + YP*YY + YP*YY(2) + ZP*ZY) * (ZS+ZC) * AY + YC
2030 RETURN



GhostwriterP
msx addict
Mensajes: 320
Publicado: Enero 12 2005, 22:40   
It starting to look like a bug sneeked somewhere into the perspective
calculations .
try something like: google google...

OneOverZ= 1/wz;
sx = wx * XSCALE * OneOverZ + XCenter;
sy = -wy * YSCALE * OneOverZ + YCenter;

thus somthing like

2005 IF ZS=0 THEN ZS=1
2010 XS = (XP*XX + YP*YX + ZP*ZX) * 1/(ZS*AZ) * AX + XC
2020 YS = (XP*XY + XP*XY(2) + YP*YY + YP*YY(2) + ZP*ZY) * 1/(ZS*AZ) * AY + YC
2030 RETURN
flyguille
msx master
Mensajes: 1237
Publicado: Enero 12 2005, 22:53   
the trick of increasing Z in offset in STEP 2 makes that Z have less effect on the drawing ... and you can see a cube more cube . But that doesn't help, because with that you can't to draw far deep into the screen.

that trick i used also with my original formula.


GhostwriterP
msx addict
Mensajes: 320
Publicado: Enero 12 2005, 23:30   
Nevermind my last post, doesn't work!
flyguille
msx master
Mensajes: 1237
Publicado: Enero 13 2005, 01:41   
what hell is to correct the Z perspective.

i was trying to do a bypass on ZS

like, ZS=SIN(ZS*PI)
or
ZS=1-COS(ZS*PI)

things to have in account

the range that reach ZS before of the bypass is -1.65 to +1.65 or near of that

we need to correct the Z perspective a NON LINEAR bypass.

by today i did my best try... tomorrow i will see.


GhostwriterP
msx addict
Mensajes: 320
Publicado: Enero 13 2005, 11:08   
Hmmm... This is looking better. Still this blownup feeling but that is just
the 3D -> 2D part.

Here flyguille try this
 
10 ZC = 2.5: XC = 128 : YC = 106 : AX = 25: AY =25
20 XV = 0: YV=0: ZV=0 : PI=3.14:SCREEN 5
30 CLS:GOSUB 1000
35 FOR XP=-1 TO 1 STEP .5
40 FOR YP=-1 TO 1 STEP .5
50 ZP=-1:GOSUB 2000:PSET(XS,YS),15:FOR ZP=-1 TO 1 STEP .5
60 GOSUB 2000:LINE-(XS,YS),15
70 NEXT ZP,YP,XP
71 FOR XP=-1 TO 1 STEP .5
72 FOR ZP=-1 TO 1 STEP .5
73 YP=-1:GOSUB 2000:PSET(XS,YS),15:FOR YP=-1 TO 1 STEP .5
74 GOSUB 2000:LINE-(XS,YS),15
75 NEXT YP,ZP,XP:GOTO 89
80 FOR YP=-1 TO 1 STEP .5
81 FOR ZP=-1 TO 1 STEP .5
82 XP=-1:GOSUB 2000:PSET(XS,YS),15:FOR XP=-1 TO 1 STEP .5
83 GOSUB 2000:LINE-(XS,YS),(XP+1)*7
84 NEXT XP,ZP,YP
89 A$=INPUT$(1)
90 IF A$="a" THEN YV=YV-.25:IF YV<-1 THEN YV=1
100 IF A$="s" THEN XV=XV+.25:IF XV>1 THEN XV=-1
110 IF A$="d" THEN YV=YV+.25:IF YV>1 THEN YV=-1
120 IF A$="w" THEN XV=XV-.25:IF XV<-1 THEN XV=1
130 IF A$="z" THEN ZV=ZV-.25:IF ZV<-1 THEN ZV=1
140 IF A$="x" THEN ZV=ZV+.25:IF ZV>1 THEN ZV=-1
150 GOTO 30
1000 XX = cos(zv)*cos(yv):YX = cos(yv)*sin(zv):ZX = -sin(yv)
1010 XY = sin(xv)*sin(yv)*cos(zv)-cos(xv)*sin(zv)
1015 YY = sin(zv)*sin(xv)*sin(yv)+cos(xv)*cos(zv)
1020 ZY = sin(xv)*cos(yv):XZ = cos(zv)*cos(xv)*sin(yv)+sin(zv)*sin(xv)
1030 YZ = sin(zv)*cos(xv)*sin(yv)-sin(xv)*cos(zv)
1040 ZZ = cos(xv)*cos(yv)
1100 RETURN
2000 ZS = (XP*XZ + YP*YZ + ZP*ZZ)
2010 XS = (XP*XX + YP*YX + ZP*ZX) * (ZS+ZC) * AX + XC
2020 YS = (XP*XY + YP*YY + ZP*ZY) * (ZS+ZC) * AY + YC
2030 RETURN


I overlooked a minus sign in one of the rotational matrices, so the formula's
wich I gave you weren't accurate, sorry about that .
Oh, this program is MSX-Basic ( i.e. screen5).

flyguille
msx master
Mensajes: 1237
Publicado: Enero 13 2005, 14:52   
mmmmm. that has problems with the rotation on the 3 axis......

it has big jumps on the rotation


ahhhhhh. wait, you don't do XV*PI , YV*PI and ZV*PI at SIN() COS()
flyguille
msx master
Mensajes: 1237
Publicado: Enero 13 2005, 14:54   
anyway yesterday i back to the wolf's formula because it has less multiplications at the step 1.



flyguille
msx master
Mensajes: 1237
Publicado: Enero 13 2005, 18:45   
in this listing i corrected the deformation partialy (line 2001). Was corrected the FAR drawing.... but the NEAR drawing still wrong. Anyway it is less rounded

also in this listing i was playing with ZOOM in/out, using a convination of Z offseting plus a try to cut the drawing when it falls too NEAR (like out back of the cammera). Giving the impression that we flys inside of the cube. But take in account that the lines drawed are done NOT pixel by pixel. keys "1" and "2" changes the ZOOM.







10 ZC = 2.5: XC = 300 : YC = 150 : AX = 80: AY =40:DE=4
20 XV = 0: YV=0: ZV=0 : PI=3.1415926#:SCREEN 9
30 CLS:GOSUB 1000
35 FOR XP=-1 TO 1 STEP 1
40 FOR YP=-1 TO 1 STEP .5
50 FOR ZP=-1 TO .75 STEP .25
60 GOSUB 2000:IF ZS<DE THEN PSET(XS,YS):ZP=ZP+.25:GOSUB 2000:LINE-(XS,YS),15:ZP=ZP-.25
70 NEXT ZP,YP,XP
71 FOR XP=-1 TO 1 STEP 1
72 FOR ZP=-1 TO 1 STEP .5
73 FOR YP=-1 TO .75 STEP .25
74 GOSUB 2000:IF ZS<DE THEN PSET(XS,YS):YP=YP+.25:GOSUB 2000:LINE-(XS,YS),15:YP=YP-.25
75 NEXT YP,ZP,XP
80 FOR YP=-1 TO 1 STEP 1
81 FOR ZP=-1 TO 1 STEP .25
82 FOR XP=-1 TO .75 STEP .25
83 GOSUB 2000:IF ZS<DE THEN PSET(XS,YS):XP=XP+.25:GOSUB 2000:LINE-(XS,YS),(XP+1)*7:XP=XP-.25
84 NEXT XP,ZP,YP
85 FOR ZP=-1 TO 1 STEP 1
86 FOR YP=-1 TO 1 STEP .5
87 FOR XP=-1 TO .75 STEP .25
88 GOSUB 2000:IF ZS<DE THEN PSET(XS,YS):XP=XP+.25:GOSUB 2000:LINE-(XS,YS),13:XP=XP-.25
89 NEXT XP,YP,ZP
90 A$=INPUT$(1)
99 IF A$="A" THEN YV=YV-.01:IF YV<-1 THEN YV=1
100 IF A$="S" THEN XV=XV+.01:IF XV>1 THEN XV=-1
110 IF A$="D" THEN YV=YV+.01:IF YV>1 THEN YV=-1
120 IF A$="W" THEN XV=XV-.01:IF XV<-1 THEN XV=1
130 IF A$="Z" THEN ZV=ZV-.01:IF ZV<-1 THEN ZV=1
140 IF A$="X" THEN ZV=ZV+.01:IF ZV>1 THEN ZV=-1
150 IF A$="1" THEN DE=DE-.05:IF DE<=0 THEN DE=0
160 IF A$="2" THEN DE=DE+.05:IF DE>10 THEN DE=10
170 GOTO 30
1000 SA = SIN(XV*PI): CA = COS(XV*PI)
1010 SB = SIN(YV*PI): CB = COS(YV*PI)
1020 SG = SIN(ZV*PI): CG = COS(ZV*PI)
1030 X = CA : Y = - SA           
1040 XX = X * CB : Z2 = - X * SB
1050 XY = Y * CG + Z2 * SG : XZ = Z2 * CG - Y * SG
1060 X = SA : Y = CA           
1070 YX = X * CB : Z2 = - X * SB
1080 YY = Y * CG + Z2 * SG : YZ = Z2 * CG - Y * SG
1090 ZX = SB : ZY = CB * SG : ZZ = CB * CG
1100 RETURN
2000 ZS= (XP*XZ + YP*YZ + ZP*ZZ)
2001 ZS=ZS+ABS(1-COS(ABS(ZS/1.7)*PI/4))*2
2010 XS= (XP*XX + YP*YX + ZP*ZX) * (ZS+ZC-DE/4) * AX + XC
2020 YS= (XP*XY + YP*YY + ZP*ZY) * (ZS+ZC-DE/4) * AY + YC
2030 RETURN




 
Ir a la página ( Página anterior 1 | 2 | 3 | 4 | 5 )
 







(c) 1994 - 2009 Fundación MSX Resource Center. MSX es una marca registrada de MSX Licensing Corporation