coder0xff

Members
  • Content count

    101
  • Joined

  • Last visited

Community Reputation

225 Neutral

About coder0xff

  • Rank
    Member
  1. Here's what I'd try if I had all the time in the world: A post-process effect using the depth buffer and a couple specialized shaders. Use du/dv mapping techniques to create lots of little lenses. Raindrops aren't grey. They're refractive. More descriptively, think of it as a volume that scatter's light. For any one pixel (or group of neighboring pixels) you might be getting light from some location that you would have not otherwise gotten if not for the presence of one or many raindrops.   I'd start with an image of some truncated simplex noise, or something similar, to get some sparse islands of soft-edged white in a sea of mostly black. The islands are representative of rain drops, so it should look like a cross section of rain I guess. Next, use a tool to create a normal map (http://wiki.splashdamage.com/index.php/Bump_Maps)   After rendering all other elements of your scene, use the depth buffer to create a linearized depth map.   For each post-processed pixel, two sources will contribute to the resulting color: A heavily downsampled and blurred version of the un-processed image, to get the average color of swaths of it. This provides the "grey"-ish fog. Sampled texels from the pre-processed image that are distorted using the normal map you made (using du/dv mapping techniques) If the pixel is distant, you rely entirely on #1. If it's very near, you use #2. Everywhere in between, interpolate to your preference. Also, as you get nearer, the magnification of the normal map should increase. Some distant raindrops should only get one texel from one normal map island bending it. Up closer, you may want to bend entire neighborhoods of pixels in approximately the same direction by having the normal map heavily magnified (from the point of view of the viewpoint)   Draw the new color value. Also, write a new linear depth value that's slightly nearer to the viewpoint (this can/should be tweaked, and perhaps even somewhat random). You've now completed one layer of rain - that is the farthest layer.   Perform the process again on your new color and linear-depth buffers. Executing the process multiple times will do something sort of like a numeric integration of the effects of rain over the volume of your scene. Of course, it's strictly screen space. You can tweak the number of iterations, just make sure that you get to the nearest layer of rain before you are done, otherwise, it'll look like there's only rain in the distance. So, bigger depth steps means fewer passes, and probably less accuracy.   If you want to improve the effect a little bit, stretch the normal map in the vertical axis (even tilt it a little). The hope is that it will kinda have an anisotropic effect, like what you see here: http://farm5.static.flickr.com/4113/4832069088_f5098a6661.jpg   The drops to the side of the headlight reflect more water because they spend more time in a location that will refract light to you during the course of a single exposure (in camera jargon). This might help provide the illusion of movement.   Anyway, I just made this up so I don't know if it will be performant, or perhaps it will just look disgusting and not work at all. Try it at your own risk. xD   Edit: Might work better to do layers as exponentially larger ranges of depth, and working towards the camera. If you have near drops rendered before far drops, you might get contributions from the near drops being included in the far drops, which would be odd. Also, since the downsampled "grey fog" image is supposed to be representative of many raindrops over many layers, distant layers should be pretty thick. Only close up do you want to start having a nice array of layers with discrete visible drops.
  2. When a numeric value appears above an opponent for the amount of damage you've done, and floats up slowly while fading out. Or when you gain XP, or earn money, or a myriad of other things. Is there a common name for this floating value thingy?
  3. I'm a professional developer, but I find myself in a position where I'm using technologies, APIs, and languages that I have little experience with. Though I'm excited about the project, I'm honestly kind of dreading it. My project is a substantial one, and I'd like to do it right the first time. Are there any tips or tricks to help avoid making poor architectural and coding decisions, so I can avoid having to go back and redo things once I figure out the "proper way"? I have no problem with reading documentation and reference material, but it only gets you so far.
  4. http://www.codeguru.com/cpp/misc/misc/math/article.php/c10123
  5. Do you want to know the net force exerted on a point by two nearby magnets, or do you need to know the force between the two magnets? Your wording is kinda confusing.
  6. Sin and Cos are what you need. I'm kinda fuzzy on what each of these variables represents (what's the difference between your hard coded 100 and texture.Width?). Another way: the origin of the sprite should be at its center (since it's mirrored through the origin, I assume)
  7. I've already got a test to determine that the line segment does not intersect with the cube, but now I need to determine the distance. I've got a few ideas, but I'm looking for the fastest known solution. Any suggestions?
  8. assuming that X goes to the side, Y goes forward, and Z goes up [code]float pitchCos = Math.Cos(pitch); Vector3 offset; offset.X = Math.Sin(yaw) * pitchCos; offset.Y = Math.Cos(yaw) * pitchCos; offset.Z = Math.Sin(pitch); Vector3 lookat = offset + cameraPos;[/code]
  9. [code]separation.X = Math.Max(0, separation.X); separation.Y = Math.Max(0, separation.Y); separation.Z = Math.Max(0, separation.Z); distance = Math.Sqrt(separation.X * separation.X + separation.Y * separation.Y + separation.Z * separation.Z)[/code] naturally, if you're going to be doing a simple comparison, it's better to discard the square root, and have something like: [code]if (distanceSquared <= testDistance * testDistance) [/code]
  10. The easiest way: keep track of a yaw variable and pitch variable. When the mouse moves you increase or decrease the yaw or pitch, based on the X and Y movement, respectively. If you can't directly set the angle the camera is rotated to (or you haven't programmed it yet), reply and I'll show you how to compute the new look at coordinates based on yaw and pitch, or you can use the frustum building functions of the graphics library you are using to help you out. (Can you give some more details, please?) If, for some reason, you can't keep track of a yaw and pitch variables yourself (and the camera you are using doesn't let you get or set them) then its possible to take the look at coordinates, compute the current angle, change the angle, and then compute new lookat coords.
  11. Concave collision is usually much slower than convex. 20x slower would not surprise me. You might want to look into something like "inner sphere tree." Unfortunately, pre-computation methods are geared towards static geometry, not skinned/animated models.
  12. New 0.5b version on SourceForge, including bug fixes, and new Min and Max functions. Pretty near to calling it stable.
  13. Check that project properties > Configuration Properties > General > Common Language Runtime Support is set to "No Common Language Runtime Support". If that doesn't work, make sure project properties > Configuration Properties > Librarian > General > Additional Dependencies doesn't have anything it shouldn't (like mscoree.dll). If it's still not working, set the build output to verbose (or something - there may be another option that's more suitable) and see if you can find anything to suggest it's using mscoree.dll Just to be sure that it's actually trying to load mscoree.dll, try downloading dependency walker and run your program from inside it. It'll tell you all the DLL files it's loading.
  14. I just read this whole thread which was very informative, and I'm wondering if there is any new information on this since the thread is more than a year old. Ultimately, I want to use DirectWrite to draw text with SlimDX.Direct11. Unless there's something better now?
  15. Essentially, I want to know the best (fastest) way to perform vector operations in C# (add, sub, dot, cross, etc). I'm using SlimDX. I discovered, using .Net reflector, that SlimDX implements vector operations directly, rather than passing them to DirectX (which is good). But the fact that I see this in the reflector's disassembler window: public static Vector4 Add(Vector4 left, Vector4 right) { Vector4 vector; vector.X = left.X + right.X; vector.Y = left.Y + right.Y; vector.Z = left.Z + right.Z; vector.W = left.W + right.W; return vector; } led me to believe (from experience with VC++/CLI) that the packed-single versions of the SSE instructions aren't used, and it instead does one scalar addition at a time. So I decide to get an actual x86 disassembly, and I'm disappointed to find this: It's not using SSE instructions AT ALL! I have a library that uses packed-single SSE instructions to do the most common ops, and I wrote it using VC++ intrinsic functions. It is, of course, native. Problem here is that switching from .Net to native code incurs overhead (as I've seen from ANTS profiler and in benchmarks). I've heard of SlimGen, and know that it was made by some of the same guys that work on SlimDX. I'm wondering, why doesn't SlimDX use SlimGen to inject (or however it works) SSE packed-single versions of the vector operations? I noticed SlimGen is for .Net 2.0. Is it not possible with .Net 4.0? AND the last question! Unfortunately, most vectors I see in use aren't vec4, but vec3. I can't load/store the whole vec3 into an XMM register with one instruction (or can I?) without going over boundaries (MOVAPS is gonna move 16 bytes, but we only have 12). I'd rather avoid using a bunch of instructions to load and shuffle individual (or pairs of) floating point values. How can I best solve this problem? Convert everything to vec4? Just use scalar instructions? Thanks in advance