Programmer101

Members
  • Content count

    448
  • Joined

  • Last visited

Community Reputation

199 Neutral

About Programmer101

  • Rank
    Member
  1. World Position

    It looks like you multiplied Position by the world/view/projection and then again by the world matrix to get WorldPos. If you switch the order of statements in your vertex shader, that should help: void mainVS(inout float4 Position : POSITION, out float3 WorldPos : TEXCOORD0) { WorldPos = mul(Position, WorldXf).xyz; Position = mul(Position, WorldViewProjXf); }
  2. problems about sampling tech

    The reason you want to use different sample sets is the same as the reason that you would jitter samples in the first place. Using different sets eliminates repeating patterns in the render. Look at the figure on the next page for a better description of the problem (fig 5.6).
  3. Confusing implementing gravity and Newton's Third Law

    It's called the normal force. Is object B static or a free body? If it is static, it applies a force on object A equal to object A's weight force, a normal force. This way they cancel. If object B is a free body, you would just add the weight force from object A to the net force on object B. There are a lot of things that you have to account for, but essentially when a character jumps onto an object you have a collision. Usually this is treated as an inelastic collision, meaning that the character doesn't "bounce" and his/her velocity is set to 0. So, as I said above, what you do depends on the type of object that he lands on. Say the character lands on a floor. In a game level, this would be static, because usually floors don't move. In this case, you would just have a normal force exerted on the character that is equal to his weight force so he has no acceleration. Say he lands on a crate that is sitting on the floor. Now you can think of the crate and the player as a single weight force acting on the floor. So the floor has a single normal force on the crate that cancels all of the weight. There's a lot to think about, and writing an accurate physics engine is a difficult task. I hope this helps at least some.
  4. Best way to store array of pixel

    That's how I do it, so I don't know why you would be getting an error. It works fine for me. You could always try to put it into a single dimensional array with the size width*height, but I really don't think that there should be a problem with the way you are doing it now because c actually makes multidimensional arrays single dimensional. Can you post the actual error? Also, how are you declaring the array? Have you tried malloc?
  5. Fluid Dynamics Simulation

    Suppose I wanted to create a fluid dynamics plug-in for a program like Maya. I understand the basics of 2D fluid dynamics using a grid model, but I'm wondering how I use this to simulate cool effects like you see in movies of oceans. I guess that for an ocean you would just use a heightmap that takes values from the desity value in the fluid grid. My real question, however; is on simulating free moving water. By this I mean simulating rain drops, splashes, and fluid that fills a volume such as a glass, bucket, or bowl. I know it can be done, because there are plugins for maya that already do this, but I just can't fathom how. Thanks.
  6. DX audio in dev-c++

    Quote:Original post by pbjgame I have tried either of these resources before. I still havn't figured out the syntax for reimp.exe, so I can't convert the lib files. But actually, I have gotten throug the first 8 chapters with very few problems. I'm just having a problem with dsutil.cpp right now I'm pretty sure. Well congrats, you made it a lot further than I did. As for your output. The first one shouldn't be much on an issue because it's just a warning and I'm guessing appropriate values are assigned to the DWORDs elsewhere. I remember getting that second one. I think it has to do with declaring the variable i from within the for command. If I remember correctly, if you declare I prior to the loop, it might fix it. Of course my advice is that you just use visual studio. It will compile correctly and you will spend less time with these sorts of problems. It's also more up to date with c++ standards. But we already have enough IDE wars on this site, I don't need to be starting a new one [looksaround].
  7. Two questions regarding DirectX Meshes

    Quote:Original post by Yeshua666 Yeah I used the TFACTOR method and it works. It just seems like a hack to me though. I wish I could just change the mesh's vertex's alpha value directly. You can't really change the vertex alpha value without modifying the vertex buffer, which is probably too much trouble. I would, however, recommend that you just modify the alpha values in your mesh. You change the last component of each of the first 4-float values in each material to whatever alpha value that you want. To render it, you just turn the alphablendenable render state to true.
  8. DX audio in dev-c++

    I purchased this book while using dev-cpp and was never able to get the samples to work. To my knowledge, the dev-cpp compiler can't handle standard directx libraries. I know, as one of your errors suggests, that dev seemed to have a problem with some windows include files and DWORDS in particular. Things may have changed since I last used it, but all I can remember were loads of problems trying to get dev working with directx. There is a tutorial on nexe that might help you, and there is a dev-pack that you might try EDIT: I was also a n00b when I was trying to do this last, so my words may carry no value [lol]
  9. HDL Lighting and Plain Lighting ---

    With HDR, light and material color values can be more than 1.0. The scene is rendered to a floating point buffer which is designed to hold this extra information, then the colors are scaled to be within 0.5 of the average luminance value, thus enabling you to render it to the screen which only supports values up to 1.0. This is done to simulate the human eye and cameras for more realistic scenes because your eye and cameras also adjust to light like this.
  10. [4E6] Conclusion

    Quote:Original post by BeastX For future contests, I'd recommend the following: -Extend the contest to a full year, or 6 months, and have them back to back. -Announce new elements the day the previous contest ends. -Announce and commit to submission dates up front. -Announce and commit to judging dates up front. -Announce base prizes up front. -Set a higher bar for minimum game requirements to balance entries. I definitely agree with an extension and committing to dates, but there are reasons that it's not like that. The mods on the site aren't full time gamedev moderators, so they can't really commit to certain dates because they probably have jobs or school. The same goes for most of the entrants. As for the extension, it's nice but I kind of think that people may lose interest after a year. You are right, and I think that the contest would be more popular, and more widely known if people could make these commitments. Of course there are things that could be done to make the contest better, and I think that they should work on that, but after all, I don't think they get paid much, if at all to run this contest. On another note, I think the contest was pretty cool. I only wish I had finished.
  11. Float comparison issue

    Yeah, I only changed the first value in the min function so that the output should always be the same. Originally it was 1.0f, but when I noticed it wasn't functioning, I changed it to 0.0f. Unfortunately, this line does not always evaluate to 0.2f like it should.
  12. Float comparison issue

    I'm sure that there is something that I am doing wrong here because this makes absolutely no sense. I'm trying to use the c max and min functions to keep a number in a certain range but they don't seem to be working. Here is the line of code: float lighting = max(0.0f, min(0.0f, pNormal.dot(&lights[0].direction))) + 0.2f; The problem is that lighting does not always evaluate to 0.2f which it should (right?). It comes out as a value less than or equal to zero sometimes. I found ou that if I don't use the pNormal.dot() for the second argument in the min function, the statement works as expected. This is weird because the dot method is: float dot(stewVector *other) { return X * other->X + Y * other->Y + Z * other->Z; } where X, Y, and Z are floats so the method should return a float. Why isn't this working? Thanks.
  13. 3d Space to Screen Space, Projection Matrix

    Alright, thanks for the info. I guess that means I should choose one or the other. I guess because it must be more common, I'll go with the column major matrices. I didn't post the device coordinate conversion but I am converting. Even when I do convert though the triangle is too small to come up on the screen. These are "normalized device coordinates": (-.0009, 0, 0.758, 1);(0.0009, 0, 0.758, 1);(0, 0.0009, 0.757, 1) even when I convert them to pixels the x and y coordinates are less than 1. This must be wrong because the triangle is only 4 units from the camera, and the far clip in my projection matrix is supposed to be 100 units. Does anyone have any information on creating projection matrices? Any websites you know of? Thanks a lot.
  14. Hello everyone. I'm trying to write a 3D renderer without any API. I have a program that can draw and fill 2d triangles and I'm working on 3D triangles but I'm a having problems. The issue is that the 3d polygon never appears projected correctly. After being transformed it is so small that it doesn't even show up. I think the problem is in my projection matrix but I can't be sure. I looked at a wikipeia article on rasterization and microsoft's white paper on 3d transforms. These gave different ways to create a projection matrix and even different ways to multiply a 3d vector by a matrix. Currently my projection matrix is like this: So my matrix ends up like this: 0.0039, 0 , 0 , 0 , 0 , 0.0039, 0, , 0 , 0 , 0 , 1.01 , 1 , 0 , 0 , -1.01, 0 The coordinates are: (-1, 0, -1, 1);(1, 0, -1, 1);(0, 1, -1, 1) First I multiply by the view matrix and get (-1, 0, 4, 0);(1, 0, 4, 2);(0, 1, 4, 1) Then I multiply by the projection matrix where I think it goes wrong: (-.0039, 0, 3.03, 3.996);(0.0039, 0, 3.03, 4.003);(0, 0.0039, 3.03, 4) Then I divide by the 4th value to make the vectors homogeneous: (-.0009, 0, 0.758, 1);(0.0009, 0, 0.758, 1);(0, 0.0009, 0.757, 1) Then I transform the coordinates to pixels and draw the triangle. As you can probably see, however, the coordinates found with my previous transforms are too small to even be seen on the screen. What am I doing wrong? Please help.
  15. Overloading a function

    You forgot to put the second drawLine in the "Graphics" scope. You need it to be void Graphics::drawLine( int x, int y, double length, double angle, Uint8 r, Uint8 g, Uint8 b, float thickness )