BSP loader with shader support

This is a discussion on BSP loader with shader support within the Game Programming forums, part of the General Programming Boards category; finally I have my BSP loader working well, it has some basic shader support, thank you guys for your help ...

  1. #1
    Registered User glUser3f's Avatar
    Join Date
    Aug 2003
    Posts
    345

    Cool BSP loader with shader support

    finally I have my BSP loader working well, it has some basic shader support, thank you guys for your help
    Here are 2 screenshots:

    Quake 3 Arena
    Attached Images Attached Images  

  2. #2
    Registered User glUser3f's Avatar
    Join Date
    Aug 2003
    Posts
    345
    RTCW
    Attached Images Attached Images  

  3. #3
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    Looks good, it's more aesthetically pleasing than mine. Have you implemented skybox?

  4. #4
    Registered User glUser3f's Avatar
    Join Date
    Aug 2003
    Posts
    345
    yep, I did. doesn't look as good as Q3 though, but I think it's good enough for my engine.
    Now, I've got physics to implement, I hope I'll be able to get something as good as yours
    I still have no idea how to check collisions against patches, all what I found after searching is some cryptic code here and there

  5. #5
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    approximations work better than 'accurate' collisions against patches, keep that in mind.

    Collision is really tricky, especially if you really try and understand it and all of the problems involved. Forewarning to you: almost all of the bsp collision detection tutorials are buggy. For some reason small shallow rays going into a plane can go through walls, and I've had to implement a workaround for that (I still dont' see where the problem is, I've been reading the quake2 collision detection a LOT and I still don't know why it happens, but it happened in my code and it happened in all of the tutorials I've learned from).

    So, yeah, I can help you with that stuff and help you avoid pitfalls with jumping, sliding across faces, and speed. And be careful how you toss around EPSILON

  6. #6
    Registered User glUser3f's Avatar
    Join Date
    Aug 2003
    Posts
    345
    I was working on eliminating memory leaks for lats couple of days, I think I'll start on coding physics tomorrow, and sure, if something goes wrong, I'll come here and post, thanks in advance

  7. #7
    Visionary Philosopher Sayeh's Avatar
    Join Date
    Aug 2002
    Posts
    212
    perfect collision detection is done by testing against a surface normal to see which side of a plane you're on. it never fails. The only way it can break is if your floating point precision fails near infinity.
    It is not the spoon that bends, it is you who bends around the spoon.

  8. #8
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    to do collisions you've gotta consider some weird scenarios though:

    1) - When do you add the EPSILON units and when do you subtract the EPSILON units for calculating fractions against planes (EPSILON is 1/32 in the Quake source)
    2) - What happens when your speed is less than EPSILON units
    3) - What happens when a ray goes incredibly shallow into some plane of a brush?

    You can't do collision detection without answer all of those questions. I know what the answers are, and for the last scenario I know what happens but I have no clue how to fix it.

    That's why quake defines a 'stop epsilon' value which makes the player unable to move if travelling less than that speed (it is .1 in the case of quake2), and that is also why when clipping velocities to planes that have been hit (projecting the movement vector onto the plane) the velocity is actually reflected slightly away from the plane so it isn't perfectly parallel by between 1 to 10%
    Last edited by Silvercord; 10-08-2003 at 02:45 PM.

  9. #9
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    Exactly how did you do the skybox? Did you do anything special for yours to make it look like sphere so that the textures are actually seamless, or are you just rendering a skybox as normal? (if you are just rendering a skybox as normal then it isn't actually being done right).

  10. #10
    Registered User glUser3f's Avatar
    Join Date
    Aug 2003
    Posts
    345
    actually it's a normal box, like the one you see in GameTutorials skybox tutorial, I just use sky shaders which (in the file sky.shader) these shaders contain "tcmod scale" and "tcmod scroll" values for the texture, "tcmod scale" scales the texture and "tcmod scroll" moves the texture so it looks like the clouds are moving.
    I tried to implement a sky box before implementing shaders but it kept looking bad near the corners.
    I included a screenshot from q3dm1 looking at a corner, it's quite hard to tell whether it's a corner in the sky box or not.
    If you don't want to implement shaders, you may try to move the textures, by using glTexCoord with proper values over time, it will look good, except in the corners.
    I hope my post makes some sense if you have questions, post!
    Attached Images Attached Images  

  11. #11
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    Are you saying calculate texture coordinates as a sphere? I don't exactly see how using shaders magically fixes the problem, because ultimately you still have the problem of wrapping textures over some polygon

    EDIT: but your sky looks nice though
    Last edited by Silvercord; 10-10-2003 at 10:19 PM.

  12. #12
    Registered User glUser3f's Avatar
    Join Date
    Aug 2003
    Posts
    345
    Sorry for the long delay, I haven't been here for a while.
    Nope, I don't use any sphere coords, all what I do is draw a cube, each side of the cube is textured using info from shader files, I move the clouds using:
    Code:
    glMatrixMode(GL_TEXTURE);
    glTranslatef(x, y, 0.0f);
    which makes the clouds move.
    Clouds may go wrong in corners, so I synched all the faces to move at the same speed, so they wrap around nicely in corners/edges.
    What helps to make the effect look right is that sky textures contain black areas in them, so it's quite hard to notice edges corners.
    hope I was helpful this time

  13. #13
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    Yes that was helpful. And like I said it looks good. I've got a basic sky box rendering and I've achieved a similar effect by increasing the texture coordinates based on time. However I am not going to build a shader parsing system.

    EDIT: I think it is sad that the best projects get the fewest responses.

    Go to gametutorials.com/forum
    Last edited by Silvercord; 10-16-2003 at 08:57 PM.

  14. #14
    Registered User glUser3f's Avatar
    Join Date
    Aug 2003
    Posts
    345
    hmm, I have an account there, but for some reason I asked most of my questions here, maybe because most of them were debugging related, when I finished the BSP renderer I decided to post here to thank the members who helped me.
    Sure, I'll post there if I don't get helpful posts here anyway.

  15. #15
    Registered User
    Join Date
    Feb 2005
    Posts
    1
    plz check ur private messges

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Errors including <windows.h>
    By jw232 in forum Windows Programming
    Replies: 4
    Last Post: 07-29-2008, 01:29 PM
  2. failure to import external C libraries in C++ project
    By nocturna_gr in forum C++ Programming
    Replies: 3
    Last Post: 12-02-2007, 02:49 PM
  3. Dev-cpp - compiler options
    By tretton in forum C Programming
    Replies: 7
    Last Post: 01-06-2006, 05:20 PM
  4. Replies: 6
    Last Post: 11-12-2005, 10:57 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21