Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - frea

Pages: [1] 2 3 4
1
taj did you mean that ati doesn't support arrays or that syntax? the syntax works for me.

anyway, no loops, no arrays = long code, which is also forbidden! That's cool i have super-fast hardware, but i can't use it at all :/.
Mabye i overestimated shaders, but 'everyone' says they are great and something super new, fast etc. and yet i can only do _very_ simple stuff with it.

I at least hope CUDA is better.

2
previously i thought of glsl as beeing powerful, but damn! i can't do array indexing nor looping. A simple for makes it run in software mode.
At least i hope i can write long programs. i'll need to unroll all loops ;D.

3
You were right, it was running in software.
I need bigger arrays that 4, more that 16 also :).
Seems i will have to emulate arrays somehow, or rethink the algorithms.

Thanks.

4
Hi.
is it normal that this is slow ( ~0.5-1fps )? :
Code: [Select]
float a[ 3 ];
a[ 0 ] = 0;
a[ 1 ] = 0;
a[ 2 ] = 0;
int b = 0;
if( a[ b ] == 0 ) gl_FragColor = vec4( 1, 1, 1, 1 );
If i replace the if by
Code: [Select]
if( a[ 0 ] == 0 ) (....)
I get normal fps again.


I understand that the compiler can be unable to convert first if to the second, but why i get ~100x framedrop ?

5
Freebasic / Re: convert frame buffer to ascii
« on: February 29, 2008 »
it crashed when i tried to quit.
I could hardly see the sunset, but i am an ignorant in terms of ascii art :).

6
It seems that the compiler at labs is somewhat broken :p. I comment ~30 function calls and get 20bytes less uncompressed, although it ereases ~100 lines of asm.

7
#define PRIMITIVENUM 2
:)
changing to 10000 makes no size difference. ( all arrays are in .bss section )

edit: mistake, it causes diffrence.
But that what is surpricing that the difference is between PRIMITIVEMNUM beeing 2 and 3. What the hell? ( even if no code uses the array! )

edit2: it is even more werid. For purpouses of finding why i have such problem i have commented out the rest of the function. I tried compiling with -Os, and the size dropped greatly, now there is no jump on primnum 2 to 3. That what is interesting that by uncommenting the rest of function i get ~1.5kb again but, with -O2 i don't get 2x 1.5 kb but only 1x1.5kb. The uncommented part gives sixty-something byte diffrence in file size if used with -O2.

So the file size doesn't differ to much with -O2/-Os, but it has a werid growth when (un)commenting :).


edit3: don't ask me :). I've switched computers and now no werid behaviour. At home everything's ok :).

8
C / C++ /C# / structs in c causing big size diffrences.
« on: February 26, 2008 »
Hi!
I can't understand one thing. I've been writing a small program, and at one point i needed to use a struct more. Merely by adding it, and doing a single instruction using it the size jumped by 1.5kb uncompressed. I disassembled 2 versions, one with this single instruction one without. the asm code differed very slightly. ( ~12 lines in ~2k lines were different )

So, if the code doesn't differ, why am i getting such a huge change?

Code: [Select]
typedef struct Primitive_
{
  unsigned int type;
  float pos[ 3 ], col[ 3 ];
  float rotx, roty;
  union
  {
     float sphere;
     float cube[ 3 ];
  };
} Primitive;

Code: [Select]
Primitive prim[ PRIMITIVENUM ];
(...)
sub( vector1, prim[ id ].pos, vector2 ); //this line adds 1.5kb, sub is also called previously on different vectors
Stripping the contents of Primitive doesn't reduce size.

9
shooting through a sphere is even worse. for high fov's the middle one is streched on the whole height of screen.
for now the only solution i found is to rotate the rays from the code sample i gave.

10
i normalized them, the same effect.
later i even tried something like

d[ 0 ] = ((float)i)/512.0f;
d[ 1 ] = ((float)j)/512.0f;
d[ 2 ] = 1;
normalize( d );

this chooses evenly from a plane, and this gives incorrect results. i,j were from -256 to 256.

if d[ 2 ] = sqrt( 1 - d[ 0 ] * d[ 0 ] - d[ 1 ] * d[ 1 ] )
everything was correct.

taj, i have for now exams, i'll try in weekend :).

11
using angles is exacly that what i meant :). although it took me some time to discover this.

rain_storm - i hope you are wrong, but i guess i need to code it and see the results :).

12
:). So in order to avoid the disortion for high fov's i should generate the rays in an another way? Not as lines going through eye->pixel but as lines going through eye->sphere, where the sphere and screen have 4 common points? I don't know how else i could define this sphere, sorry ;). I'll try to make a draing of that in paint but, i don't know how it will look like :).


http://img210.imageshack.us/my.php?image=beztytuu4do3.jpg
previously i choosed rays so, they would be equaly spaced on the screen quad.
the solution would be to choose rays so that they would be equaly spaced on the screen 'mapped' along the lines eye->sphere on the sphere. I dunno whether that image helps :P.

13
You are right, i forgot to mention that L is on the screen.

i printed my vectors from the test scene:
0 1 -0 UP
-1 0 0 RIGHT
0 0 1 L
orthonormal.

I just discovered that my fov was equal to PI ;). if fov is around PI/6, i get only 1 pixel off for furthest spheres, which is acceptable, but i still think that something is wrong, with my code, or my understanding of things :).



edit: ok i am sure, that i make some kind of stupid understanding mistake. I'll try to find out what exactly, but unfortunatly later ( exams ~~ ).


edit2: couldn't stop thinking :). That what i did was to traverse the world using a moving plane ( d[ 2 ] was the same for all rays ), while i should've traversed with a sphere with increasing radius and fixed origin.

14
could it be that, for big fov's this disortion appears?

15
if UP and RIGHT were normalized then the screen size would be always 2x2.
Why normalize L? That would just move the place where the screen is.

Although i could normalize them, and choose a,b according to FOV'S, but is there any diffrence?

16
hi!
I've got some werid trouble with creating rays.

Let E be the eye position, L the look at position. From that and the FOV angles i create two vectors UP and RIGHT, in such way that the viewing screen is defined by
V = L + a*UP + b * RIGHT, |a|,|b| <= 1.

( UP + E and RIGHT + E span the plane in which the screen lies )
Now the ray position is E, and ray direction is V - E.

I try to raytrace few spheres, which lie on the OX axis, with eye position 0,0,-2 and lookat 0,0,0
and fov's enough big to see them all.
that what i do not understand is, why the further from 0,0,0 the more the spheres are deformed.
This looks like i would be doing a fish-eye like efect.

Image:
http://img163.imageshack.us/my.php?image=testhi4.png

i am sure, that the Up and RIGHT vectors are correct, and the ray-sphere intersection code was written using two different algos, both giving the same result.

i think i am making some kind of fundamental mistake, but when i looked and other people's code it was moreless the same.

17
General chat / Re: Blended Games
« on: January 23, 2008 »
Saper connected with unreal tournament.
now the mines move away from your mouse!

18
i have not read it, but would the memory be also faster?
I mean, cool that i can compute something in lightspeed, but i need to know what to compute beforehand :).

19
i dunno but except the basics i thought the best way was, to have a simple idea and implement it. or find a simple idea somewhere, and implement it :), it probably has a tutorial/paper on google.

red book/superbible gave me the wrong impression that i know something about opengl after reading them ;).

20

The ascii effects are pure ascii and not some frame buffer > ascii conversion and I really believe that in the future I will code in this way too.. I love ascii demos and I'd really like to make one.
if you didn't know this probably could be used for this :).
http://aa-project.sourceforge.net/aalib/
i wouldn't be surpriced if they did use that.

Pages: [1] 2 3 4