Math Is Fun Forum
  Discussion about math, puzzles, games and fun.   Useful symbols: √ ∞ ≠ ≤ ≥ ≈ ⇒ ∈ Δ θ ∴ ∑ ∫ π -




Not registered yet?

  • Index
  •  » Help Me !
  •  » Real tough one. Is real-time perfect sub pixel accuracy possible?

Post a reply

Go back

Write your message and submit
:) :| :( :D :o ;) :/ :P :lol: :mad: :rolleyes: :cool: | :dizzy :eek :kiss :roflol :rolleyes :shame :down :up :touched :sleep :wave :swear :tongue :what :faint :dunno

Go back

Topic review (newest first)

2005-09-25 06:05:03

Hello again Ryos big_smile. No, no. You got it wrong.

The half pixel has almost nothing to do with the question at hand. I never said the arbitrary triangle is 45-45-90. How could an arbitrary triangle be a right-angle triangle?

The average colour of the arbitrary triangle, averaged again with a sister triangle that shares 2 tips with this one - for the other pixel half- , is the colour that the current screen pixel will have. There's no other link.

I am talking about perspective projection here. The average colours of the 2 sister triangles, averaged again between themselves, will determine the final colour of the current screen pixel to which they are projected on screen. In fact they lie somewhere on a polygon in 3D space. Thus they most certainly have no edges either perpendicular or parallel (between the 2 the triangles, I mean).

You can experiment this by simply sticking a square paper cutout CENTRED on a flashlight and pointing it at a wall at different angles, NOT JUST PERPENDICULARLY. Now try shutting the lights and turning the flashlight on big_smile.

The square cutout is the screen pixel. The lantirn is the eye and the wall is a polygon being seen by the eye. The (NOT SO square) quad. shadow on the wall is the 2 arbitrary sister triangles I'm talking about. Get it?

2005-09-25 02:01:11

And this triangle is only half a screen pixel...

Oh! Why didn't you say so? If you know that your triangle is exactly half of a screen pixel, then you're talking about a very specific thing: a 45-45-90 triangle.

Two of these make a square. Now, let me ask a stupid question. Why are you even bothering with triangles, when squares are so much easier to work with given a square texture tile?

2005-09-25 01:57:53

hello again
wat happened about that hacker
i no her she said she only wanted to talk to me on the website but failed because she didnt have an email address

2005-09-25 00:11:51

10X Ryos.
Thought of this. But you can see how being able to somehow reduce the triangle to a single texture tile with no disturbance of the cromatic average is so much better.

Perfect actually. Especially considering how the triangle may be however large or far away from the centre of the plane's system. For an especially large one I might (the computer) have to work for minutes/hours.

And this triangle is only half a screen pixel projected on some polygon (the plane).

Can you imagine going through that immensly slow process for 2*1024*768*(at least)25 times a second?

Cheers, Vishy.

2005-09-24 15:10:15

Here's a simple suggestion that should help a little. I bet it could be developed further.

Precompute and store the average color of the entire array. Then, if you can figure out how many arrays are completely enclosed by the triangle, you've greatly reduced the amount of calculations you have to do.

2005-09-24 11:38:20

There is a square array of N by N (N is finite) squares (the squares themselves are 1 by 1 ).
Each square has a positive integer (let's call it colour) assigned .
This array is tiled to infinity in any direction upon some arbitrary plane.
The edges of the arrays are aligned.

An arbitrary triangle is drawn upon this plane. It may be however large or small, near to or far from the origin of the plane's system. I need to calculate the average colour of the triangle. This means that for each and every single square that comes under the arbitrary triangle, even partially, I will add to a sum (initially 0) the square's_colour_value/area_of_the_square_that_is_inside_the_triangle. After having done this for every single square that falls inside the triangle (even partially) I will have the average colour of the triangle; which leads me to my problem. Given the fact that the triangle may be however large, applying this complex method to any possible arbitrary triangle is not wise.

Is there any way in hell to scale down the triangle to within one of the finite tiles (the square arrays, first one for example) in such a way that I can be certain the cromatic average is not at all altered, in order to make it easier to calculate its cromatic average? Or would some other method work, other than scaling (it just popped into mind)? Please enlighten. 10x

Cheers, Vishy.

Board footer

Powered by FluxBB