• Advertisement

kod

Member
  • Content count

    15
  • Joined

  • Last visited

Community Reputation

126 Neutral

About kod

  • Rank
    Member
  1. stil no reply . Wouldn't there be the possibility to "flip" the shadow coordinates that I save in the texture matrix? I'm not that fit in matrix math though. I tried to manipulate the bias matrix that performs coordinate transformation to the texture coordinate space but the result was not as planned. Any ideas?
  2. Hey, I've been trying to implement shadow mapping in my project. Most of it is working as it should, that means the depth texture generation is about right and shadow coordinates are saved in the texture matrix to be accessed in the shader. As a base I've used the tutorial at http://fabiensanglard.net/shadowmapping/index.php I had some trouble to get it working but basically now the code is very similar to the one in the tutorial. I even use the same texture units, etc. I can post some code later if it matters. Now here is the result I got: [img]http://www.jazzd.de/shot0015.png[/img] What do you see here: The white plane is my terrain/ground. On the left of it there is a textured sphere sunk in the ground. Red sphere on the left is my light source directed towards the sphere. The Shadow that is generated looks about right but it is on the opposite direction of the sphere that it should be. I've read some forum posts and other tutorials and some of them talk about the generation of an inverted camera matrix. Now I've already tried that and the result was absolutely wrong or did not work in the slightest way. Also I'm not really sure if my problem is a result from that. And then again I'm wondering why there is no such inversion in the tutorial. It would be great if someone was able to enlight me about this....
  3. texture processing

    variate texture luminance, use shaders, there are lots of ways doing it.
  4. i dont see the point in DDS and i dont see the point in your new format, stick with stuff everybody knows how to work with. I like TGA,PNG and JPG full stop.
  5. OpenGL Opengl Text

    use textured polygons and freetype, it's fast, free and you can use ANY TTF font. See nehe's for a tutorial that does the whole thing. Oh variable width is no problem with freetype based fonts :)
  6. do you even display your fps value? I'd go and add a frames per second counter and see what the value is like.
  7. The most simple collision detection with a terrain I know is getting the current Height value using the camera coordinates. This method suits me pretty good and it works just great if my heightmap scale is 1. (I scale my each vertex value by a constant factor on heightmap creation). The movement is smooth. Now when I set the scaling factor to 100 for example the heightmap is of course 100 bigger on screen. The pixel data is still the same. I simply get the Height like this: NewPos = Height(CamX/100,CamZ/100)*100 + SomeValueForCameraHeight; Before trying it I would guess that this is choppy. And of course it is choppy when walking over the terrain. The Collision is correct. Well, I'm not really interested in implementing some advanced collision method. Isn't there a simple "hack" to stop the chopyness? I could scale the whole heightmap by the factor and run a gaussian blur over it. But that would use up huge amounts of memory and I dont like it. Has anyone got a better idea to make this interpolation a bit more smooth? thanks.
  8. Are my Normals calculated wrong?

    that really looks like surface normals to me. As already pointed out you need to calculate vertex normals. Or do something like I do. http://www.gamedev.net/community/forums/topic.asp?topic_id=487715 It's nothing new, but the result is good and fast.
  9. You should go and learn everything about using sprites and some 2d game basics. http://jnrdev.72dpiarmy.com/ This is an awesome place to start. But i dont really like how they did their games. Use Opengl and maybe learn to use shaders to have some cool effects in your game.
  10. terrain normals

    ah right, would love to try that right now but i dont have my source code here.
  11. terrain normals

    Quote:Original post by ndhb The 4 texture unit limit you refer to are for the fixed functionality pipeline. In shaders we can access many more (32 AFAIR on NV8800). hmmmm one thing I didnt know! I'm working with a NV7600 at the moment. How do I access texture units >GL_TEXTURE3_ARB. Do I simply call GL_TEXTURE4_ARB? I have some experience with shaders but sometimes I'm really stuck with my old opengl wisdom ;).
  12. terrain normals

    I decided to get my hands dirty with normalmaps: Pro, its DAMN fast, looks almost as good as the surface normals (even better on edges). Artists can retouch it. Con: Most graphics cards only have 4 texture units, uploading the normalmap into the ps makes me loose one unit for splatting. But thats the only bad thing right now. I COULD load the image as pixels and upload each color of a pixel as a vertex normal, that already works but i have to tweak it. some images: This is a calculated normalmap, im not really sure if its 100% correct but i dont care as the result is pretty cool already.
  13. terrain normals

    i guess that will produce a very good-looking result. Still im really interested in loading normal maps from a bitmap and mapping it on the terrain as normals. Im kind of curious how good that looks. It would at least be extremly fast.
  14. terrain normals

    thanks for your reply. I got it working! I had to invert the normal on odd triangle indexes. It was pretty simple. Just a check if the current index is odd or even, then invert the normal (*-1). looks pretty cool now :). Its only face normals though, blocky on edges but hell, its fast at least. I have not figured out how to generate vertex normals for so many triangles/vertices. It will take ages :/. :)
  15. Hi, long time since I programmed game related stuff. Anyway I had some spare time and wrote up a heightmapping demo that uses glsl, splatting and per-pixel lighting. It works pretty good already but i have a VERY small problem with the normal calculation: The terrain is split up in triangles. Each iteration of the grid has 2 triangles. Now I go and calculate the normal like this: for(int c=0;c<m_totalTriangles;c++) { CVector3 Triangle[3]; Triangle[0].x = m_vertex[i++]; Triangle[0].y = m_vertex[i++]; Triangle[0].z = m_vertex[i++]; Triangle[1].x = m_vertex[i++]; Triangle[1].y = m_vertex[i++]; Triangle[1].z = m_vertex[i++]; Triangle[2].x = m_vertex[i++]; Triangle[2].y = m_vertex[i++]; Triangle[2].z = m_vertex[i++]; CVector3 Normals[c] = Normal(Triangle); } Each Triangle has a calculated normal, the face normal of this triangle is calulcated so: CVector3 Normal(CVector3 vTriangle[]) { CVector3 vVector1 = Vector(vTriangle[2], vTriangle[0]); CVector3 vVector2 = Vector(vTriangle[1], vTriangle[0]); CVector3 vNormal = Cross(vVector1, vVector2); vNormal = Normalize(vNormal); return vNormal; } Now to the problem: When I draw the normals using lines from the center of each triangle you already see something is wrong. In some Triangles the line goes up as it should and it others it faces downwards. I know its a problem coming from the cross product (right hand rule). But how do I fix it? My lighting calculation in the shader is right, but as you can see in this image, its just the same as above. Would be cool if anyone has an idea about how I can fix this :).
  • Advertisement