Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

107 Neutral

About DavidBurns

  • Rank
  1. DavidBurns

    Generating a minimap

    You could try smoothing/blurring it to get rid of some of the blocky-ness, then just use a somewhat-transparent textured overlay to add some interesting features to the minimap. Also, if you first distort the minimap (e.g. subtle non-uniform horizontal or vertical waves), it may (or may not) look less blocky and more natural.   Using the average colour around the centre will give the same colour for every tile of a particular type (which is what you have atm), and random selection will give you a random-looking result (you could try smoothing or a median filter after to reduce the range of values, though this may not be so good either).
  2. Hi.    I'm using Carvelib (https://code.google.com/p/carve/) to perform some boolean operations on some cubes (actually rectangular prisms). I've wrapped the lib in c#, triangular tessellation is done using Triangle.NET (triangle.codeplex.com/) for each face, and display uses ModelVisual3D in a WPF viewport.   There is a problem with my test case where a number of intersecting cubes form a union and have coincident vertices. This causes some faces to flip inside-out. If I offset the cubes (size 10x3x3) by 1E-7 (or larger), then the problem doesn't occur (but I'll then have a hole in my "solid" geometry). Does anyone know why this is happening? Does carvelib have issues with coincident vertices?   The attached images are the union of incident cubes (looks good, but will have the hole in the middle), and when offset (some faces appear to be missing, but they're just inside-out and therefore transparent from the viewing direction).   The code to create the cubes is below (it has the offset translation present). Basically it just places 8 cubes, each rotated 45 degrees more than the last, in a union. public static Shape testShape() { Shape myCube = translate(cube(3, 3, 10), 1E-7, 0, 0); // the translation value here is to stop vertices matching exactly return union( ForEach(range(0, 45, 7*45), ang => rotate(myCube, ang, 0, 1, 0) )); }
  3. DavidBurns

    Pan, rotate and zoom in on 3D model

    I'm glad that approach will work, as it's easy to understand. I'll check my calculations for rotation on some simple numerical examples, and may have some more meaningful questions (or an answer).   Thanks for your time.
  4. DavidBurns

    Pan, rotate and zoom in on 3D model

    I'm using C#, .NET, System.Windows.Media.Media3D and displaying in a WPF Viewport3D.    The zoom is easy: cameraPosition = zoomWheelChange * (cameraPosition - lookedAtPoint) + lookedAtPoint; The pan is also easy, thanks to your last post: cameraVect += (cameraUp * diff.Y * .001 + cameraRight * diff.X * -.001) * distToOrigin; Where cameraRight is simply the direction of Vector3D.CrossProduct(camera.LookDirection, camera.UpDirection);   I've tried a bunch of different manipulations of the camera position and the lookDirection, without luck. The most recent attempt was to rotate the camera around the lookedAtPoint, and update the lookDirection to look from the camera to the old lookedAtPoint. The result is similar to panning, which was surprising.
  5. DavidBurns

    Pan, rotate and zoom in on 3D model

    Thanks for the reply. I haven't done any 3D graphics before, so I don't know what the projection/view/etc. matrices are, or how they're accessed or applied to the Viewport3D object.   The information re the panning moving the camera along a plane for panning is helpful, and is what I guessed was the case.   I have found code that can calculate the projection matrix, but none to apply it. In any case, I'll see if what I can do with the projection matrix tonight.
  6. Hi. I'm displaying a mesh object in a WPF Viewport3D, and would like to be able to manipulate the view, using the mouse, in a similar fashion to many programs that display 3D models (e.g. openSCAD, STL viewers, blender, etc.). I have a Point3D for the cameraPosition, and a Vector3D for the lookDirection. I also have a directional light source pointing in the lookDirection. I had a go at each; zoom's the only one I got working alright, which is simply: cameraPosition = zoomFactor * (cameraPosition - lookedAtPoint) + lookedAtPoint; (I've set lookedAtPoint = cameraPosition - cameraPosition.toVector().length * lookDirection / lookDirection.length) My results are not like those in real 3D model viewer software. Does anyone know the equations for pan, rotate and zoom normally used (given dX/dY/dScroll of the mouse)?
  • 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!