• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

157 Neutral

1 Follower

About jonwil

  • Rank

Personal Information

  • Interests
  1. Ok so I need to create a second IDXGISwapChain pointing at my second window, obtain the ID3D11Texture2D from that swap chain via GetBuffer, hook that up to an ID3D11RenderTargetView and then call OMSetRenderTargets with that new render target view on my ID3D11DeviceContext before I render stuff?
  2. I have some code (not written by me) that is creating a window to draw stuff into using these: CreateDXGIFactory1 to create an IDXGIFactory1 dxgi_factory->CreateSwapChain to create an IDXGISwapChain D3D11CreateDevice to create an ID3D11Device and an ID3D11DeviceContext Other code (that I dont quite understand) that creates various IDXGIAdapter1 and IDXGIOutput instances Still other code (that I dont quite understand) that is creating some ID3D11RenderTargetView and ID3D11DepthStencilView instances and is doing something with those as well (possibly loading them into the graphics context somewhere although I cant quite see where) What I want to do is to create a second window and draw stuff to that as well as to the main window (all drawing would happen on the one thread with all the drawing to the sub-window happening in one block and outside of any rendering being done to the main window). Do I need to create a second IDXGISwapChain for my new window? Do I need to create a second ID3D11Device or different IDXGIAdapter1 and IDXGIOutput interfaces? How do I tell Direct3D which window I want to render to? Are there particular d3d11 functions I should be looking for that are involved in this? I am good with Direct3D9 but this is the first time I am working with Direct3D11 (and the guy who wrote the code has left our team so I cant ask him for help
  3. I am writing a level editor using Visual C++ and the win32 API. I have the game engine going working fine with Direct3D 11 (its not an off-the-shelf engine, its custom) The plan for the editor is to have something like this: The blue bit is going to be a standard win32 menu bar, the yellow bit will be a standard win32 status bar, the red bit will contain things like a list of objects to insert into the level (its contents will change depending on what the user is doing) and the purple bit will be a window that will be rendered into by the rendering code. I know how to do Direct3D11 rendering into a window that is the parent window and is the only thing the app is drawing (the engine runs a loop that lets the windows message loop run and process its messages before running the engine code and doing rendering) but I can't find anything out there on how you do Direct3D graphics (11 or otherwise) into a child window and how you handle things like resizing and painting and things. Its definitely possible since so many level editors and things do it but I dont know how they pull it off. (and Google isn't showing anything useful either) Are there any examples out there of how you can create a win32 custom control/child window, set up a IDirect3D11Device to draw onto that window and then have that window play nice with all the other windows (the main parent window and the other child windows) whilst still triggering a once-per-frame render call to allow me to draw my stuff in there.
  4. Matrix math help wanted

    Thanks, that's exactly what I needed to know.
  5. Matrix math help wanted

    After some further analysis I see that the actual result of calling this Inverse function on the "base" matrix is this 0.0, 1.0, 0.0 0.0, 0.0, 1.0 1.0, 0.0, 0.0 -0.86644721, 0.29698506, -0.00000071708286 which looks a lot more like the inverse of the base matrix given above 0.0, 0.0, 1.0 1.0, 0.0, 0.0 0.0, 1.0, 0.0 -0.29698506, 0.00000071708286, 0.86644721 So given the matrices "base", "inverse" and "m2" and the already mentioned calculations for how m2 is calculated from "inverse" and "anim", what math do I need to do to get "anim"? (or as close as possible allowing for FPU precision loss)
  6. Matrix math help wanted

    Based on the "operatior*" code above it looks like its doing something other than a conventional matrix multiplication given that its definitely working with a pair of matricies both defined as float m[4][3]; I suspect the "inverse" code (which I dont have) is probably not doing a bog standard matrix inverse either. Might need to dig deeper into that one as well and see just what its really doing. Then once I have that, maybe I can figure out some way to get the information I need given the inputs I have and the knowledge of the workings of both the operator* and Inverse functions.
  7. Matrix math help wanted

    As it happens the code that sets "inverse" happens to be set by calling Inverse on another different matrix. So we have 4 matrices: (a complete set of 4 matrices is given below as an example) base 0.0, 0.0, 1.0 1.0, 0.0, 0.0 0.0, 1.0, 0.0 -0.29698506, 0.00000071708286, 0.86644721 inverse 1.0, 0.00000011920929, 0.00000023841858 -0.00000011920929, 1.0, 0.0 -0.00000023841858, 0.0, 1.0 -0.86644721, 0.29698506, 0.1759115 anim 0.00000011920929, 0.00000023841858, 1.0 1.0, 0.0, -0.00000011920929 0.0, 1.0, -0.00000023841858 -0.000000010647835, 0.17591222, -0.000000013998365 m2 1.0, 0.00000011920929, 0.00000023841858 -0.00000011920929, 1.0, 0.0 -0.00000023841858, 0.0, 1.0 -0.86644721, 0.29698506, 0.1759115 Given that I have base, inverse (which looks like its an inverse of "base" although I cant be sure that the function called "Inverse" (the source code of which I dont have access to) is actually doing what it says and m2, what exactly is the formula for getting anim? (or as close to it as the floating point precision limitations allow)
  8. Matrix math help wanted

    I have the following fragments of code: (obviously there is more to the Matrix3 class, this is just the bits that are relavent) class Matrix3 { float m[4][3]; Matrix3 operator*(const Matrix3&) const; }; Matrix3 Matrix3::operator*(const Matrix3 &m2) const { Matrix3 ret; ret.m[0][0] = this->m[0][0] * m2.m[0][0] + this->m[0][1] * m2.m[1][0] + this->m[0][2] * m2.m[2][0]; ret.m[1][0] = this->m[1][0] * m2.m[0][0] + this->m[1][1] * m2.m[1][0] + this->m[1][2] * m2.m[2][0]; ret.m[2][0] = this->m[2][0] * m2.m[0][0] + this->m[2][1] * m2.m[1][0] + this->m[2][2] * m2.m[2][0]; ret.m[3][0] = m2.m[0][0] * this->m[3][0] + m2.m[1][0] * this->m[3][1] + m2.m[2][0] * this->m[3][2] + m2.m[3][0]; ret.m[0][1] = this->m[0][0] * m2.m[0][1] + this->m[0][1] * m2.m[1][1] + this->m[0][2] * m2.m[2][1]; ret.m[1][1] = this->m[1][0] * m2.m[0][1] + this->m[1][1] * m2.m[1][1] + this->m[1][2] * m2.m[2][1]; ret.m[2][1] = this->m[2][0] * m2.m[0][1] + this->m[2][1] * m2.m[1][1] + this->m[2][2] * m2.m[2][1]; ret.m[3][1] = m2.m[0][1] * this->m[3][0] + m2.m[1][1] * this->m[3][1] + m2.m[2][1] * this->m[3][2] + m2.m[3][1]; ret.m[0][2] = this->m[0][0] * m2.m[0][2] + this->m[0][1] * m2.m[1][2] + this->m[0][2] * m2.m[2][2]; ret.m[1][2] = this->m[1][0] * m2.m[0][2] + this->m[1][1] * m2.m[1][2] + this->m[1][2] * m2.m[2][2]; ret.m[2][2] = this->m[2][0] * m2.m[0][2] + this->m[2][1] * m2.m[1][2] + this->m[2][2] * m2.m[2][2]; ret.m[3][2] = m2.m[2][2] * this->m[3][2] + m2.m[1][2] * this->m[3][1] + m2.m[0][2] * this->m[3][0] + m2.m[3][2]; return ret; } Then I have code that does this as part of an exporter to a custom file format: Matrix3 anim = //blah Matrix3 inverse = //blah Matrix3 m2 = anim * inverse; Ignore the //blah bits, they are just giving both anim and inverse some values (how they do that doesn't matter). I am writing an importer for this file format that does the opposite of the exporter and as part of that I am able to produce the "inverse" matrix and the "m2" matrix but not the "anim" matrix. Given the "inverse" and "m2" matrices and the above multiplication operator code, is it possible to write a function that can recover the "anim" matrix and what should that function look like? And no there are no functions in the Matrix3 class that look to be useful for this.
  9. Inverse square law for sound falloff

    Ok so we have a test map with a sound that has a max value of 15 (where it starts getting quieter) and a min value of 30 (where it stops completly) http://www.wolframalpha.com/input/?i=Plot[%28%28d+-+30%29+%2F+%2815+-+30%29%29,+{d,+15,+30}] is a graph of linear falloff and http://www.wolframalpha.com/input/?i=Plot[%28%28d+-+30%29+%2F+%2815+-+30%29%29+^+2,+{d,+15,+30}] is a graph of logarithmic falloff. Which one would sound more like real life would sound? (this is an FPS game btw)   Guessing that the 1/r mentioned by Aressera matches the "linear falloff" graph.
  10. Our sound engine has a "falloff" function. (used to make the sound get quieter as the listener moves away from the sound) The relavent inputs we have in this function are: distance (the distance from the sound to the listener) min (the distance from the sound at which it starts getting quieter) max (the distance from the sound at which it goes silent)   The function returns a float value between 0.0 and 1.0 with 1.0 meaning full volume and 0 meaning silent.   If the distance is less than min, we want the function to return 1.0. If the distance is greater than max, we want the function to return 0.0 (these 2 things are working)   What we want to happen if the distance is between min and max is that every time the distance between the listener and the sound is doubled, the volume falloff number is halved (so if the min distance is 1 then at a distance of 2 the return would be 0.50, at 4 it would be 0.25, at 8 it would be 12.5 etc). Can anyone help me with the math for this?  
  11. Its technically a modification of an existing engine but its not an engine thats in any kind of use (I am the lead developer on a huge code modification/rewrite for the game Command & Conquer Renegade which used a custom engine called W3D and physics/engine code that only ever got used for that game) so for all intents and purposes its totally new code.   Oh and no the source code was never released, this code modification is done via a boatload of reverse engineering and C++ work and stuff (so we patch into the engine so it calls our new code where we need it to and we call back into the engine where we need to)
  12. Any examples out there of how to do an IK solver for leg movement? Procedural animation is exactly what we want (i.e. something that generates correct rotation/translation positions for a foot bone, knee bone etc based on the forwrads/backwards movement of the vheicle)
  13. Yeah we dont want a full physics simulation for these legs, we just want math to make them move realistically.
  14. We have a number of vehicles that have legs and right now we treat these walkers as tanks with invisible treads/wheels and animate the legs through a mess of code and a pair of "walk forward" and "walk backward" animations. We want to improve this so the legs can be made to move move fluidly and accurately regardless of what direction the vehicle is moving.   Is there any information or info out there on the math/physics/animation stuff for walkers/mecha/vehicles with legs and how to make the legs animate realistically? We have 4-legged walkers (that move somewhat similarly to the AT-AT in Star Wars) and 2-legged walkers (that move somewhat similarly to the AT-ST in Star Wars) plus smaller walkers that move like spiders.  
  15. Looking for help with aab/tri collision

    Ugh, a PhD thesis. Seen enough of those in my time to know that actually turning whatever ideas, formulas and equasions they have in them into actual usable practial code is a real pain in the butt...
  • Advertisement