Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About amarhys

  • Rank
  1. Hello everybody, This post to present a Myst-like game I am working on for a long time : Amarhys (sorry for my English, I am French) A long time ago (7 years) I released a first demo, and after a long break of 5 years and 2 years more to improve the visual aspect and the game engine, Amarhys is back with a new demo. The demo is available in French and in English, the player can select the language when starting the game. The main improvments are : - new graphics rendering, with a 360° environment - musics and sounds The game demo is working only under Windows, I'll work later on the Mac version when the final game project is more advanced. To download the new demo (about 115Mo) : Download Amarhys demo For detailed information about installation and for the game demo guide : Amarhys demo guide Do not hesitate to contact me on Amarhys website forum if you have any problems, questions or comments about the demo. Ah yes, I forgot to mention : the goal of this new demo is to get back to the first demo ... I hope you will enjoy it. Cheers Amarhys (Xavier)
  2. For all textures I am using D3DPOOL_MANAGED. Most of my textures (90%) are in DXT3 format. I am still investigating where do the error exactly come from. For sure from one or more DirectX calls in my global render() function. This function is a basic rendering sequence, ie. BeginScene() .. vertex buffer updates ... basic draw primitive .. vertex buffer updates ... basic draw primitive...... EndScene(). All textures are loaded outside this render() function. If I have added check of textures in the render() function, it was just to be sure I am not trying to render a texture which has not been loaded successfully .. but I don't think the problem comes from texture (indeed, when I just ignore the render() call which are failing, the next render() call seems to work fine and the texture are all displayed, any missing ones). I guess the problem is in my render() function, it seems that sometimes DrawPrimitive and/or Vertex buffer updates are not working .. and only with this Lenovo computer with the dynamic management of the video cards. I am still investigating the issue to try to find which D3DX calls are failing. And trying to find if I can do something to avoid this or just have to live with it. Is there something to check before entering BeginScene() -> EndScene() sequence ? I am already checking if the device is lost or not, and call the render() only when the device is ready. Can the device be lost during the BeginScene () -> EndScene() ? Thanks for your help Adam_42. Xavier
  3. Hello, I am working on a Direct3D game (Myst-like) using DirectX9. I have already created a demo and tried it on some computers (one XP, one Vista, 2x Windows 7 and some others) and it worked fine. I tried to install it on a IBM Lenovo machine, a T420 which has 2 embedded video cards (one IBM for low consumption, one NVIDIA for performance). The managing of these two cards is fully tranparant for the users, Windows 7 takes care of switching the cards when needed. Moreover, when I enumarate the available display adapters, only the IBM one is listed (GetAdapterCount() returns 1 - followed by GetAdapterIdentifier() which returns the IBM card description). This is for the context. Now, the demo was not working very well on this Lenovo. Investigating a little bit and debugging the code, I noticed some of the directX calls (most of them during the rendering phase) where not returning D3D_OK (whereas texture are loaded correctly and everything seems fine) and then made the program to crash (because I check all directX calls and display error message and exit when an error is seen - which is working fine on the other computers I tried). I decided not to check the status of DirectX calls during the rendering (I just check, before using a texture for example, that the texture has been correctly loaded, if not, I skip the display of this texture and continue rendering ..) and now everything works fine on the Lenovo. The demo is just running well, no crash any more, and no display artifacts noticeable. Maybe my initial code was too strict, I mean to exit the game with an error when one of the DirectX call has failed (but as I said, working well until Lenovo experience). What is the good practice ? Should I investigate more on the Lenovo or could I accept a rendering procedure whose some DirectX calls are failing .. in any case they will be performed on next calls to rendering function .. which is confirmed because no display artefacts at the end..). Note : before each call to rendering function my code is already checking if the device is lost, and if lost, waits if not ready to be reseted and reset as soon as ready. Thanks in advance for your answer. -amarhys
  4. Hi, I am working on a Myst-like game (i.e. a panoramic scene rendered on a cube + some animations on some parts of the scene). Then it's not a heavy 3D scene . The game can be run either in windowed or full screen mode. Initially I used INTERVAL_ONE presentation method. It works well in windowed mode but I can notice some rendering lags when in full screen mode (animation are not as smooth as they are in windowed mode). I switched to INTERVAL_IMMEDIATE and they is no more rendering lags in full-screen mode. However, rendering is not clean, when moving the mouse - which makes panoramic scene rotate - I can see "horizontal cut" in screen rendering, which is an expected behavior because I am not waiting for vertical sync. However, in windowed mode, the rendering is always clean, no "horizontal cut" in rendering. So here are my questions : 1) I am not an expert in D3D (and more generally in programming) then I think my code is far from being optimized .. but why is there rendering performance difference between windowed and full-screen mode when INTERVAL_ONE presentation is set ? More over, I expected full-screen mode to have better rendering performance than windowed mode, I have the opposite. 2) Why INTERVAL_IMMEDIATE does not create rendering artifact in windowed mode (what I call "horizontal cut") ? In windowed mode, does the OS accept and bufferize ::present calls whatever _ONE or _IMMEDIATE is specified - giving back immediately the hand to my application - and taking care of final presentation synchronous with VSYNC ? This could explain 1) and 2). 3) Is there a "real" difference for a game between full screen mode and windowed mode where the window has the size of full screen and without any border (i.e. visually identical to full screen) Thanks in advance for your answers. amarhys
  5. Thanks for your answer programci_84. I am already using render to texture for other stuffs, I did not think about it but is is a good idea. I am going to try it. Concerning lock - copy -unlock, isn't it runtime consuming ? I guess D3DXLoadSurfaceFromSurface is handled by the GPU whereas lock -> copy -> unlock is handle by the CPU, right ? Thanks again.
  6. Hi everybody, I am trying to patch a subset of an existing texture (let's call it texture A, size is 1536x1536) by a smaller texture (texture B, size is 64x64). In fact, I want to replace a square area of 64x64 pixels in texture A by texture B. To do that I did choose to use D3DXLoadSurfaceFromSurface and faced some trouble with Alpha blending. I am working with DirectX9. a) First at all, what is strange is that when my texture B is fully opaque (alpha is 1.0 for all pixels), the surface loading is not visible (as if texture B was fully transparent) where as when texture B is fully transparent (alpha is 0.0 for all pixels) the surface loading seems to work perfectly (I can see the texture B in the 64x64 pixels area). Any idea on the root cause ? It seems to have the opposite behavior as expected no ? Do texture stage settings have any impact on D3DXLoadSurfaceFromSurface function behavior ? I guess not because I tried many settings for alpha operations in texture stage and got always the same result. b) I could use fully transparent texture B (alpha channel of texture B is useless in my case) but the issue is that if i use texture B with alpha set to 0.0, then at the end of the surface loading, the area of 64x64 pixels which has been replaced by texture B now has an alpha of 0.0, so fully transparent when I render the texture A. I don't want that !! Then the question are : 1) is there a way to configure D3DXLoadSurfaceFromSurface to copy only R, G and B component of texture B, not taking care of texture B alpha channel, and to keep the alpha channel of texture A ? I tried to use a texture B which does not have alpha channel (DFMT_X8R8G8B8) but it seems to be considered as a fully opaque texture (no alpha is equivalent to alpha = 1.0) and does not work as explained in a). 2) If the answer to 1) is no, is there an another D3D function I missed in the documentation which could help me ? Any help would be very appreciated, it makes me crazy. Thanks in advance. Cheers amarhys
  7. I activated the Debug Runtimes (I was not familiar with this debug method) and I found quickly the cause of the error : hWnd pointer was NULL (I did not expected this kind of error that's why I did not check) because CreateWindowEx failed ... Once repaired DX9 initialization works fine :-) Thanks Evil Steve Cheers Amarhys
  8. Hello, I am currently working on a DX9 game engine. I started the development under XP but I changed to Vista recently. Under Vista, call to ::createDevice always fails returning D3DERR_INVALIDCALL (the same piece of code works fine under XP, I tried it on at least 3 or 4 computers). Here is the D3D initialization code : HRESULT InitD3D (int resWidth, int resHeight, D3DFORMAT resFormat, HWND hWnd, DWORD fullScreen) { HRESULT hr; D3DDISPLAYMODE d3ddm; //--------------------------------------------- // Create D3D object //--------------------------------------------- d3d = Direct3DCreate9(D3D_SDK_VERSION); // Make sure NULL pointer was not returned if (!d3d) return FALSE; //--------------------------------------------- // Get device capabilities //--------------------------------------------- ZeroMemory (&d3dCaps, sizeof(d3dCaps)); D_CHK ( d3d->GetDeviceCaps (D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &d3dCaps) ); //--------------------------------------------- // Setup device present parameters //--------------------------------------------- ZeroMemory(&d3dPresent,sizeof(d3dPresent)); // WINDOWED MODE if (fullScreen == 0) { RECT rWindow; // Get display mode D_CHK ( d3d->GetAdapterDisplayMode (D3DADAPTER_DEFAULT, &d3ddm) ); // Get window bounds GetClientRect (hWnd, &rWindow); // Setup backbuffer format d3dPresent.Windowed = true; d3dPresent.BackBufferFormat = d3ddm.Format; d3dPresent.BackBufferWidth = rWindow.right - rWindow.left; d3dPresent.BackBufferHeight = rWindow.bottom -; } // FULLSCREEN MODE else { // Setup backbuffer format d3dPresent.Windowed = false; d3dPresent.BackBufferFormat = resFormat; d3dPresent.BackBufferWidth = resWidth; d3dPresent.BackBufferHeight = resHeight; } // Front / Back buffer d3dPresent.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dPresent.hDeviceWindow = hWnd; d3dPresent.BackBufferCount = 1; d3dPresent.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT; d3dPresent.MultiSampleType = D3DMULTISAMPLE_NONE; // No multisample d3dPresent.MultiSampleQuality = 0; // Stencil buffer d3dPresent.EnableAutoDepthStencil = TRUE; d3dPresent.AutoDepthStencilFormat = D3DFMT_D16; D_CHK (d3d->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, d3ddm.Format, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, d3dPresent.AutoDepthStencilFormat)); D_CHK (d3d->CheckDepthStencilMatch(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, d3ddm.Format, d3dPresent.BackBufferFormat, d3dPresent.AutoDepthStencilFormat)); // Others d3dPresent.Flags = 0; d3dPresent.FullScreen_RefreshRateInHz = 0; //--------------------------------------------- // Create D3D device //--------------------------------------------- if (d3dCaps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) { // Create device with hardware vertex processing D_CHK ( d3d->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dPresent, &d3dDevice) ); } else { // Create device with software vertex processing D_CHK ( d3d->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dPresent, &d3dDevice)); } //--------------------------------------------- // Enable dialog boxes (Windows mode only) //--------------------------------------------- if (fullScreen==0) { D_CHK ( d3dDevice->SetDialogBoxMode(TRUE) ); } return TRUE; } D_CHK is a simple macro to check HRESULT value and exit when it fails. My development environment : - Visual Studio C++ .NET 2003. - Microsoft DirectX SDK (June 2008) - Vista Family Premium SP1 - Video Card : ATI Mobility Radeon HD 3470 I include <d3d9.h>, <d3dx9.h> and <d3dx9mesh.h> I link with d3d9.lib d3dx9.lib dxerr.lib I know that Vista includes both DX9 and DX10. Do I need to indicate to Vista I want to execute the application under DX9 ? (somewhere in the tool settings or the project configuration) If not, does anybody have an idea to explain why createDevice fails ? Thank you in advance for your answer. Cheers Amarhys [Edited by - amarhys on August 22, 2008 3:39:31 PM]
  9. amarhys

    Gamma Correction Ramp

    Thanks Zipster !!!
  10. Hello, I would like to implement a gamma correction "user setting" in my game engine and I would like to know I can do that ? I guess the easiest way to achieve that is to use "SetGammaRamp" and "GetGammaRamp" functions provided by DirectX SDK but how should I modify the ramps based on a single gamma correction factor (float value between 0.0 and 2.5 for example) given by the user ? I think the default gamma ramp values (at directX initialization) are given for a gamma factor of 1.0, right ? Then, what are the mathematical formula to modify all the ramp values when a new gamma factor must be applied ? Thank you in advance for your answer. Cheers Amarhys
  11. amarhys

    D3D and multi threads

    Thanks for your answer JasonBlochowiak. There are no mip-maps in my textures (panoramic cube face textures and animation textures are quite always at the same distance of the camera) but you are right, D3D has to perform the conversion from DXT format. I think I cannot pre-create the textures for animations (I did that only for cube faces) because my graphics engine supports up to 10 animations simulteanously with a number of frames per animations up to 64 => potentially 640 textures at the same time (but it never happens). Size of animation textures is usually small (about 256x256) but it could be more in some rare cases (maximum supported is the size of a cube texture face i.e 1512x1512). Then, in the better case, I would have to create 640 textures of 256x256 at start-up (about 160MB in ARGB) and I guess it is not a good idea. I will try to call render() function more often in the texture loading procedure. Today, when player left clicks, I do (if I come back to a unique thread) : for i = 1 to n load texture i end for render() I can try (because textures which have to be loaded for the next view are not used yet by the Render() function until the view is switched) for i = 1 to n load texture i render() end for Maybe it will be enough to solve my problem. The most important for me is not the time to load texture (which is bigger in second case) but the fact that animations keep on being played during the texture loading procedure. Cheers Amarhys
  12. amarhys

    D3D and multi threads

    Thanks for your answer jollyjeffers. I had a look at GameFest/GDC presentations concerning multi-threading on MS website and as you said, D3DCREATE_MULTITHREADED is not recommended. However, the 1.5 seconds spent to load textures from external files are split as following : - 0.3s for file accesses + data copy into memory - 1.2s for D3DXLoadSurfaceFromFileInMemory(...) or D3DXCreateTextureFromFileInMemoryEx(...) function execution (I use DXT3 textures) => main time is spent in D3D functions then using a thread for file I/O only is not very interesting in performance point of view and will not really solve my problem. A solution could be to bring back the code used to load the textures in the main thread and to call render() function after each call to D3DXLoadSurfaceFromFileInMemory(...) or D3DXCreateTextureFromFileInMemoryEx(...) instead of waiting for all textures to be loaded before executing render(). I am going to try that. Cheers Amarhys
  13. Hello, I am working on a myst-like game with a 360 panoramic graphics engine. Each view is composed of : - 6 textures for the panoramic cube (top, bottom, left, right, front and back, each texture is 1512x1512). - additional textures for local animations on individual cube faces (number of animations, number of textures for each animation and texture size depend of the view). Panoramic textures are created forever at initialization and are updated using D3DXLoadSurfaceFromFile(...) function. Animation textures are created on the fly for each view (as number of textures and size of textures are not predictible) using D3DXCreateTextureFromFileEx(...) function. When the player left clicks the mouse to change from one view to another, it takes about 1 to 1.5 seconde to load the textures of the next view (depending of how many animations have to be loaded) and during this time, the render() function is not executed then animation of current view are frozen. To resolve this issue, I changed the code to load the textures of the next view in another thread while the main thread is looping on render() function. It works as following, in pseudo code : LOADING THREAD : ---------------- 1. Wait for Start semaphore 2. Get parameters for textures to be loaded (global variable) 3. Load all needed textures 4. Assert End semaphore MAIN THREAD : ------------- When the player left clicks the mouse : 1. Set parameters for texture loading (global variable) 2. Assert Start semaphore 3. While (1) 3.1 Check End semaphore. If asserted, break while loop 3.2 Execute render() function 4. Check status of texture loading process (global variable) 4. Switch from current view to next view With this implementation, it works as expected because animations keep on playing when next view textures are beeing loaded but sometimes (by sometimes I mean it is not predictible) D3DXCreateTextureFromFileEx(...) function which is used to load animation textures returns E_OUTOFMEMORY. Obviously I checked that texture resources which are updated/loaded in LOADING THREAD are not used at the same time in render() function in MAIN THREAD. Is there an issue calling D3D functions in two concurrent threads ? Thank you in advance for your answer. Cheers Amarhys
  14. I found the error, in fact the handle I am passing to InvalidateRect is not correct. I should retrieve it from dwUser and not from dw1 in my timer callback. Thanks to all of you for your help. Cheers Amarhys
  15. Yes, I am passing the handle to the dialog box which displays the animation to InvalidateRect function. Some part of code which manages the dialog box ... ... #define ANIM_POS_X 320 #define ANIM_POS_Y 20 #define ANIM_WIDTH 240 #define ANIM_HEIGHT 240 MMRESULT animTimer; int nbAnimFrame; int curAnimFrame; ... ... //----------------------------------- // Animation timer //----------------------------------- void CALLBACK AnimTimerProc(UINT uTimerID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2) { HWND hDlg = (HWND)dw1; // Get next frame if (curAnimFrame < nbAnimFrame-1) curAnimFrame = curAnimFrame+1; else curAnimFrame = 0; // Update display RECT rt = { ANIM_POS_X, ANIM_POS_Y, ANIM_POS_X+ANIM_WIDTH, ANIM_POS_Y+ANIM_HEIGHT }; InvalidateRect(hDlg, &rt, false); } ... ... //-------------------------------------- // // Message handler for Dialog Box // //-------------------------------------- LRESULT CALLBACK EdtAnim(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { ... ... PAINTSTRUCT ps; HDC hdc; ... ... switch (message) { //--------------------------- // Init //--------------------------- case WM_INITDIALOG: .. .. nbAnimFrame = 10; curAnimFrame = 0; .. .. return TRUE; //--------------------------- // Command parsing //--------------------------- case WM_COMMAND: .. .. //------------------------- // Play anim button //------------------------- if (LOWORD(wParam) == IDC_EANIM_PLAYANIM) { // Set anim timer animTimer = timeSetEvent(200, 5, AnimTimerProc,(DWORD)hDlg, TIME_PERIODIC); } break; //-------------------------- // Paint //-------------------------- case WM_PAINT: hdc = BeginPaint(hDlg, &ps); StretchDiBits( .....); EndPaint(hDlg, &ps); break; } return FALSE; } Cheers Amarhys
  • 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!