angelmu88

Members
  • Content count

    74
  • Joined

  • Last visited

Community Reputation

228 Neutral

About angelmu88

  • Rank
    Member
  1. Rain droplets technique

      Thank you all for your replies. Actually that blood algorithm is better than it seems. If I modify a bit the physics to take not only into account the gravity but also other forces like the wind and I store the resultant force instead of storing only the gravitational force I think I can get something quite good.   Thanks, again.
  2. Rain droplets technique

      Is it texture masking enough when it comes to simulate the meandering of the drop? I want it to be as realistic as possible so I don't want the drops to go down following a straight path, in this case, the drop would have to follow this pre-baked random path no?     Also if you look at the first video, see how the drops are affected by the movement of the camera
  3. Rain droplets technique

      Is it texture masking enough when it comes to simulate the meandering of the drop? I want it to be as realistic as possible so I don't want the drops to go down following a straight path, in this case, the drop would have to follow this pre-baked random path no?
  4. Hi,   I have to implement an effect for simulating raindrops on a window and although I've found a lot information on how to implement a particle system for that purpose, like the great Kaneda articles (e.g. Animation of Water Droplets Moving Down a Surface), I'm still looking for a good technique for the droplets.   Take a look at this video:   http://www.youtube.com/watch?v=lbG0zIndeyE   or this other one:   http://www.youtube.com/watch?v=KO5KKqwCyos   Do you think they are using a expensive technique such as Metaballs or something much simpler?   Thanks
  5. Billboard problem

    [quote name='KurtO' timestamp='1351355642' post='4994449'] Hi, i am using this method for my billboarding. But it seems that i can only set my billboards at position(0,0,0) otherwise it displays incorrcect. I have tried to translate before and after but nothing works. How can i set any other position than origin? this is my method: [source lang="cpp"]void CreateBillboardMatrix(const D3DXVECTOR3& particlePos, const D3DXVECTOR3& cameraPos, D3DXMATRIX& out) { // compute billboard basis D3DXVECTOR3 look = particlePos; look = look - cameraPos; D3DXVec3Normalize(&look,&look); const D3DXVECTOR3 CAMERA_UP_VECTOR(0, 1, 0); D3DXVECTOR3 camUp = CAMERA_UP_VECTOR; D3DXVec3Normalize(&camUp,&camUp); D3DXVECTOR3 right; D3DXVec3Cross(&right,&camUp,&look); D3DXVec3Normalize(&right,&right); D3DXVECTOR3 up; D3DXVec3Cross(&up,&look,&right); D3DXVec3Normalize(&up,&up); // set matrix values D3DXMatrixIdentity(&out); out._11 = right.x; out._12 = right.y; out._13 = right.z; out._21 = up.x; out._22 = up.y; out._23 = up.z; out._31 = look.x; out._32 = look.y; out._33 = look.z; out._41 = particlePos.x; out._42 = particlePos.y; out._43 = particlePos.z; }[/source] [/quote] I see an error in your code, the look vector is CameraPos-billboardPos (not the other way around). Take into acount that if you have two positions A and B the vector B-A is facing B.
  6. My question is if I can compile D3D11 code on a laptop with a D3D10 compatible graphic card using D3D_FEATURE_LEVEL_10_0. Or if it doesn't matter if I select D3D_FEATURE_LEVEL_10_0 and I need to compile the program on a computer with a D3D11 compatible graphic card. Thanks
  7. I'm glad you solved it. I'm sorry but I don't know much about using two monitors.
  8. [quote name='Dbowler92' timestamp='1347195175' post='4978287'] So I have done some testing... Where I clear my back buffer, I changed the code to: [source lang="cpp"] d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(100,100,100), 1.0f, 0);[/source] Which gives a nice grey background. However, in full screen... I still see a black background - this must be where my issues lie? [/quote] Do you call device->Present() after drawing the scene. Your main Drawing method should look like this: dd3dDevice->BeginScene(); //Here you draws all your textures dd3dDevice->EndScene(); dd3dDevice->Present(0, 0, 0, 0); When you're drawing in D3D you're drawing into something called back buffer. If you want to show the back buffer content on your screen you have to call the Present() method so that the buffer that is currently displaying swaps with the backbuffer. As you point out, if you clear the backbuffer that way you shoud see a Grey Screen, not a black one, so the problem has probably nothing to do with your textures.
  9. [quote name='Dbowler92' timestamp='1347189347' post='4978258'] One last question regarding full screen mode... My Textures and such render perfectly happily in Windowed mode - yet in full screen mode, they dont render at all... :S Any ideas?? (The same applies even if I start the game in full screen mode and then Alt+Enter to windowed mode where the textures appear again) [/quote] Can you post your drawing texture code. The only thing I can think of without seeing the code is that you might be using invalid coordinates, i.e, if the texture rendering method is something like this: drawTextures(originX, originY, sizeX, sizeY) (originX +sizeX) is out of the window. Anyway, is this only happening with textures or is it happening also with 3d models?
  10. Hi I'll try to answer your question [quote name='Dbowler92' timestamp='1347171217' post='4978190'] I have read that I need to change the D3DPRESENT PARAMS and call Reset() via the Direct3D Device object... But this blew up my game and im not sure why. [/quote] That's true you have to call Reset(), but you have to keep some things in mind. Take a look at my enableFullScreen() function: [source lang="cpp"]void D3DApp::enableFullScreenMode() { // Are we already in fullscreen mode? if( !md3dPP.Windowed ) return; int width = GetSystemMetrics(SM_CXSCREEN); int height = GetSystemMetrics(SM_CYSCREEN); md3dPP.BackBufferFormat = D3DFMT_X8R8G8B8; md3dPP.BackBufferWidth = width; md3dPP.BackBufferHeight = height; md3dPP.Windowed = false; // Reset the device with the changes. onLostDevice(); HR(gd3dDevice->Reset(&md3dPP)); onResetDevice(); }[/source] md3dPP is a D3DPRESENT_PARAMETERS (like the one you use to create the device). Notice that before calling device->Reset() I call a method named onLostDevice() and after calling device->Reset() I call onResetDevice(). What onLostDevice() does is to prepare all your game assets (textures, meshes, etc) for a device resetting, for instance, any D3DAsset has to placed in what is called a memory pool, let's say you create a texture and you specify you're going to use de D3DPOOL_DEFAULT, in that case, objects placed in that pool need to be destroyed before calling device->Reset() and reinitialized after that. Some other objects like dynamic renderTargets need to be destroyed too. I suppose that's why you're game is crashing when you call Reset(), because you're not taking this into account. (In the previous example you can place your texture in the D3DPOOL_MANAGED so that you don't have to destroy the texture) [quote name='Dbowler92' timestamp='1347171217' post='4978190'] How do you guys handle rendering? For example, say my window is of size 1024 by 768. Lets say I render my Texture (with the transformation matrix) at point 1024, 768 (centred) - This obviously renders right at the bottom right of the screen... but lets say the user changes the resolution settings to 1920 by 1080. That image is no longer rendered at the bottom right of the screen [/quote] That's true, for 2D objects you have to take into account the window size when you're rendering them, so if you were drawing your texture like this: texture->Draw(0,0,1024,768) Now you have to draw like this: texture->Draw(0,0,1920,1080) (The same goes with other 2D objects like plain Text) For 3D objects you don't have to worry, the only thing you have to know is that when you change to a higher resolution you're going to see more things of your scene, i.e, your field of view is going to change to a bigger one (usually you specify a vertical field of view, so It's the horizontal field of view that changes).
  11. [quote name='phantom' timestamp='1346592597' post='4975720'] You'd only have to get a function pointer for creating the Renderer; after that you use the returned pointer as normal. The cost is going to be no worse than a non-inlined function call at that point. 1. Decide which DLL to load 2. Load DLL 3. Get pointer to creation function 4. Use creation function to create renderer 5. Use returned object pointer as normal No mess, no fuss. [/quote] I got it. Thank you very much!
  12. [quote name='L. Spiro' timestamp='1346588330' post='4975704'] Actually the .EXE will only have branches for which DLL to load. Both DLL’s probably expose the same classes, so the EXE is more likely to just do a check on the input flags and branch for just the DLL, followed by something like: [CODE]Render * prRenderer = new Renderer();[/CODE] L. Spiro [/quote] what would be the code for that flag-based branching? I can't figure it out without using LoadLibrary, and I don't like LoadLibrary because then you have to get pointers to every function you use (In addition there's overhead when calling through a function pointer).
  13. [quote name='L. Spiro' timestamp='1346579761' post='4975676'] They are using #ifdef. One build compiles to a DirectX 9.0 .DLL, another to a DirectX 11 .DLL. The .EXE has no idea what DirectX is and is not linking to either of them. The .DLL simply provides an agnostic interface for rendering and the .EXE loads one or the other at run-time based on parameters passed to it. L. Spiro [/quote] Yes, I'm not saying they didn't use #ifdef to create the dlls, what I say is that the .exe does something similar to the code I posted (the .exe doesn't use #ifdef).
  14. [quote] Hi i think they use one interface for their rendering system and derive renderers from this interface. It's really clean and easy solution, you can also switch between renderers at runtime. And about virtual method overhead -> don't bother unless you have milions of calls per frame [/quote] Yes. I agree with you. I think they have a Renderer Interface and they store the derived renderers in CryRenderD3D9.dll and CryRenderD3D11.dll. I also think when you start the game, depending on the renderer selected, they do something like this: [source lang="cpp"] #include "CryRenderD3D9.h" #include "CryRenderD3D11.h" Renderer* renderer; if(D3D11enabled) renderer = new D3D11Renderer(); else renderer = new D3D9Renderer(); [/source] On second thought this is not completely dynamic because you have to reset the App every time you change the renderer but you don't need two .exe files like in the #ifdef approach. I think Crysis 2 does something similar because if you change the renderer in the Crysis 2 option menu you have to reset the game.
  15. [quote name='hupsilardee' timestamp='1346521721' post='4975489'] [quote name='angelmu88' timestamp='1346515907' post='4975466'] [quote name='Hodgman' timestamp='1346514567' post='4975460'] [quote name='angelmu88' timestamp='1346511579' post='4975439'] In most cases I tried to create a hierarchical model, so I have classes that interacts directly with D3D (basic classes) and classes that only use those basic classes and do not interact with D3D. is that what you mean? [/quote]Yes that's what I meant. So, the lower level of your hierarchy, which deals directly with D3D9, will have to be entirely re-written [img]http://public.gamedev.net//public/style_emoticons/default/sad.png[/img] Large parts of it may be similar in the D3D11 rewrite, but none of it will likely be reusable without modification. I would recommend separating your D3D9 and D3D11 code via [font=courier new,courier,monospace]#ifdef[/font]s, and only compiling for one at a time ([i]which means you've got two different EXEs - one for people on WinXP, and one for people on Win7[/i]). However, you could alternatively make your "wrapper" into abstract-base-classes with virtual methods if that's more attractive to you. [/quote] The good thing about the second option (virtual methods) is that I only have one .exe and I can decide wheter I use D3D9 or D3D11 at run-time, isn't it? Actually I was looking in the Crysis 2 installation folder (Crysis 2 let you use both D3D9 and D3D11) and I found only one .exe(Crysis2.exe) and two dll's :one for D3D9 (CryRenderD3D9.dll) and another for D3D11(CryRenderD3D11.dll); So I supose they're using something similar to the "virtual method approach". Am I right? [/quote] Actually if ou think about it, this means they used the #ifdef approach, because there are 2 different DLLs. I expect this is because there is overhead with virtual functions (very very small), and they want their graphics to run as quickly as possible [/quote] But #ifdef is a preprocessor directive, that means you have to recompile every time you change from D3D9 to D3D11 (or from D3D11 to D3D9). You could aslo have two .exe files but as I said there's only one .exe and I don't think they recompile every time you enable or disable D3D11 in the options menu. Maybe there's another option I'm missing.