Tag Info

New answers tagged

1

You want to use GJK. The general algorithm finds the closest point between two (convex) meshes, but of course one of your "meshes" can just be a single point in space. Note that since it only works with convex shapes, you need to break your mesh down into convex pieces (if it's not already convex) in order to apply the algorithm. Find the closest point to ...


0

zNear is not really related to field of view. FOV specifies the angle of the frustrum, while zNear describes the distance to the nearest clipping plane. As an example, here are two frustrums with the same FOV, but different near clipping planes. And here is another frustrum with the same zNear as the first, but different FOV. A good approach to ...


0

zNear and zFar are measured in world space, not in anything to do with pixels. Their scale will depend on the scale of the scene you're rendering and how close/far the camera will be to the geometry. For instance, if your scene is modeled in meters, you might set zNear to 0.1 and zFar to 1000 or so. This would let you get the camera as close as 10 cm from ...


3

The official answer from Shawn Hargreaves (one of the developers of XNA) is The XNA Model class doesn't do any optimization at runtime: that all happens at build time inside the ModelProcessor. This is exactly why it is impossible to create a Model instance at runtime: the Model class depends on the processor to have optimized its data ready for ...


0

I assume this cube is made of triangles. You can simply ray cast the scene and check Ray/Triangle intersection for every face triangle. The ray cast function will return the triangle index and the 3D intersection point, once you have this info you can do what you want. You need to look for Unproject and ray/triangle intersection.


0

Thank you all but I found an other way to do that. I created (or rather copied form this schema) a rotation matrix RotateMAT[16]: #define OGLToRadian(degre) ((degre) * (M_PI / 180.0f)) //... GLvoid ROT(float x, float y, float z) { const float cosA = cosf(OGLToRadian(GLrotate_y)); const float sinA = sinf(OGLToRadian(GLrotate_y)); float RotateMAT[16] = ...


2

OpenGL 1.x's built-in matrix operations are notoriously slow, and may even cause pipeline flushes in some cases. To gain performance, translate your gl matrix operations to client-side code (there are several solutions, http://glm.g-truc.net/0.9.5/index.html and http://cmldev.net/ being popular ones). If you already have a lot of code, you can easily write ...


2

When measuring performance, use frame times, rather than FPS. In your case: 1000 ms / 80 FPS => 12.5 msec/frame 1000 ms / 100 FPS => 10.0 msec/frame These are very even FPS numbers, which makes me suspect that they are tied to the display vsync. Have you tried disabling vsync (with a call like eglSwapInterval, or setting the Direct3D swap interval? ...


2

Here's a technique I experimented with recently. My RenderMonkey prototype shows a section of badlands-style canyon, but the same principle should work in caves. The idea is to start with tiles that are generic, downright boring, with simple predictable edges so they're easy to line up without seams or gaps: These starting tiles could be shapes you've ...


0

Scale in script: gameObject.transform.localScale = new Vector3(2,2,2); in the numbers you set the scale to each axis of your gameObject. edit: like Esa say you need to do this in each part of your model, but you can make it in a bone of skeleton of animation that create the effect you need.


2

Here's another approach to procedural generation that hasn't been explicitly mentioned yet: spline skinning. You can use a version of Hermite Splines (which provide a curve interpolating positions and tangents) to define the curves: when it's time to generate a new segment, just choose a position (roughly in the direction of the previous segment, as bcrist ...


3

Unity has the scale component in every transform. You can then scale the x,y,z of the model. So in theory if you have a model with separated body structure so that arms, legs and head are all individual GameObjects you can scale them individually.


6

There is rarely a "right way" or "wrong way" when it comes to game design. There are many, many ways to solve this problem, but here are a few possible approaches to explore: Constrain the tunnel pieces to both start and end only in certain directions; for instance only along the axes. Then you just have to keep track of the offset from the beginning to ...


2

You could model your cave as a sequence of points, each with an associated size, with lines connecting them. Then treat each point and line as metaballs and metacylinders. This gives you a basic shape for your cave, to which you might want to start adding variation, such as by randomly offsetting vertices.


2

This is going to depend on what you want to work with. Blender has an export feature which will allow you to export the models into several formats. If you want to write a customer parser, there are a few for various formats. You mentioned WebGL, which makes me think you're going to be working with JavaScript. With this in mind, Three.JS has some built in ...


1

The easiest approach is probably going to be exporting to COLLADA. Blender comes with a COLLADA exporter out of the box, so you'll just have to import the COLLADA XML data into your own data structures.


2

OpenGL provides occlusion queries, described here. They are not exactly simple to use, but I believe they will do what you need. Basically, you create an occlusion query object, then "activate" it with glBeginQuery during the rendering that you want to analyze. After you are done drawing the geometry of interest, call glEndQuery and glGetQueryObject, ...


1

I believe it is pretty common to use a bone just to represent the weapon, and pull the rotation from that. Alternative you would keep an extra vertex so you can determine the direction. Depending on what they are holding you might be able to use a fixed rotation from the hand's bone rotation.


1

I think that tutorial actually contains all you need. It mentions that the order of rotations is Z, then X, then Y. I don't know Unity's quaternions, but you are either doing Z then Y then X, or the reverse. Try swapping x_rotation and y_rotation when you calculate your final rotation.


3

The .hdr format represents colors using a variant of floating-point format, so its maximum value is similar to that of float, i.e. about 10^38. In practice, you will likely not see values this large, but as you've found, different .hdr files may have very different value ranges. There is no standard for what the values in an .hdr image "mean". They could ...


1

I can suggest the artist’s approach and the engine programmer’s approach. What an animator would do is rework the animation sequences in an application such as MotionBuilder, Maya, or even the free Blender. The animating features of these tools are quite tricky to use at first, but there are plenty of tutorial videos on the web to get started. Another ...


2

Your question is quite broad and underspecified, so in this answer I'll focus on finding river flows. Within the field of computational geometry there is quite a bit of research on the topic of drainage networks on a terrain. An overview can be found in section 3.5 of this article: Digital Elevation Models: overview and selected algorithms. A useful ...


4

What you are looking for can be found in this very good explanation: http://www.songho.ca/opengl/gl_transform.html But since I found it sort of confusing without hand holding I will try to explain it here. At this point you need to consider 5 coordinate systems and how they relate to each other. These are the window coordinates, the normalized device ...


2

There are billion ways to do this. But here is my approach : To do this i would go with a more "particle" system approach. Rendering a line is quite easy with a quad, you just stretch the four vertex in the direction it´s traveling and then have a maximum length that it never can be longer than. the best way with this is that you can heayily optimize this ...


2

I have solved the problem. As it turns out, in my Marching Cubes polygonizer, I was inadvertently making copies of the vertex data, (objects), which were then being propagated through the rest of the processing pipeline. Something I learned: If you know smooth shading is enabled, and you see sharp edges on anything but very acute angles, then your vertex ...


0

What you'll wind up doing David is creating a vertex buffer to hold the different transformation matrices for each instance of grass. You will need a vertex declaration that has your standard 'grass' vertex components( pos, norm, uv...etc ), and in that same declaration 4 additional 4-component floats to hold the 4x4 transformation matrix...the declaration ...


1

See this video to understand the concepts of model, view and projection. 4x4 matrices are not just used for translating a 3D object. But also for various other purposes. See this to understand how the vertices in the world are represented as 4D Matrices and how they are transformed.



Top 50 recent answers are included