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 51 invitados y 1 miembro 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 Siguiente página )
Autor

Looking for developers

wolf_

msx legend
Mensajes: 4827
Publicado: Enero 11 2005, 16:56   
A complete formula was once published on an issue of ROM ..

some 3d->2d stuff I use in Blitz+ is:

Function Calc3d(xx#,yy#,zz#,alpha#,beta#,gamma#,depth,k)
	Sa# = Sin(alpha#): Ca# = Cos(alpha#)
	Sb# = Sin(beta#): Cb# = Cos(beta#)
	Sg# = Sin(gamma#): Cg# = Cos(gamma#)
	x# = xx# * Ca# + yy# * Sa#: y# = yy# * Ca# - xx# * Sa#: z# = zz#
	x2# = x * Cb# + z# * Sb#: y2# = y#: z2# = z# * Cb# - x# * Sb#
	x3# = x2#: y3# = y# * Cg# + z2# * Sg#: z3# = z2# * Cg# - y2# * Sg#
	z3#= z3# + depth: Calc3dX = ((x3# / z3#) * k): Calc3dY = ((y3# / z3#) * k)
	Calc3dZ=z3#
End Function


Due to the lack of reference vars in Blitz, Calc3dX,Calc3dY,Calc3dZ are globals here

And Blitz' sin and cos don't work from 0..2pi, but from 0..359

MicroTech
msx lover
Mensajes: 123
Publicado: Enero 11 2005, 17:03   
Well, you are writing too fast for me
I'm at work and I'm not always able to answer in "real time",
I could answer after a few minutes of after a day depending on how busy I am.
I'm going to answer, I need a little of time

flyguille
msx master
Mensajes: 1237
Publicado: Enero 11 2005, 17:14   
Quote:

A complete formula was once published on an issue of ROM ..

some 3d->2d stuff I use in Blitz+ is:

Function Calc3d(xx#,yy#,zz#,alpha#,beta#,gamma#,depth,k)
	Sa# = Sin(alpha#): Ca# = Cos(alpha#)
	Sb# = Sin(beta#): Cb# = Cos(beta#)
	Sg# = Sin(gamma#): Cg# = Cos(gamma#)
	x# = xx# * Ca# + yy# * Sa#: y# = yy# * Ca# - xx# * Sa#: z# = zz#
	x2# = x * Cb# + z# * Sb#: y2# = y#: z2# = z# * Cb# - x# * Sb#
	x3# = x2#: y3# = y# * Cg# + z2# * Sg#: z3# = z2# * Cg# - y2# * Sg#
	z3#= z3# + depth: Calc3dX = ((x3# / z3#) * k): Calc3dY = ((y3# / z3#) * k)
	Calc3dZ=z3#
End Function


Due to the lack of reference vars in Blitz, Calc3dX,Calc3dY,Calc3dZ are globals here

And Blitz' sin and cos don't work from 0..2pi, but from 0..359



all that for each point? can you to explain a bit, and to list its properties?
wolf_

msx legend
Mensajes: 4827
Publicado: Enero 11 2005, 17:18   
that's for each point .. there's not much to explain .. this is what it is ..

xx#, yy#, zz# = point
alpha#, beta#, gamma# = rotations (x y and z)
depth is the offset to prevent a division by zero (see previous page)
k is the zoom

naturally you can put all the sin/cos alpha/beta/gamma stuff in a table to save cpu speed..
flyguille
msx master
Mensajes: 1237
Publicado: Enero 11 2005, 17:19   
Quote:

on other way, which is the generic 3d to 2d plus Z coordinates formula?

when i does the one that i do, i use only multiplications and AND / OR plus some SIN() nothing more.

but i not get the perfection that i was finding in that time, so, i drop the proyect.

i remember i dividel the formula in two stages. ONE executed one time per frame or each time that the point of view changes. This one calculates 9 raw values, for the usage of the second a little formula.



the other is executed for each point to draw. And is too simply like

// EDITED : i forgot the ZS effect in XS & YS //

ZS= (XP*XZ + YP*YZ + ZP*ZZ)
XS= (XP*XX + YP*YX + ZP*ZX) * ZO * (ZS+ZC) + XC
YS= (XP*XY + YP*YY + ZP*ZY) * ZO * (ZS+ZC) + YC

where ZC is a calibration factor for to do FX



where XC, YC is the offset to aims to the center of the screen while XP,YP,ZP = 0.

XP , YP , ZP is the 3D coordinates of the point to draw.

ZO = zoom (its value is the half of the size of the window use for the drawing), negative value just flips the draw.

XS,YS is the screen coordinate for the point
ZS is the Z position on the screen to use this value for masking purposes.


XX, XY, XZ, YX, YY, YZ, ZX, ZY, ZZ are raw values precalculates. Its means, means

By example:

"XY" = In which amount (or level) the (X position 3D) will affects the Y position on the screen.

where the first leter is the 3D position, and the second leter is the effect on the screen.

Those raw values are precalculated one time per frame or each time that the point of view changes. Zoon or offset screen changes will NOT needs to precalculating again.

And the heavy where SIN() and a lot of * and logical part are, are in the first formula.







flyguille
msx master
Mensajes: 1237
Publicado: Enero 11 2005, 17:22   
Quote:

that's for each point .. there's not much to explain .. this is what it is ..

xx#, yy#, zz# = point
alpha#, beta#, gamma# = rotations (x y and z)
depth is the offset to prevent a division by zero (see previous page)
k is the zoom

naturally you can put all the sin/cos alpha/beta/gamma stuff in a table to save cpu speed..



yeah, it tought in to make a table, but is too big... and the time that you save is not too much, if you divided the formula in two stages.

and which are the output variables? x# y# ?
flyguille
msx master
Mensajes: 1237
Publicado: Enero 11 2005, 17:27   
interresting formulla, it is same that it start inserting the xx# yy# zz# from the begginig, let me to flip this formula..... to make it a HALF short.

mmmm.
flyguille
msx master
Mensajes: 1237
Publicado: Enero 11 2005, 17:41   
mmm. no , cant be short because it mix in proportionals parts the values of xx# yy# zz# from the beggining of the formula and mix all then...

my idea was just set yy,zz,xx in 0 or 1 at beggining, and to get the raw values... to use then a short stage for each point to draw. like my way to see the problem.


anyway the short part for each point in my formula uses 13 multiplications
when the published one needs 14 plus 2 divisions. (discounting the + & - operations that anyways don't impact in the assembler programming)

there is not too much to make short anyway, but is an improve in speed.
wolf_

msx legend
Mensajes: 4827
Publicado: Enero 11 2005, 17:41   
output x/y is Calc3dX and Calc3dY .. these are globals here since Blitz+ doesn't have reference variables like C++

flyguille
msx master
Mensajes: 1237
Publicado: Enero 11 2005, 19:10   
well, i was looking into my 1995 back up's CDs and i not found the GWbasic version of the 3D formula. But i found two printed sheet with MSXBASIC listing, but surelly isn't the last version because it has corrections written by hand on.

flyguille
msx master
Mensajes: 1237
Publicado: Enero 11 2005, 19:26   
well there is

Please, take in account that when i was designing it, i was looking for using BYTE or INTEGER ranges because it just was an early step before of the assembler translation.




if you watch carefuly, you will notice than atleast 1/3 of the code is just CASTING code for match values purposes, that in assembler it is all already there.

with just,

Ex:

L0=ABS(VY(4)+192)-128)/64-1

    ADD a,nn
    AND nn


In this code i use a VY(x) matrix for store all the properties of the engine, because it is a part of the code from an FILE player. Surely VY(4) is just our wellknown XP input variable or something. I uses a matrix because basicaly the part that read the file to render is just:

10 if eof(1) then exit
read a$:x=val(a$)
if x>128 then GOTO 1000: REM it is a command.
read a$:va=val(a$)
VY(x)=va
goto 10


there is some weird absolute values in the formula, well that was a try to fix or to compensate some distortion problem, in assembler, that value is translate in an integer value, because in the assembler bersion all will use 0-255 or -32768+32768 ranges.




GhostwriterP
msx addict
Mensajes: 320
Publicado: Enero 11 2005, 19:38   
Just use matrices guys !

Multiply a matrix with a vector and ... voila new vector.

Multiply matrices with eachother to create a new matrix that
converts a vector from a ship (object) based system to screen (2D)
directly, doing so skipping the main space system.

ehmmm... or something like that.

Anyway 3D takes a lot of calculations so that number 13 would
be more like 16 times multiplications plus 16 times adding per vector.
Ofcourse you can check for zero's and one's to reduce the number
of calculations to speed up the process.
flyguille
msx master
Mensajes: 1237
Publicado: Enero 11 2005, 19:48   
Quote:

Just use matrices guys !

Multiply a matrix with a vector and ... voila new vector.

Multiply matrices with eachother to create a new matrix that
converts a vector from a ship (object) based system to screen (2D)
directly, doing so skipping the main space system.

ehmmm... or something like that.

Anyway 3D takes a lot of calculations so that number 13 would
be more like 16 times multiplications plus 16 times adding per vector.
Ofcourse you can check for zero's and one's to reduce the number
of calculations to speed up the process.



well, 13 is already enought, why can be more?

if you do all the raw calculation job just one time per frame... so then you not needs more.
flyguille
msx master
Mensajes: 1237
Publicado: Enero 11 2005, 19:52   
on purpose, i run the assembler version a few times in MSX, the framerate wasn't satisfactory, BUT, in that time i was using too slow multiplication routines.... but anyway thinking in improve the MUL8/16 routine, maybe is posibble to get double speed... but anyway it is not enought for gamming...

maybe for a decent rendering tool for create 2d graphics based in 3d models.


GhostwriterP
msx addict
Mensajes: 320
Publicado: Enero 11 2005, 19:56   
Each point has to be translated and rotated i don't see
(yet?) how you can seperate those calculations.

Nothing is different from your (flyguile) 2nd entry. maby the fact
that i asume to use 4x4 matrices, do not no the real reasen for that
(but beeing convenient format), so i come to 16+12 (whow! my msitake)
calculations.

a 3x3 matrix results in 9+6 =15.

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







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