psycoding

Members
  • Content count

    15
  • Joined

  • Last visited

Community Reputation

100 Neutral

About psycoding

  • Rank
    Member
  1. I want to implement such portals as they were used in Prey, now my approach would be, for each space warping portal, create a copy of the cell (and its nodes/triangles) where the portal leads to and rotate it so that the portal in this cell angularly maches the portal in the "current" cell, then translate that cell to mach both parts of the portal (current cell + cell that the portal leads to);. if the player crosses the portal, the normal, not rotated geometry of the cell is used and instead, the camera is rotated. now, i think this would work but would be slow because i have to copy some cells, could you think of a faster algorithm for doing space warps ?
  2. HDR image processing library?

    isn't HDR just the same as using an exposure function ( (r8,g8,b8) = 255*(1-e^(-small_constant*(rX,gX,bX))) ) on an image with an higher range for each component r,g,b than 8bit, for example 24bit for each ?
  3. 3d accelleration without ogl / d3d

    Quote:and if it was possible, I'd also like to do this on my own. this refers to the framebuffer, and the window(s) stuff
  4. 3d accelleration without ogl / d3d

    I'm writing my own 3d engine, mainly for my radiosity project. And I want to write everything on my own, not using any other code than mine, except the framebuffer... and if it was possible, I'd also like to do this on my own. Now where I'm finished with mainly most optimizations, I have to see that using it in my radiosity project is just painful slow with just a very simple scene even though in triangle rendering my tmapper surprisingly beats ogl when many small triangles are used, and that's what radiosity is all about, many many small triangles.. Because of this I wanted to get HW access, because using ogl/d3d is no alternative for me... so something like it's mentioned above, gpu as general purpose processor is exactly what i searched for. I see it as an exercise and it's very interesting. I just hate using black boxed code, even if it's fast.
  5. If I use a filter, anisotropic or tri/bilinear, I only have the pixels of the current triangle to work with in my triangle mapper. If a pixel is near an edge, the filter kernel may go outside the triangle, how to get these pixels outside of the current triangle ? Artifacts do occur if they are not taken into account, so how to treat them ? how is it done in games ? may sound curious to some people, but I'm writing my renderer completely from low level..
  6. How can I access the GPU / VRAM directly without using open gl or direct 3d ? (best for me would be using it in assembler) thanks in advance
  7. fish eye effect

    change tghe vertex projection (3d to 2d) from (x,y) *1/z to (x,y) *1/(sqrt(x*x+y*y+z*z)); gives pretty good results.
  8. Hello, The last days, I tried to load a md2 model exported from cinema 4d xl in my engine, but in the upper half of the walls of the room, there was no texture. In the readme of the c4d to md2 exporter there was a remark that the texture should be loaded using the 16+32 texture clamping option. Now what does that mean, or.. what do I have to do in my renderer to get these missing textures visible ? Is it a option in cinema 4d xl (I didn't fin anything) or is it something I have to do with the texture coordinates of my md2 model ? I already tread them as tiles (u=u1 mod 1024, v=v1 mod 1024); thanks in advance Here is a picture of the problem : http://www.autories.de/images/Radiosity_60000Tri_AA_CB_VL.jpg on the left wall you can see the missing texture
  9. To make it short, how is in games like farcry a good performance achieved ? There have to be several aspects, and i don't know anything about it, so please just tell me how the algorithms are named if they were already discussed. but it would be nice, if i could get a short explanation for each. thanks in advance
  10. Now where I'm finished with my radiosity renderer, I wanted to write a photon tracer. I've been looking for a whole lot of time to find a fast ray triangle intersection code and ended up with the following. For some time it worked, but later I've encountered problems with it. I don't have a clue what the problem is, so I hope you could help me out of this. this is a picture of the result, I've drawn in the missing architecture of the room. http://home.arcor.de/irigyt/bild/failure.JPG first I thought that it may be a problem with my octree, but then I removed it and it still didn't look better, only slower. the strange thing is, when I get an intersection, half the time (during one rendering) the ray_lval that's returned does not have the right triangle based variables (photons LL, normal) and if i want to acces them outside of the code, it crashes. but now it's even worse, I can't remember to have changed anything in the intersection code, and now it even messes things up when there's no intersection. (the windows in the pic above) here's the code : class ray { public: vector *pos; vector *dir; ray() {pos = new vector();dir=new vector();} ~ray() {free(pos);free(dir);free(this);} }; class ray_lval { public: bool hit; float u,v; int r,g,b; float t; vertex *normal; LinkedList *photons; ray_lval() {r=0;g=0;b=0;} ~ray_lval() {free(this);}; }; ray_lval* ray_intersects_triangle(ray_lval *lval, ray *ray, triangle *t) { vector *E1, *E2, *H, *S, *Q; E1 = new vector(); E2 = new vector(); H = new vector(); S = new vector(); Q = new vector(); lval->r=0; lval->g=0; lval->b=0; lval->hit=false; E1->x = t->vp[1]->x - t->vp[0]->x; E1->y = t->vp[1]->y - t->vp[0]->y; E1->z = t->vp[1]->z - t->vp[0]->z; E2->x = t->vp[2]->x - t->vp[0]->x; E2->y = t->vp[2]->y - t->vp[0]->y; E2->z = t->vp[2]->z - t->vp[0]->z; cross(H,ray->dir,E2); float a = dot(E1,H); if (a > -0.00001 && a < 0.00001) return lval; float f = 1.0 / a; S->x = ray->pos->x - t->vp[0]->x; S->y = ray->pos->y - t->vp[0]->y; S->z = ray->pos->z - t->vp[0]->z; float u = f*dot(S,H); if (u < 0.0 || u > 1.0) return lval; cross(Q,S,E1); float v = f*dot(ray->dir,Q); if (v < 0.0 || (u + v) > 1.0) return lval; lval->t=dot(E2,Q)*f; lval->u=t->vp[0]->u+(t->vp[1]->u-t->vp[0]->u)*u+(t->vp[2]->u-t->vp[0]->u)*v; lval->v=t->vp[0]->v+(t->vp[1]->v-t->vp[0]->v)*u+(t->vp[2]->v-t->vp[0]->v *v; lval->r=(t->obj->texture[(int)u*3+(int)v*256*3]*t->light)>>8; lval->g=(t->obj->texture[(int)u*3+(int)v*256*3+1]*t->light)>>8; lval->b=(t->obj->texture[(int)u*3+(int)v*256*3+2]*t->light)>>8; lval->normal=t->normal; lval->photons = t->obj->photons; lval->hit=true; free(E1); free(E2); free(H); free(S); free(Q); return lval; } If the code is right, and someone wanted to look at the whole source, please tell me, I'd then upload it as soon as possible. but be warned, it's quite a mess ^^ and if someone's got a good tutorial btw of how to use an KD-Tree for fast photon gathering, I'd be very thankful if he'd postet it here.
  11. radiosity memory failure + artefacts

    It was no leak, it was a bug in DevCpp.. With the same code, it sometimes compiled to some shit that used up 3mb a sec, and sometimes it ran without an increasing memory load. the only thing that is not right with the program at the moment is that in the radiosity part, where the whole scene is rendered a thousands of times, memory load stays constant, if the radiosity part is finished and normal rendering (with the same method) continues, memory load increases about 100k a second, and there's _nothing_ in the code that could cause that. strange
  12. radiosity memory failure + artefacts

    The engine is based on a triangle (texture) mapper. It uses straight vector math. Every object (i only use pointers) is destroyed as early as possible. Radiosity is implemented the following way : every triangle requires rendering the whole scene with an 180° fov. the resulting image for each triangle is interpreted as light falling to it. you said that it could use much virtual disk mem although little ram is used. is there a way i could force the programm to uses ram only ? I don't know what else I could write about the program, so here's the source code : sorry, i post it later, the version that i have with me is too old. (i got no internet at home)
  13. Hello, I wrote a little radiosity renderer and now i'm facing following problems : with more than 10000 triangles the program crashes after some time (when half the computation is done) and windows reports that the virtual memory pagefile is overloaded and should be increased. BUT the taskmanager says that the memory load is constant at some value < 20mb.. the other problem is that i get artefacts when light shines through very little gaps between polygons. (they come from slightly different gradients of edges when an edge doesn't share exactly the same vertices. but sometimes light shines also through vertex sharing edges) I tried nearly everything about the texture mapper, but this didn't solve the problem. May subpixel accuracy solve this ? any other opinions about this ? (I use bright lightsources for point lightsources with values in the upper integer range, i use exposure function after rendering to compensate for that. the first problem is the most important one . thanks in advance
  14. I need to align my cam with a vector, and can't update the right and up vectors by rotating them. If I use the normal way of doing this right=cross(world_up,look) up=cross(look,right) It fails if the look vector is near to the worlds up vector. So I tried to use another axis if this was the case up=cross(look,world_right) right=cross(up,look) , but no matter what I do, it always jumps from one viewpoint to another if cam rotation uses x _and_ y axis _and_ if it uses the other axis for calculating up and right vectors. I have no clue why it doesn't work. please help me out of this situation. some lookat code with a short explanation would be nice.
  15. I'm writing a little radiosity renderer and want to adjust the camera's direction using a vector to align the cam with the triangle normals. as far as i know the right way would be using a view matrix (I always worked without matrices) -translate vertices -multiply them with the view matrix (only used as rotation matrix): it only works if i rotate the cam around the y-Axis. now i post some code where the error may lie : //crossproduct, perhaps with error, there are many different out there with only one beeing right, so i don't know if that's the right one vertex *cross(vertex *a, vertex *b) { vertex *c = new vertex(); c->x = a->y * b->z - a->z * b->y; c->y = a->z * b->x - a->x * b->z; c->z = a->x * b->y - a->y * b->x; return c; } //calculate right and up vector right=cross(look,yaxis); up=cross(right,look); //translation, vertex / view matrix multiplication v->x= v->x + object->x - cam->x; v->y= v->y + object->y - cam->y; v->z= v->z + object->z - cam->z; new->x= v->x*right->x + v->y*right->y + v->z*right->z; new->y= v->x*up->x + v->y*up->y + v->z*up->z; new->z= v->x*look->x + v->y*look->y + v->z*look->z; v=new; I don't have any clue why this doesn't work for the x-Axis rotation. please help me