# AndersR

Member

18

141 Neutral

• Rank
Member

• Interests
Programming
1. ## Shortest path through list of edges

Thanks for the links and input everyone That Funnel algorithm was exactly what I was looking for thanks! I'm almost having a working implementation now. The system is going to be used for both complete automatic steering (just follow the path found strictly), but also needs to support 'carrot on a stick' movement for agents (attract agents towards some point in front of them along the path) so I can use boid movement behavior on them and make them avoid local small obstacles. I will post a demo of it once I have something cool-looking
2. ## Shortest path through list of edges

This isn't entirely a "pathfinding" problem but is still kind of a shortest path problem. In my navigation mesh system (made of convex polygons) I want to get out a list of instructions for my AI to follow when finding a path from A to B. From my A* implementation I get a list of edges in the mesh that the unit has to cross to get to it's goal. The problem is now *where* on the edges it needs to cross to move the shortest distance. Ideally it would end up looking like this: My first thought was to simply make lines to the center-points on each edge it crosses and then do an algorithm that 'relaxes' the lines and merging them if possible. This however smells far away of a worst case O(N^2) algorithm to me (each time I merge two line segments I have to test that the new edge crosses all the edges before. N line segments that needs to have N edges validated = N^2) Is there a better way to do this? In the end I want to give the algorithm a radius too to avoid corners and circulate around it: The navigation mesh needs to support any object size/radius so I cannot preprocess my mesh to be that amount smaller as for example the recast algorithm does when it generates the mesh. My first thought is that I can simply test the point/line distance to each line-segment from the edge-endpoints and test if I need to insert an 'arc' there the object has to follow. I can figure out the points where it will enter and exit the arc using the solution to the Belt and Pulley problem. What I am worried about is that the inclusion of a radius will alter the line segments too much that it would need to split up some lines that I already merged. I could get around that in my initial algorithm by shortening my line segments by the radius: Would this work in all cases? (from there on I could collapse points on the edge of the circle into the 'arc'. Am I overthinking this? Are there easier ways to do a smooth path though those edges?
3. ## Sound triangulation using Apollonius?

Yes the starting time t is unknown (thats the entire idea) - which is why I used relative time differences from when the first sound pulse is detected. The first mic to get the sound becomes mic A, the second mic B and so on. The idea is that when you find the circle that tangents the two circles and the point (circle of width 0) you get the solution circle. The distance from the center of the solution circle to mic A is the unknown time t (when speed of sound is 1 m/s).
4. ## Sound triangulation using Apollonius?

Very interesting Thank you a lot for your reply. Definitely something worth looking at.
5. ## Sound triangulation using Apollonius?

I'm not a mathematician (nor very good at it) but I recently had a look at how one can triangulate a sound source based on the arrival times of different microphones. Isn't it possible to use a special case of Apollonius' problem as a solution to triangulate a sound source much easier? Or will inaccuracies in the measurements makes this impossible in practice? In this graphic I have simplified the problem very much (2D only) and made the speed of sound = 1 m/s I'm guessing this could extended to 3D *relatively* easy using spheres. I'm interested to hear if this could work in real life applications or if the current methods used are much better/reliable. Note: The pixels are to measure in the graphic, if you want to verify the lengths and distances you can measure yourself using a graphics program
6. ## By the time I learn a feature it has become deprecated!

To learn a future-safe kinda version of OpenGL you could have a look at OpenGL ES 2.0 which is mainly for mobile devices and the like. It's a reduced set of OpenGL with all the most important stuff. You will not find any deprecated features there. For a beginner it will be a challenge to approach it because it also removes some of the convenience features such as the matrix stacks. You have to upload matrices to your shader manually as a uniform.
7. ## recalculate normals after rotating geometry

Multiplying your normals by the normal-matrix will transform them into view-space so they will always face the camera. If you just want them transformed back into their previous space before rotation, isn't it just a multiplication with the inverse model-matrix? (not sure if that will work, can't think straight right now)
8. ## Visual glBlendFunc Tool

I chose to do this in HTML5 since you could keep it as a bookmark and access it from any computer without having to install any software. I actually started implementing a little in a standalone application but realized the HTML5 version had more benefits for what I needed it to do (except for maybe execution speed).
9. ## Visual glBlendFunc Tool

I have just added an option for glBlendEquation. You can now visualize three times as many effects as before :)
10. ## Visual glBlendFunc Tool

Quote:Original post by swiftcoder You need a server-side script (generally in php), which resides on your server (so that javascript can access it), and proxies the remote image (since php doesn't have the same security restriction vis a vis remote sites). If you google for 'AJAX proxy', you should get many results. Yeah, I was hoping I could get around the problem another way (security concerns) but it seems that is impossible. I have made a simple proxy script now. Ctrl+F5 to be sure you have the latest copy running in your browser :)
11. ## Visual glBlendFunc Tool

I have added those features now. Do a hard refresh by pressing Ctrl+F5 if you have the old page cached. I'm currently trying to find a way to get around a javascript security feature that removes the ability to load remote images from other websites.
12. ## Visual glBlendFunc Tool

Supplying your own images should be simple though, I will add that :) Also being able to see the alphachannels seperately is a good idea. Will add that :)
13. ## OpenGL Visual glBlendFunc Tool

Hi everybody. I recently needed a better overview over how glBlendFunc worked and I wanted a quick and easy way to test all kinds of parameters without having to recompile. It resulted in this HTML5 tool: (it requires Firefox, Chrome or Opera) http://www.andersriggelsen.dk/OpenGL/ It supports all the parameters glBlendFunc() takes and you can also specify a color for glBlendColor. There is also a checkbox for using premultiplied alpha textures. What do you think? Is it helpful to you in any way? :)
14. ## Dead Reckoning - Error correction

I have made a decent movement prediction algorithm for my dead reckoning system and I have it working with cubic interpolation for the intermediate steps. I thought about how to best correct errors when the algorithm makes wrong predictions. In this image the blue ball moves forward most of the time which makes the prediction engine guess that it should keep moving forward. The small dots are received position updates. When the blue ball has moved to the predicted position it then gets the position update that it should have been at the shiny blue dot's position. In that same update, the predicted next position is at the shiny red dot. My question: What would be the best way to move the blue ball to the red dot without it looking unnatural? In most games, when there is lag, I see characters jump back and forth and suddenly teleporting to their destinations. A simple way would be to move it very quickly to the last received position update (blue dot) and then move it with normal speed as usual. This quick error correction would look very unnatural though. I think an approach that moves more quickly in the beginning and then slowing more and more down would be better. I thought about having it start out the interpolation with the direct line to the red dot and then combine it more and more with one of the sketched cubic interpolated curves I guess. How would you manage error correction to give smooth movement but still prioritize movements happening almost as fast as it does on the server?
15. ## How to make a model look better

Yes find a simple per-pixel light shader to give it shading. Also generate mip-maps for your textures, it really improves visual quality.