Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

157 Neutral

1 Follower

About jonwil

  • Rank

Personal Information

  • Interests

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I filed an issue in the DirectXTex repo asking if DirectXTex can produce data matching the U8V8 format and if so, how. Seems like this might be the way to go (its essentially the "official" replacement for the texture stuff in d3dx9 so one would assume if what I want is possible, DirectXTex would be able to do it)
  2. In this case we need whatever magic d3dx9 does when it converts RGBA data to U8V8 data (which is clearly more than just lopping off 2 channels based on some testing I have done). If DirectXTex can do that same magic conversion, that would be good. Otherwise I will keep looking for some code that can do it :)
  3. We have an engine based on Direct3D11 that uses ID3D11Device::CreateTexture2D to create its textures passing in whatever format we read from the dds file header. We also have a previous version of our engine that uses the DX9 fixed function bump map feature for bump maps. This feature takes bump map textures in U8V8 format as input but it also takes textures in DXT5 and A8R8G8B8 and converts them into U8V8 using D3DXCreateTextureFromFileInMemoryEx in d3dx9). Our current D3D11 engine handles the U8V8 textures just fine (I think it feeds it to CreateTexture2D as DXGI_FORMAT_R8G8_TYPELESS) and has some shader code that emulates the fixed function bump map feature without problems. But now we want to add support for the DXT5 and A8R8G8B8 bump maps. Does anyone know where I can find code for Direct3D11 (or just plain code with no dependence on specific graphics APIs) that can convert the DXT5 or A8R8G8B8 texture data into U8V8 data in the same way as D3DXCreateTextureFromFileInMemoryEx and the other D3DX9 functions would do? (Someone out there must have written some code to convert between different texture formats I am sure, I just can't find it)
  4. I am the lead developer on a D3D11 game (using pixel and vertex shaders) that has water done as a flat mesh with textures on it (we use something similar to bump mapping to produce the water effect as well as scrolling the texture) but we want something better. Are there any tutorials on how to get cool looking water in a game? Particularly I am interested in refraction (whatever it is that lets you see what's under the water but the water obscures/distorts it a bit) and that kind of thing rather than reflection or wave motion.
  5. 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?
  6. 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
  7. 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.
  8. jonwil

    Matrix math help wanted

    Thanks, that's exactly what I needed to know.
  9. jonwil

    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)
  10. jonwil

    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.
  11. jonwil

    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)
  12. jonwil

    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.
  13. jonwil

    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)[%28%28d+-+30%29+%2F+%2815+-+30%29%29,+{d,+15,+30}] is a graph of linear falloff and[%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.
  14. 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?  
  15. 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)
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!