Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Challenge: 4,5 days for a 400x300 picture !
#71
Lunch time and Jark has not posted yet...
It seems he used my post to fight insomnia and it was so boring that he's still sleeping Big Grin
Does someone have his home phone to give him a call and awake him ? :rotfl:
Antoni
Reply
#72
I was out for a commercial meeting Cry so I did not prog today...

I think the arrays you mentioned could be an external file, with a structure like a bitmap. Then there is just the pixels smart scan algorithm to build.

I have a steering committee tomorow, but Friday should be calm...
hink Global, Make Symp' All ! ®
[Image: Banner.gif]
Reply
#73
Let me elaborate. I'm too concise sometimes, one of my faults, :oops:

The idea is to avoid probing ALL sponge cubes for ALL pixels and get rid of that scary block of 4 for loops nested you have.

The interpolation principle is easy, because the cubes are convex. If two points are in the same cube, the points in the line defined are also in that cube so you check them as tested. If not you choose a middle point and test it against all cubes. I hope this way the number of pixels tested against all cubes will be much smaller.
As aplying interpolation to the whole image at the same time would need a huge array, we need to use a softer approach.

My suggestion is to aply interpolation to smaller blocks of image. do do it you could use just a pair of 16x16 (maybe 32x32 or 64 x 64?) integer arrays corresponding to a block of 16 x 16 pixels in the screen, and save in one array the cube numbers and in the other one the face number for each pixel.

Once the array is filled with the help of interpolation the pixel colors are calculated for (you will probe directly the right cube for each pixel) and saved to the BMP.

Then the calculation moves to the nearby square of 16 x16 pixels, to do it the two arrays are just erased and the interpolation starts again. So you would need no more than 2 arrays that fit easily in memory.

You could integrate shadows in the interpolation. As holes are convex, if two pixels see the light source, all intermediate points in the same line see also the light source. An extra array of 16 x 16 bits is needed to support shadows.

I imagine you can think a way of integrating reflections in this scheme...

To speed up a little the interpolation you could advance 15 pixels for each next block. This way a column of the previous block would remain in the arrays, to serve as a seed.
Antoni
Reply
#74
This explanation is easier to understand :wink:

I save this new post!

Remember my proposal for the Moebius strip: well, it just does not work. But I have another idea!
hink Global, Make Symp' All ! ®
[Image: Banner.gif]
Reply
#75
The mistake was to probe cubes, thus leading to 960000 polygons for the 4th rank.

The right method, I hope, is to probe a shape composed of, if we take the example of rank 1:

1) One side of the main cube (let's call it "A"), i.e. 8 possible sub-squares, the 9th corresponding to the hole in the middle
2) The 20 inside squares that can be visibe inside the "tunnels" if the ray crosses the reference square in the hole.

Then the probing will tell which sub-square, let's call it "B", is hit by the ray. The process is iterated with this new square, which has n its turn 28 sub-squares.

So, instead of probing 960000 squares per pixel, the program will probe only 6 main cube sides (to init the recursive loop)+ 4*28 sub-sides (4th rank example) = 118 cubes !

Consequences:
1) The prog will be much faster, at least by 6000 or 7000 times
2) I can re-include the reflection and shadow raycasting
3) I can increase the size of the pic
4) I can set a much larger maximum rank

So I should, when it's done, be able to have a better pic than Paul Bourke's, which is a black&white picture without texture: and this future picture will be done with QB :bounce:
hink Global, Make Symp' All ! ®
[Image: Banner.gif]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)