Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

132 Neutral

About Shadowflare

  • Rank
  1. I have a .X mesh of a tree, which uses a texture with an alpha channel for the branches and leaves. When rendered, the branches will appear transparent, as the alpha seems to get blended with other objects behind them, but if another branch is behind them, that other branch will not get blended, as shown in this screenshot: As you can see, the Skybox gets rendered behind the branch in front with no problems, and the same is true for other objects (like the terrain) but the branch behind it gets chopped off. Does anyone know why this is happening? For the record, I have alpha blending enabled, and culling is turned off. Thanks in advance.
  2. Shadowflare

    Direct X 9, strechRect() is failing!

    Your first problem is that you never call pd3dDevice->BeginScene() and pd3dDevice()->EndScene(). You need to do this before calling any code that uses the device to draw. Try that and see if it fixes your problem.
  3. Shadowflare

    C++ DirectX sprite problem

    This appears to only be the code for rendering your balloons. Can you post your entire render routine?
  4. The formula for linear velocity is: Vf = Vi + a * t Where: Vf = Final Velocity Vi = Initial Velocity a = Acceleration t = Time; Your acceleration should not change, it's your velocity that changes over time. Your direction will be determined by the sign of the acceleration (+ == right, - == left). So your code would look something like this: // Arrow key being pressed if( keyDown( RIGHT_ARROW ) ) { acceleration = 2.0f; } else if( keyDown( LEFT_ARROW ) ) { acceleration = -2.0f; } // Game loop void Update() { // Vf = Vi + a * t (Vi here is 0) currentSpeedX = 0 + acceleration * time; // Then you just have to add your current speed to your position to get your new position x += currentSpeedX; // At this point, your currentSpeedX should be > or < 0. If it's not, it means // you've been slowing down, so once you reach a speed of 0, stop // accelerating. Since it's unlikely that you'll ever land EXACTLY on 0 // you should check a small boundary to determine when to stop, otherwise // you'll eventually just reverse speed and start going the other way! if( currentSpeedX >= -0.05 || currentSpeedX <= 0.05 ) acceleration = 0.0; } // Arrow key released if( keyUp( RIGHT_ARROW ) || keyUp( LEFT_ARROW ) ) { // You want to slow down, so accelerate in the opposite direction acceleration = -acceleration; } Hope this is of use to you!
  5. Shadowflare

    Camera help

    That's also a good way to it. Just remember that by doing that, you're moving the world around the camera instead of moving the camera through the world. Be sure to keep that in mind if future problems crop up.
  6. Shadowflare

    Camera help

    In your moveCamera() function, the reason it only works once is that you're assigning the amount you want to move to your forward/backward/left/right, rather than incrementing/decrementing it. I think what you meant to do was something like this: void Camera::moveCamera(char direction, float amount) { D3DXVECTOR3 temp; //determines which way to move the camera switch(direction) { case 'f': //forward forward += amount; break; case 'b': //backwards forward -= amount; break; case 'l': //left sideStep -= amount; break; case 'r': //right sideStep += amount; break; case 'u': //up upMove += amount; break; case 'd': //down upMove -= amount; break; } changed = true; transformCamera(); } You might consider using a D3DXVECTOR3 to store your information about movement and rotation and such, as it will probably save you a lot of trouble later on. For instance, doing so would cause your moveCamera() function to become much simpler: // fX == forward/backward // fY == up/down // fZ == left/right void Camera::moveCamera(float fX, float fY, float fZ) { D3DXVECTOR3 moveVector = D3DXVECTOR3(fX, fY, fZ); this->position += moveVector; transformCamera(); } // Then instead of moveCamera('f', 1.0f) you would do this moveCamera(1.0f, 0.0f, 0.0f);
  7. Shadowflare

    Camera distance issue.

    If I understand you correctly, you're trying to draw 2D rectangles using Direct3D, right? If so, I'd like to direct you to these articles: http://www.gamedev.net/reference/articles/article1972.asp http://www.toymaker.info/Games/html/sprites.html
  8. Shadowflare

    MSVS Express problems

    Yes, it should. Quote: 1>LINK : fatal error LNK1104: cannot open file 'd3dx10.lib' Is this the only error you get? If so, adding the x86 or x64 directory to your additional library directories should fix your problem. If not, we'll just go one step at a time. :)
  9. Shadowflare

    terrain rendering

    It looks to me like what you're seeing is a tiling effect. If you were to stretch a single grass texture across the entire terrain, you would get a very blown up, ugly, green pixelated effect that doesn't really look anything like grass (or dirt, or whatever). In order to avoid that, you tile a smaller texture many times across the terrain mesh, which gives the illusion of a higher resolution texture. Your grass texture has some areas that stand out more than the rest, and the repetition of those areas has the appearance of a grid. If you were to smooth out the more prominently green areas of the grass texture, you would probably see the grid effect diminish.
  10. Shadowflare

    MSVS Express problems

    What library directory did you add to your project settings? All of the DirectX library files are found in both the "_SDK_\Lib\x86" and "_SDK_\Lib\x64" directories, where _SDK_ is the path to which you installed the DirectX SDK. You should add the one that's relevant to your system (x86 is for 32-bit).
  11. Shadowflare

    Particle Engine Particle Count

    Thanks Uziel! I figured it was somewhere around 10,000, but I couldn't find anywhere that could give me a number. I am using sin / cos, but searching through a lookup table would be quicker? I'll have to give that a shot. Thank you for the info!
  12. Greetings, I've written a particle engine using Direct3D and textured quads, and I'm trying to optimize it right now. Currently it can render around 4,000 particles before it starts to hurt my FPS. Anyone know how many particles the engine should be able to render without taking much of a FPS hit? Obviously system specs will play a big role in this, but I was just wondering if there was an optimal number that every particle system should strive for. Thanks!
  13. Shadowflare

    Billboard Position Problem

    I figured it out. Very, very stupid mistake on my part.
  14. Shadowflare

    Billboard Position Problem

    I figured out that the camera has nothing to do with it. Apparently the code I'm using to rotate the billboards to face the camera is distorting the position of the billboards. My code for figuring out the position and rotation of the billboard so it faces the camera is now: lpDevice->GetTransform(D3DTS_VIEW, &mtxView); D3DXMatrixIdentity(&mtxBillboard); D3DXMatrixInverse(&mtxBillboard, NULL, &mtxView); // I also tried this with D3DXMatrixTranspose(&mtxBillboard, &mtxView) with similar but unsuccessful results. mtxBillboard._41 = m_fPosX; mtxBillboard._42 = m_fPosY; mtxBillboard._43 = m_fPosZ; lpDevice->SetTransform(D3DTS_WORLD, &mtxBillboard); This is the method I've seen used in countless tutorials and programs I've found throughout the web (including threads on this forum). What is it that I'm doing wrong? Thanks!
  15. Greetings, I have created a particle system that uses billboards. I also have a camera class I wrote that I am using to move around the world to test the billboard effect. It appears that something I'm doing when I rotate the billboards to face the user is really screwing up my camera. If I try to rotate my camera, it instead faces in the same direction it was facing and orbits in a circle around the origin. Here is the code I'm using to rotate the billboards, which basically inverts the view matrix and sets it as the world matrix: m_lpDevice->GetTransform(D3DTS_VIEW, &m_mtxView); D3DXMatrixInverse(&m_mtxBillboard, NULL, &m_mtxView); // Don't want to translate to the camera m_mtxBillboard._41 = 0.0f; m_mtxBillboard._42 = 0.0f; m_mtxBillboard._43 = 0.0f; m_lpDevice->SetTransform(D3DTS_WORLD, &m_mtxBillboard); // ...draw the particles... D3DXMatrixIdentity(&m_mtxBillboard); m_lpDevice->SetTransform(D3DTS_WORLD, &m_mtxBillboard); My camera performs rotation calculations using Up, Right, and Look vectors, which are transformed and placed in the view matrix: m_vecUp = D3DXVECTOR3(0.0f, 1.0f, 0.0f); m_vecRight = D3DXVECTOR3(1.0f, 0.0f, 0.0f); m_vecView = D3DXVECTOR3(0.0f, 0.0f, 1.0f); D3DXMatrixRotationAxis(&mtxYaw, &m_vecUp, m_fYaw); D3DXVec3TransformCoord(&m_vecView, &m_vecView, &mtxYaw); D3DXVec3TransformCoord(&m_vecRight, &m_vecRight, &mtxYaw); D3DXMatrixIdentity(&m_mtxView); m_mtxView._11 = m_vecRight.x; m_mtxView._12 = m_vecUp.x; m_mtxView._13 = m_vecView.x; m_mtxView._21 = m_vecRight.y; m_mtxView._22 = m_vecUp.y; m_mtxView._23 = m_vecView.y; m_mtxView._31 = m_vecRight.z; m_mtxView._32 = m_vecUp.z; m_mtxView._33 = m_vecView.z; m_mtxView._41 = -D3DXVec3Dot(&m_vecEye, &m_vecRight); m_mtxView._42 = -D3DXVec3Dot(&m_vecEye, &m_vecUp); m_mtxView._43 = -D3DXVec3Dot(&m_vecEye, &m_vecView); m_lpDevice->SetTransform(D3DTS_VIEW, &m_mtxView); Any help is much appreciated! [Edited by - Shadowflare on March 25, 2007 1:36:40 AM]
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net 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!