
Advertisement
Catmull Dog
Member
Content Count
26 
Joined

Last visited
Content Type
Profiles
Articles and Tutorials
News
Contractors
Columns
Podcasts
Games Industry Event Coverage
Gallery
Forums
Calendar
Blogs
Store
GameDev Links
Projects
Developers
Everything posted by Catmull Dog

Finding the Slope of a giving Vertex in HLSL
Catmull Dog replied to JamesProctor's topic in Graphics and GPU Programming
The slope is the difference between two adjacent vertices. You probably want the point normal though, or the weighted, normalized average of all adjacent edges at a given vertex. 
Algorithm for "grabbing" a Bezier spline/cubic Bezier curve
Catmull Dog replied to Cornstalks's topic in Math and Physics
Ideally you will draw the control points and let the user drag them independently. To move the whole curve the user would type CtrlA to select All and then could drag any point to move the whole curve. You may prefer Catmull Rom splines as they feature control points that lie on the curve (just the span 1 to 2), where Bezier defines a control polygon and only the endpoints 0 and 3 are on the curve). You can convert between them with a formula that is not too bad (see Figure 4). 
finding the closest distance of point to a line
Catmull Dog replied to jingato's topic in Math and Physics
Here is a good explanation of the 3D point to line problem. The line connecting the point to the closest point meets the line at a right angle. http://mathworld.wolfram.com/PointLineDistance3Dimensional.html 
Stuck in late development
Catmull Dog replied to polyfrag's topic in General and Gameplay Programming
If any bugs can delay the shipping of a product, they will.  Murphy's Law of Programming 
Sounds like the OP would enjoy the Seismic Exploration field in the Upstream Oil industry. Lots of 3d graphics these days.

Help me compile a list of simple games to program
Catmull Dog replied to Cdore's topic in General and Gameplay Programming
An interactive fiction (word) game is a good shortterm project. Design a map and number each room and list the connections for R rooms. Then support 10 directions (the 8 compass directions, up and down). A 10 x R matrix then stores the connections between rooms. You could show a photo in each room (perhaps a panoramic one and let the user rotate 360 degrees). Then, support simple noun/verb parsing and inventory (pick up the rock). 
Gimbal Lock. Trying to describe mathematically.
Catmull Dog replied to Volgogradetzzz's topic in Math and Physics
Basically when you rotate, you rotate the very axes of rotation themselves, so it quickly becomes nonintuitive. Trackball style essentially counters this by applying the transpose of the camera matrix. 
In 1987 a FORTRAN subroutine package was created that fits points to surfaces using cubic splines (though more of a subdivision scheme it appears than a parametric surface). The author published a book (Paul Dierckx  Curve and Surface Fitting with Splines). I'm curious: 1) If it's still useful enough to charge $100 for the book 25 years later, hasn't anyone ported it to C++? 2) Are there limitations to consider versus using Catmull Rom surfaces or NURBS? 3) Is localized control possible? Thanks, CRD

Rewind is simply playing every frame back to the (n1)th frame, and looping n from max to zero. I did this for a billiard simulation 20 years ago and it was cool to watch the break in reverse. As nox_pp points out, this requires a deterministic engine (meaning if you have the same input conditions the same results will occur).

Rendering  Particle Phenomenon on Windows 7
Catmull Dog posted a topic in Graphics and GPU Programming
I noticed that when I render without calling glClear on each frame I get a flickering strobelike effect in Windows 7. I took a snapshot which seems to show what is happening  it looks like it's using sprites with logical AND instead of XOR. It might be the graphics card (nVidia Quadro 2000M) or a setting of some kind. I noticed I had to change my rendering slightly to accomodate Windows 7 originally (namely, to save the DC when the window is created and not use the one returned by glBeginPaint), but never knew for sure what changed between that and XP. Do you have any idea what this observed effect is or how to restore smoother rendering? It looks ok in normal mode and is only an issue when I try to let objects trace out a path by not clearing between frames. Thanks in advance, CRD 
The object is probably made out of polgons, so you can test each one as a plane to see which side the given point is on. One way is to go in a certain order and make sure the Z value in the cross product of two edges of the (rotated into XY plane) polygon is consistent (all positive or all negative depending on the way you go).

I think that everyone is so happy to get theirs working they regard it as a trade secret once it does work. It often seems as though the very authors of the articles resent it when you get it working.

Rendering  Particle Phenomenon on Windows 7
Catmull Dog replied to Catmull Dog's topic in Graphics and GPU Programming
For years I've had a usercontrolled boolean that wraps around the call to clear. I'm not here to debate whether this is right, I'm wondering why behavior has changed on Windows 7 and/or with my graphics card. It may indeed be Alpharelated. 
Questions on volume rendering
Catmull Dog replied to nfries88's topic in Graphics and GPU Programming
Toolkits like VSG VolumeViz support volume rendering. Voxels require gargantuan amounts of space. We're working on converting voxelbased models to parametric surfaces to reduce storage requirements but that's no easy task. Curious if anyone has looked into that (VSG hasn't!) 
Method to Create a Mesh that is Inset by a Specific Distance
Catmull Dog replied to casefc3s's topic in Graphics and GPU Programming
Making two layers using the surface normals is pretty easy but here are some pitfalls: 1) Which way do you let the user scale the derived surface? Or do you support both thicker and thinner? This effects the lighting as you need to keep the winding order consistent. 2) If the surface is open like a tube, you will need to stitch the layers together at the ends. This is much more of a challenge than just deriving a thicker layer. 3) If you supported cutting holes and stitching pieces together, there are allnew problems when you add thickness, as the two layers (each featuring seamless articulation) are no longer simply offset by the normals, the projected region of intersection needs to be scaled about its midpoint and reprojected onto a slightly different surface. 
Thanks K_J_M. It seems to me that basic, buildingblock code like this should be available in a standard form we could all share. Instead it seems we all implement the same algorithms and (never having common test data in most cases) we often don't know about the bugs we have in our version. The alternative is to buy some API that has more than what you need.

Rendering  Particle Phenomenon on Windows 7
Catmull Dog replied to Catmull Dog's topic in Graphics and GPU Programming
Thanks Seabolt. I thought InvalidateRect was GDI but don't have the code in front of me. Wondering why the behavior is different on different cards/OS. In this case I want the particles to leave smooth trails versus having it staggered by its own border not being invisible so I'm intentionally not calling clear. 
Implement Perspective Correct Texture Mapping
Catmull Dog replied to john13to's topic in General and Gameplay Programming
Perspective Correct Texture Mapping is not an easy problem to solve. Back in the mid 1990's it had to be implemented in software, but since then it's done in hardware so you don't have to worry much about it. I remember a colleague who did it in software circa 1994 for another game company and he gave me a hint at how they did it: "Subdivide, subdivide, subdivide". 
Structuring your Engine/Tools License Cost (as Developer vs User)
Catmull Dog posted a topic in General and Gameplay Programming
While many have discussed the cost of licensing a game engine or technology as a customer, it's more difficult to find information about how developers should go about determining the license pricing structure for their existing, proven technology. For example, let's say you as a small business owner have been developing tools for 10 years and you estimate that it cost you $3 Million in time and resources to build a certain product that another company is now interested in licensing (open source). Should you estimate how many licenses are realistic and divide, say 10 licenses at $300K each? And for your first customer (who takes more risk) should you maybe say $30K (1% of development cost)? Also consider whether the customer is your employer, and how much extra you would want to provide them the source code to existing tools. Your input would be appreciated. 
How to ensure affine transformation matrix represents orthogonal vectors
Catmull Dog replied to pondwater's topic in Math and Physics
You basically just cross (product) two to create a third, then recross the third with the first (or second) one, and normalize them all. If you start with only one vector you can cross it with an arbitrary up vector (0,1,0) to produce the third, then recross 1 and 3 to overwrite the up vector. Just make sure the original is not the same as the up vector. 
Performance was not the main reason, though I'm curious how much faster it will be. In order to achieve Centripetal Parameterization (from a 2010 paper "Parameterization and Applications of CatmullRom Curves"), we need a recursive approach to the Catmull Rom algorithm. That allows for arbitrary t (or s) values, which allows shape parameters. We need a Catmull Rom spline where the control points represent the points of highest curvature (please see attached image). I think many make the assumption that is the default when it's not.

In Siggraph '88 (24 years ago this week) there was a great article by Phillip J. Barry and Ronald N. Goldman titled "A Recursive Evaluation Algorithm for a Class of CatmullRom Splines". In the article they detail a recursive approach to evaluate a CR spline. Representing it this way allows for curve parameters to be added (thus making it NonUniform), altering the trajectory of the curve (similar to the Tension parameter in a Cardinal or Kochanek Bartels spline). I'm in the process of translating the formula but it's usually harder than it looks. Has anyone implemented this? How much faster is it? Is the algorithm available in C++ form? Thanks in advance. CRD

As jefferytitan notes, you want to have a tolerance that is the cutoff point where you set it to zero. Some energy is lost on impact to friction, etc.

Normal n of surface to calculate impulse
Catmull Dog replied to alterecho's topic in Math and Physics
Ideally, you will use Vertex normals (take a weighted average of the normals of all adjacent triangles sharing the vertex at that point). This is easier to calculate if the surface is on a regular grid. For polygon soup you may not know all of the triangles that share that vertex. If it is as a parametric surface, the normal at u,v is (basically) the cross product of the vectors: (u,v)>(u+delta,v) and (u,v)>(u,v+delta) where delta is the tolerance, normally based on the surface sample resolution. But for starters, just use the polygon normal (normalized cross product of two edges of the nearest triangle). 
Modifying Catmull Rom to Add Centripetal Parameterization
Catmull Dog posted a topic in Math and Physics
Greetings. While Catmull Rom splines have the nice property of going through the control points and are "continuous enough" for most applications, they sometimes behave unpredictably. Namely, the points of highest curvature on the resulting curve are not always where the control points lie. A solution for this is to use what is called Centripetal Parameterization which focuses more sampled points on the highest areas of curvature (the term derives from the way a car would slow down when navigating sharp turns, unless driven by this guy). The general idea is: t i+1 = t i + P i +1  P i] ^ a // Where (0<= a <=1) (0 is Uniform,.5 is Centripetal and 1 is Chordal). Note: This is a different type of parameterization than Chord length reparameterization (see attached slide showing adjusting the number of points between spans without altering the curve itself). Centripetal alters the trajectory of the curve, similar to the way a Kochanek Bartels spline applies Tension, but unique. There are many articles on this subject. Two of the best I found are Parameterization and Applications of CatmullRom Curvesand the original E T Y Lee article Choosing nodes in parametric curve interpolation, but they don't seem to explain in layman terms how to go about modifying an existing CR algorithm to make the required changes (ideally there would be an adjustable alpha to blend from Uniform (a=0) to Centripetal (a=.5) to Chordal (a=1.0), but I'm not sure if that refers to blending the results of two functions or if the alpha value really plugs in (it is raised to the power of a so it's square root for Centripetal). Question: Does anyone have the actual CR algorithm that implements Centripetal Parameterization? How different from the original CR algorithm is it and how much does it cost? With KB splines it's only a few lines difference, but not something you could improvise without a math Ph. D. Thanks in advance! CRD

Advertisement