Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Accuracy in 3d-rotation routines?
2008-02-29 12:38
Shadow
Account closed

Registered: Apr 2002
Posts: 355
Accuracy in 3d-rotation routines?

How accurate do you run your 3d-rotation routines?
I just started doing a mockup (in a high-level language) for a 3D-rotation routine, but found out that running 8-bit accuracy (8 bit coords and sin/cos tables, 8 bit mulitiplies w. 16 bit result) really looked quite crappy, vertexes flail about rather much. Do people generally run full 16-bit all the way through?
2008-02-29 12:43
Shadow
Account closed

Registered: Apr 2002
Posts: 355
Ahh... Just noticed that the part that was killing my accuracy was the perspective transformation. Probably running that in higher accuracy will be enough, and then leave the rotation at 8 bit.
2008-02-29 13:10
Cruzer

Registered: Dec 2001
Posts: 1048
Precalculate FTW. Protip: Coords can be packed to fill a lot less.
2008-02-29 13:29
Shadow
Account closed

Registered: Apr 2002
Posts: 355
Yeah, precalc is what I have done so far, since it is both faster and you can have full accuracy. But it still feels a bit like cheating! On the other hand, isn't cheating what democoding is all about... :D
2008-02-29 14:03
JackAsser

Registered: Jun 2002
Posts: 2014
Quote: Yeah, precalc is what I have done so far, since it is both faster and you can have full accuracy. But it still feels a bit like cheating! On the other hand, isn't cheating what democoding is all about... :D

I normally use 8 bits for vertices and rotation then 16 bit when doing the perspective. Graham uses full 16 bits in his latest vectors, that about the only way to get full sub-pixel accuracy in the line drawer.
2008-02-29 14:14
HCL

Registered: Feb 2003
Posts: 728
@JA: Hmm, what really is "full sub-pixel accuracy"!? ;) Calculating with 2 steps per pixel is still sub-pixel accuracy, right..

btw.. I usually calculate matrix rotation in 16 bit, then doing vertex calculation + perspective in only 8 bit :/.
2008-02-29 14:24
JackAsser

Registered: Jun 2002
Posts: 2014
Quote: @JA: Hmm, what really is "full sub-pixel accuracy"!? ;) Calculating with 2 steps per pixel is still sub-pixel accuracy, right..

btw.. I usually calculate matrix rotation in 16 bit, then doing vertex calculation + perspective in only 8 bit :/.


Hehe, good question. Well, with full pixel accuracy I guess I mean some fractional part in each pixel... ;) So that a line with int(dy)=-1 still can be one of the following:

1)
       *
*******

2)
      **
******

3)
     ***
*****

4)
    ****
****

5)
   *****
***

6)
  ******
**

7)
 *******
*


I guess full precision would be allowing the cut in the slop to appear anywhere on a line with dy=-1 and dx=full width. =)

I.e. for lines that are max 128 pixels wide you'd need 7.7 for full sub pixel accuracy.
2008-02-29 15:43
HCL

Registered: Feb 2003
Posts: 728
@JA, nice visual explanation :), that's how i imagine it also.. But i like to think more on pixel level: How many steps (==sub-pixels) (x and y) are there in one pixel? Let's say you have full 8 bit sub-pixel accuracy, then you should calculate your lines with 256x256 sub-pixels in each pixel.

Man, did you quit work already? Or are you discussing sub-pixels on project time?! Gotta be going home now, CU :).
2008-02-29 15:52
JackAsser

Registered: Jun 2002
Posts: 2014
Quote: @JA, nice visual explanation :), that's how i imagine it also.. But i like to think more on pixel level: How many steps (==sub-pixels) (x and y) are there in one pixel? Let's say you have full 8 bit sub-pixel accuracy, then you should calculate your lines with 256x256 sub-pixels in each pixel.

Man, did you quit work already? Or are you discussing sub-pixels on project time?! Gotta be going home now, CU :).


@HCL: Yes of course, that's how I see it as well. I was just trying to explain what I meant by FULL sub pixel precision. For lines that are at most 128 pixels wide, 7 bits of fractional digits are enough, 8 bit sub pixel precision is just superfluous in that case.

Anyways, OMG! Beer time!
2008-02-29 16:30
pernod
Account closed

Registered: Nov 2004
Posts: 25
Quote: @HCL: Yes of course, that's how I see it as well. I was just trying to explain what I meant by FULL sub pixel precision. For lines that are at most 128 pixels wide, 7 bits of fractional digits are enough, 8 bit sub pixel precision is just superfluous in that case.

Anyways, OMG! Beer time!


Yes, beertime in mine and Puterman's office! :-)
2008-02-29 19:11
Graham
Account closed

Registered: Dec 2002
Posts: 990
Quoting HCL

btw.. I usually calculate matrix rotation in 16 bit, then doing vertex calculation + perspective in only 8 bit :/.

My matrix is 24 bit and my vertices + perspective are 16 bit :P
 
... 3 posts hidden. Click here to view all posts....
 
Previous - 1 | 2 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
t0m3000/hf^boom!^ibx
Rub_0201
stephan-a
fuzzybad
Guests online: 118
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 X-Mas Demo 2024  (9.5)
7 Dawnfall V1.1  (9.5)
8 Rainbow Connection  (9.5)
9 Onscreen 5k  (9.5)
10 Morph  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Triad  (9.3)
Top Organizers
1 Burglar  (9.9)
2 Sixx  (9.8)
3 hedning  (9.7)
4 Irata  (9.7)
5 Tim  (9.7)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.039 sec.