Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 23 Apr 2006
Offline Last Active Sep 07 2011 04:54 PM

Posts I've Made

In Topic: Bounding Sphere construction

02 June 2011 - 03:43 PM

Finding a minimal bounding sphere is easy. There is a trivial n^4 time algorithm for doing it, just search over all sets of tetrahedra over the convex hull of the object, take the smallest enclosing sphere of each tet, and then take the smallest one that includes all points. There are also the special cases for the situation where the bounding sphere is determined by two and 3 points respectively, though they follow similarly.

There are several much faster linear time algorithms, though you can just look those up on wikipedia: http://en.wikipedia...._circle_problem

In Topic: Voxel / Marching Cubes

02 June 2011 - 12:49 PM

Here is a really dead simple/bone headed algorithm that I've used to do level-set surface reconstruction. Unlike marching cubes/tets/whatever it has no special cases, though the trade off is that it can end up being a bit slower. This is how it works:

1. First, generate an initial coarse mesh that covers the level set. This can be as simple as just covering it with uniform boxes and then gluing them together along coplanar faces, throwing out the ones which do not cross the boundary.

2. Next, take your coarse mesh and perturb the vertices so that they lie on the level set boundary. To do this, you just use a non-linear root finding method, such as Newton's method/gradient descent.

3. Take the resulting mesh that you got from step 2 and apply a surface subdivision algorithm.

4. Go to step 2 and repeat until your mesh is reasonably fine.

Of course where this can get into trouble is if your initial guess/mesh was too coarse (ie you cover up a hole or something). So, there are probably some ways to refine this to make it a bit more efficient and robust. However, the general idea is to just solve the problem like you would any ordinary type of non-linear root finding problem; which is to just do gradient descent and iterate until it converges.

EDIT: -2 ? Really? I never claimed this method was particular good or even that original ( I am sure that someone has tried doing this before... ), but it is simple and it works. Could someone please explain what their issue is with this post? I would be happy to stand corrected if there is something wrong with what I wrote.

In Topic: Good 3D Lib for Java browser game/Basic

25 May 2011 - 04:00 PM

Okay, I need some advice here. I am intermediate-expert in Java. I'm going to use Java for the game. I have programmed some simple singleplayer 2d rpgs (and platformers). I'm looking to jump into basic 3d multiplayer game that runs in a browser. What I need:

A *3D* graphics library that is low(er) level that will run on any browser (okay, maybe not IE), and it capable of graphicsthatarenicerthatrunescape lol. I was thinking OpenGL, but there are very few tutorials on using opengl in a browser (honestly, I'm getting the hang of OpenGL, and would prefer this, but I have no idea how to get it in a browser), I looked into WebGL, but the amount of documentation on using it with java is absolutely PATHETIC. Which one should I use? (Keeping loading times down is a plus).

lwjgl looks alright... But there's barely any documentation whatsoever, and i doubt it can be used in a browser. JOGL seems to be kinda what I'm aiming for, but again, next to no documentation whatsoever. And it appears Java3d has been dead for years =\ Any other ideas?

Also, what language should I use for client-server communication? PHP? I honestly know next to nothing on this topic. The only real requirement I have for the client-server is that it is easily secured (or rather, EASIER to secure).

Also if you know of any good tutorials on *3D* ENGINE/GAME framework design (specifically in Java) that would be awesome. There are SOME tutorials on this in 2D, but I'm looking for some 3D tutorials.



What makes you think the WebGL documents are bad? The official spec by Khronos is very well written: https://www.khronos....ebgl/specs/1.0/

If you know OpenGL, WebGL is pretty much the exact same thing. I don't see how you could make the case that either JOGL/LWJGL are easier, since you would need to learn at least as much to use either of them .

For your server, you could write that in pretty much anything you want. All it takes is some code to process HTTP headers, which is really easy (or you could just find a library that does it for you). Depending on your requirements, you may want to use either a static web server (if you don't have any dynamic content), a framework (if you only have simple forms/stateless transactions), or roll your own HTTP server (if you need to use websockets/comet style passing for low latency updates to some complex internal state).

EDIT: Now if your question is on how to use it with Java, then I am afraid you are terribly confused. The idea behind WebGL is to have an OpenGL interface for Javascript -- not Java. I don't think it would even be possible without an enormous (and probably wasted) effort to connect WebGL to Java.

In Topic: functional programming languages

25 May 2011 - 03:40 PM

I don't want to start a language war, but even though I really do like functional programming it is hard to make it work in any application that needs to push around big blobs of semi-structured binary data (such as games, numerical code, or general graphics/physics/image processing types of stuff). The reason it ends up being so difficult is that you end up implicitly needing to make lots of copies of your data to get stuff to work without side effects. When the things that you are copying are small and don't persist for long, then this is no big deal. However with big vectors and matrices this is definitely not true, and it becomes a very expensive proposition.

Even if you are careful and use things like monads to abstract some of this away, it is still very easy to make a mistake and accidentally put a giant memcpy right in the middle of your main loop (and some languages will do this silently, even different behaviors depending on what compiler options you use!) Some languages (like Erlang) try to get around this by replacing random access arrays with binary trees. This has the advantage that local updates can be made without doing a complete copy, but the disadvantage is that random accesses are much slower, and the data structures tend to exhibit poor locality/cache performance and are typically several orders of magnitude slower.

This is really a shame, since I like the idea of using functional programming for things like organizing game logic and entity behavior, and I think that functional code is usually more elegant and readable than imperative code. However, the awkwardness of using FP for graphics is just too big a downside to make it practical. One way I could see it working out is if you use a functional backend for say a server (such as in a MMO-browser based game). In this situation, the game logic could be sufficiently abstracted away from your display that it might be feasible to use something like Erlang or Haskell. Of course if it turns out that later on you do need to do physics on the server-side, then you will probably end up getting screwed.

In Topic: Creating a noise texture with pre-defined values [Need help with kriging algo...

24 May 2011 - 02:50 PM

You could try using Kriging (http://the-witness.net/news/?p=345) on the black holes, and adding other random control points for the field. Ive never actually used it, but it seems like it would work...

That's a neat trick!