log in | register | forums
Show:
Go:
Forums
Username:

Password:

User accounts
Register new account
Forgot password
Forum stats
List of members
Search the forums

Advanced search
Recent discussions
- Elsear brings super-fast Networking to Risc PC/A7000/A7000+ (News:)
- Latest hardware upgrade from RISCOSbits (News:)
- RISCOSbits releases a new laptop solution (News:4)
- Announcing the TIB 2024 Advent Calendar (News:2)
- RISC OS London Show Report 2024 (News:1)
- Code GCC produces that makes you cry #12684 (Prog:39)
- Rougol November 2024 meeting on monday (News:)
- Drag'n'Drop 14i1 edition reviewed (News:)
- WROCC November 2024 talk o...ay - Andrew Rawnsley (ROD) (News:2)
- October 2024 News Summary (News:3)
Latest postings RSS Feeds
RSS 2.0 | 1.0 | 0.9
Atom 0.3
Misc RDF | CDF
 
View on Mastodon
@www.iconbar.com@rss-parrot.net
Site Search
 
Article archives
The Icon Bar: Games: 3D code bits
 
  3D code bits
  Phlamethrower (16:33 9/1/2001)
  andreww (18:54 9/1/2001)
    Wrath (07:19 10/1/2001)
      johnstlr (10:20 10/1/2001)
        Wrath (10:38 10/1/2001)
          ToiletDuck (13:50 10/1/2001)
            andreww (18:49 10/1/2001)
              Wrath (07:29 11/1/2001)
                Phlamethrower (11:03 15/1/2001)
                  johnstlr (12:48 15/1/2001)
                    not_ginger_matt (18:15 19/1/2001)
                      johnstlr (19:11 19/1/2001)
 
Jeffrey Lee Message #85310, posted by Phlamethrower at 16:33, 9/1/2001
PhlamethrowerHot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff

Posts: 15100
While the jury is still out on what this 3D engine thing is going to be, we might as well start working on stuff related to it.

All I'm after here are bits of code to do things like 64 bit (Or even 96 bit) math, theories behind collision checking, VISing, etc. and links to places that won't mind us ripping their code smile

C or assembler is welcome, but try and have implementations of the same thing under both languages so we can use whichever is appropriate.

Hmm... I'll start off with what I can remember of a 3D transformation matrix (Worked out by myself, if I remember correctly):

It's a 3x3 matrix, each row being an output co-ordinate and the columns being the input ones:

a b c
d e f
g h i

Working out the output would be a case of:

x=ax+by+cz
y=dx+ey+fz
z=gx+hy+iz

So by changing the different values you can effect how much of the original x,y and z co-ordinates make it into the output.
Deciding on the values though is the tricky part. For a matrix which does nothing, a=e=i=1. To then make it do something, you would split it down into a 2D transformation matrix, and apply a rotation to the variables required much like Draw does.

If you were to rotate around the Z axis then only the X and Y values would be changing, so a,b,d and e would be put through the 2D matrix. I *think* that the way they that this would be organised is that two co-ordinates, (a,b) and (d,e) would be put through the 2D matrix. I can't remember off hand how to work out the values needed in the 2D matrix though unhappy

  ^[ Log in to reply ]
 
Andrew Message #85311, posted by andreww at 18:54, 9/1/2001, in reply to message #85310
AA refugee
Posts: 555
Well that's some of the theory. Matrix multiplication is not explained fully in a mathematical sense in the BBC BASIC guide so one would have to look in a maths book.
Perhaps more importantly, do you know how to implement this in assembler. I haven't really tried further than plotting the polygons but you'd need lookup tables as transformations involve trigonometric functions.
This is assuming you have already implemented clipping and vertex sorting of the polygons.
You'll probably alos need some kind of 3d editor from which you can extract the relative vertex coordinates to then transform and plot them as polygons.
I hope Lee doesn't mind me sayong that I think he started to use the Euclid editor for this (Im think).
The TopModel file format may be a possiblity if you can extract what you need from it.
  ^[ Log in to reply ]
 
Nathan Message #85312, posted by Wrath at 07:19, 10/1/2001, in reply to message #85311
Member
Posts: 155
The TopModel file format may be a possiblity if you can extract what you need from it.

pT has cracked this one for his CAD editor although he managed to import the wrong filetype (the filetype that is only read by TMViewer!). I also have the Topmodel file format from Sincronia.

  ^[ Log in to reply ]
 
Lee Johnston Message #85313, posted by johnstlr at 10:20, 10/1/2001, in reply to message #85312
Member
Posts: 193
The TopModel formats are well documented in the documentation that comes with TopModel itself. I don't know what the deal is with distributing these though. I believe they used to be on the Sincronia website but that seems to have disappeared.

In reply to Andrew I didn't use Euclid. I initially used the Flight Sim Toolkit and I started on a parser for the TopModel text file format but never finished it - partially because given the cost of TopModel at the time I thought it unlikely that lots of people would have it.

In reply to Jeff - 64bit math should be more than sufficient for our needs. It's easy enough on a StrongARM but I'm not sure how to achieve it on other machines. Bear in mind that we need signed 64bit math - the ARM Assembler manuals have unsigned 64bit multiplication as an example.

I have some other resources that might prove useful. I'll put them up on the web later on when I've had a chance to get them together.

  ^[ Log in to reply ]
 
Nathan Message #85314, posted by Wrath at 10:38, 10/1/2001, in reply to message #85313
Member
Posts: 155
Quite a few people have TopModel and Sincronia/Chris Hornby were extremely helpful in giving us 2 copies of TopModel for EMD.

If this filetype was supported and maybe StudioMax from the PC then this should be fine.

  ^[ Log in to reply ]
 
Mark Quint Message #85315, posted by ToiletDuck at 13:50, 10/1/2001, in reply to message #85314
Ooh ducky!Quack Quack
Posts: 1016
One filetype which would be very useful for PC users would be the .MAP or .RMF format, which is generally used on 3D applications like Worldcraft and BSP for games like quake & Half-Life.
It would be easier 4 me too, Cos i dont have Topmodel unhappy and I cannot stand using Truespace 3D - although Worldcraft is a nice program grin
  ^[ Log in to reply ]
 
Andrew Message #85316, posted by andreww at 18:49, 10/1/2001, in reply to message #85315
AA refugee
Posts: 555
The TopModel file format may be a possiblity if you can extract what you need from it.

pT has cracked this one for his CAD editor although he managed to import the wrong filetype (the filetype that is only read by TMViewer!). I also have the Topmodel file format from Sincronia.

Where can we get this from Nathan?

  ^[ Log in to reply ]
 
Nathan Message #85317, posted by Wrath at 07:29, 11/1/2001, in reply to message #85316
Member
Posts: 155
pT has cracked this one for his CAD editor although he managed to import the wrong filetype (the filetype that is only read by TMViewer!). I also have the Topmodel file format from Sincronia.

Where can we get this from Nathan?

I will send it to you, it's not for public release.

  ^[ Log in to reply ]
 
Jeffrey Lee Message #85318, posted by Phlamethrower at 11:03, 15/1/2001, in reply to message #85317
PhlamethrowerHot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff

Posts: 15100
Here's a little competition for all you budding coders out there: Fast math routines.

Specifically I'm interested in 32bit and 64bit math code, which should be able to run on ARM6's and above.

Try and make some code for plain old integers, fixed point numbers (Perhaps with the point location set by some compiler variable), floating point (Either for you own format or some FPEmulator replacement), and maybe even fractions.

Just stick the source code up here, since it's unlikely to be too big.

Do well and you'll get your name on the creds for the 3D engine!

  ^[ Log in to reply ]
 
Lee Johnston Message #85319, posted by johnstlr at 12:48, 15/1/2001, in reply to message #85318
Member
Posts: 193
Specifically I'm interested in 32bit and 64bit math code, which should be able to run on ARM6's and above.

Even better provide routines that work on ARM6 and above also routines that are SA specific - we need both cool

Just stick the source code up here, since it's unlikely to be too big.

If it is big I'll host it from that temporary page I posted earlier while something better is sorted out. For people who have forgotten the URL is

http://www.comp.lancs.ac.uk/computing/users/johnstlr/riscos/threed.html

  ^[ Log in to reply ]
 
Richard Wilson Message #85320, posted by not_ginger_matt at 18:15, 19/1/2001, in reply to message #85319
Member
Posts: 63
Unfortunately, an ARM6 is unlikely to be able to handle 3d engines at all well - the StrongARM CPU not only has a higher clock speed, but it also has access to SMULL and suchlike which makes high precision integer math (as would be needed) a lot faster than the corresponding ARM6 code.
The RiscStation with its FPU would be another machine/processor to target as future (faster) RISCOS ARMs may well also have hardware FP.
  ^[ Log in to reply ]
 
Lee Johnston Message #85321, posted by johnstlr at 19:11, 19/1/2001, in reply to message #85320
Member
Posts: 193
I agree Rich. The only reason I included ARM6 compatability was simply because not everyone here has a SA machine (I'm stuck with an A4000 - I'm still waiting for someone to bring out a machine worth the cash). I certainly wouldn't intend any engine to be used for games on less than a SA or machine with FPU but if the math routines are the only reason people couldn't participate in development why not include them?
  ^[ Log in to reply ]
 

The Icon Bar: Games: 3D code bits