Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About Bobboau

  • Rank
  1. Bobboau


    from the description of your problem it sounds like the separation property isn't being implemented properly. you should use an average for cohesion and alignment, but just use the position of the actual closest bird for separation. I just implemented flocking for a class recently, I'd give you my code if I had a place I could upload it to. [Edited by - Bobboau on March 22, 2010 1:07:09 AM]
  2. Bobboau

    distance from hermite curve

    just found this looks like I'm not the only person to try and fail at this, but this looks like I might get some good results.
  3. Bobboau

    distance from hermite curve

    that's my backup plan. it seems like colliding with the curve should be faster and more accurate, not to mention smoother.
  4. I'm tinkering with making a 2d platformer engine, I'd like to make the level out of Hermite splines, but I need a way to do collision detection, I don't need anything complex like spline on spline intersections, I just want a function for finding the point on the curve that is closest to an arbitrary point. I know calculus, so I know the standard method for doing this; take the line function make a distance function, take the derivative, wherever the derivative is 0 will be a (the) closest point. problem is in the last step I end up with something unwieldy and I can't solve the 0s. I'm hoping there is a standard solution for this. I'm defining the Hermite curve as: (start_pnt * 2.0f*t3 - 3.0f*t2 + 1.0f) + (end_pnt * -2.0f*t3 + 3.0f*t2) + (start_tan * t3 - 2.0f*t2 + t) + (end_tan * -t3 + t2) any help would be appreciated
  5. ok, so I have a magnetic stripe (card) reader and what I want to make a program that runs in the background and deals with input from it (sending it off to an ODBC database, but that's not important). the MSR is configured to act as a keyboard, so when a card is scanned all the data on it is effectively typed in from a second keyboard. what I want to know is what is the best way to have this run in the background and listen to all input from the MSR (which again the computer thinks of as a second keyboard), if it involves giving the program in question exclusive access to the device that's fine (in fact slightly preferred). should I be using raw input? direct input? oh, almost forgot, I develop on a vista machine, but this program needs to run on a 98se (yeah) machine, so the latest version of directx I can use is 8.1 I think (if that is the road we go down). it's only jobs are to read from the card reader and send the info off to a remote database server, and to display (completely unrelated) information in the form of an HTA application.
  6. ok, so I've got this hermite spline class that's really nice. you plug in a starting and ending point and tangent, then you ask it for the point on the curve at position t, where 0<=t<=1, and it gives you a point. and you can step through it and get a nice sequence of points or animate something by putting a function of time into it or something of that nature. and it generally seems to work really well except for one glaring problem, a change in t has a non-uniform difference in the arc length of the output vectors, that is points are more densely packed in some places than others and objects moving along the path tend to slow down and speed up when they should be moving at a constant speed. now the obvious solution to my problem is reparamitarisation of the spline, so the t value you give it is not the time but the arc length from 0 to 1. take the inverse of a function that gives me arc length and pass the t value through it, it should return the real t value for the proportion of the spline you intended for it to find. ok fine, so how do you get the arc length function, well you integrate the velocity function, the velocity function is the magnitude of the derivative of the curve function. so here is where the problem is, the velocity function is the square root of a fourth degree polynomial. it's not that this is unintegrable, but according to mathematica, the result is 6 pages long and not the most invertible function I've ever seen, includeing a bunch of odd functions I've never heard of before which probably indicates they are things mathematicians have never been able to solve. so I tried a different approach, the reason 3rd degree polynomials are used is because they can be made to have flat derivatives at both ends, so I recreated this using trig functions, thinking, maybe the integration will turn out to be easier. well, it turned out a little bit better. I ended up with something like sqrt((a*cos(t)+b*sin(t))^2+(c*cos(t)+d*sin(t))^2). the integral for this is still fairly nasty, but manageable, but it's still totally uninvertable. which really annoyed me because it seemed to be working a whole hell of a lot better than the original polynomial approach. so what I would like from the wonderful people of this forum is either advice on how to fix one of my existing spline models, or an alternative that I have not yet thought of. the two set's of basis functions I am using currently are s *= 2.0f*t3 - 3.0f*t2 + 1.0f; e *= -2.0f*t3 + 3.0f*t2; st *= t3 - 2.0f*t2 + t; et *= -t3 + t2; (based on http://www.cubic.org/docs/hermite.htm) and s *= cos(PIt)*0.5f+0.5f; e *= cos(PIt+M_PI)*0.5f+0.5f; st *= -0.25f*(1-t)*sin(PIt+M_PI); et *= 0.25f*t*sin(PIt); s==start point e==end point st==start tangent et==end tangent and those four are summed up after the above calculations to produce the interpolated result point at t. one thing I am wondering about is if there is something I can do with the integral of velocity squared, because in both cases the results for integrating that are a _lot_ simpler.
  7. Bobboau

    smooth curves

    well like I said, I don't care if it is supported by any hardware. if the NURBS thingy will tessellate to pixel length lines on it's own then that will do for my purposes, but I just don't want to have to worry about if you blow a texture up big enough will it start showing artifacts.
  8. Bobboau

    smooth curves

    I was thinking about doing an texture tool and one of the thing's I'd need would be a vector drawer. I was thinking it would be really nice to use OGL for drawing polygons, but that would limit me to straight lines, and that would not be very useful. then I remembered OGL has a bunch of features that people who focus on games usually don't know about because virtually no hardware supports them. so I was wondering if anyone knew of a feature that would enable me to make smoothly curved lines and shapes? something like the vector layers in psp/photoshop. it does not need to be widely supported on hardware or supported at all so long as it can be emulated. I know there is a NURBS feature, but is it a totally smooth curve, or is it just a bunch of subdivided lines?
  9. Bobboau

    non-interleaved textures

    well the thing is I'm getting four data streams right now, each is the same length, and made up of byte data, I'm currently having to combine them into the interleaved format into a new 1d texture every frame and using that in my shader. I would like to be able to just blit them to the buffer, but with interleaved formats, this isn't possible.
  10. Bobboau

    non-interleaved textures

    t'was what I figured, thanks for confirming it for me.
  11. is it possible? I doubt it, but I have found myself in an odd position where I am getting the rgba data in separate contiguous blocks and it would be real handy if I could make a texture in that manner. I know I can make textures that are just one color plane, but is there a way to have all four channels in separate blocks, like what can be done with vertex data? i.e. can I make textures that are of the format rrrrggggbbbbaaaa rather than rgbargbargbargba ?
  12. wouldn't it make more sence to just extend the current shaders to have the ability to read what was there before them? it seems adding another shader stage would be just waistful.
  13. the spec sheet I found said it was undefined. and unfortunately rendering to a texture and using it the next frame doesn't seem to be an option, but fortunately I was able to get my desired effect with a little manipulation of alpha blending.
  14. yeah,I knew that was simple, I just hadn't found the proper references. a few more hours of looking and I found the document with all the answers on it. it was of course while I was looking for something completely different though. one last quick question, is there a reliable way of getting a fragment's previous color? from what I see gl_FragColor is undefined before you write to it.
  15. ok, I'm wanting to write a fragment shader that uses the results of the fixed function vertex proccessor for texture coords, I have 2d coords assigned currently and a 1d texture bound, how do I get the texture coords generated by the fixed function and use them to look up my texture? I am extremely new to GLSL and I couldn't find any examples of a texture lookup for a stand alone fragment shader. I am wanting to have the lookup of the texture be based on the distance of the UV coords, i.e. something like texture1d(currently_bound_stage0_texture, sqrt(coord.u^2+coord.v^2)). I am hopping this is possible.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!