Jump to content

  • Log In with Google      Sign In   
  • Create Account

Calling all IT Pros from Canada and Australia.. we need your help! Support our site by taking a quick sponsored surveyand win a chance at a $50 Amazon gift card. Click here to get started!


anders211

Member Since 14 Feb 2012
Offline Last Active Aug 24 2015 01:43 PM

Topics I've Started

FPS still the same no matter what presentation parameters are

24 August 2015 - 01:46 PM

Hi

2 years ago I could force my project to run on 60 FPS (refresh rate of the screen) or even real maximum FPS.

Unfortunately I completely forgot what parameters were changed to manipulate frames per seconds. Here are my presentation parameters:

 

 D3DPRESENT_PARAMETERS d3dpp;
   ZeroMemory(&d3dpp, sizeof(d3dpp));
   d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
   d3dpp.Windowed = false;
   d3dpp.BackBufferFormat =  D3DFMT_X8R8G8B8; 
   d3dpp.EnableAutoDepthStencil = TRUE; //włącz bufor Z
   d3dpp.AutoDepthStencilFormat = D3DFMT_D24S8; 
   d3dpp.BackBufferCount = 1; 
   d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE;
   d3dpp.MultiSampleQuality = 0;
   d3dpp.hDeviceWindow = hWnd;
d3dpp.BackBufferWidth = 1680;
d3dpp.BackBufferHeight = 1050;   
d3dpp.Flags = 0; //D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;    
d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;    
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE; //ONE,TWO,THREE,FOURS,IMMEDIATE,D3DPRESENT_INTERVAL_DEFAULT (reduces by half)
  

I might swear that in order to have refresh rate of the screen (60FPS) I used:

d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE; 

and in order to have real FPS (for example 500) I changed second one to D3DPRESENT_INTERVAL_IMMEDIATE

However whatever parameter is I have now FPS between 63 and 64. It also doesn't depend on amount of draw calls. I now nothing draw on the scene and still I have 63-64. What might be the rootcause? I don't have also any limitation/conditions in message loop. For those 2 years I didn't exchange graphic card, however I reinstalled many time windows, so maybe the rootcause is placed in some graphic card settings???


how to get unit vector perpendicular to normal surface

21 March 2015 - 11:44 AM

I have normal vector to the surface. And I want to receive vector perpendicular to this normal vector.

This perpendicular  vector has to be normalized and lie towards x and z direction as normal one.

 

http://oi61.tinypic.com/4lsfb8.jpg

 

Any ideas for 3 equations which will serve to find the solution? I have only one as on the picture, so I need to have 2 more ones.


coordinates transformation

07 March 2015 - 05:34 PM

I have bounce ball physic implemented when normal to the bouncing surface is (0,1,0). Instead of writing new algorithm which would work for other normal vectors I could resuse my algorithm and transform input data like velocity vector.

http://zapisz.net/images/453_problem.jpg


Bounce from ground produces opposite dependency

11 February 2015 - 04:14 PM

Hi
I have a problem. I have left-handed system. And formulas/dependency for movement before bounce impact are:
Vz ~ r*Wx
Vx ~ -r*Wz
In other words: ball which goes into Z+,X+ direction has positive value speeds and positive angular Wx speed and negative value of Wz.
However during bounce ground impact equation gives opposite results:
Vz ~ -r*Wx
Vx ~ r*Wz
Here are details:
Some comment to picture: After bounce with top spin V speed decreases and W speed increases. Wx has to have negative value in order to increase.
 
You know I might tune in manual well formulas obtained from bounce ground impact and replace Wx1,Wx2 with Wz2,Wz1 and everything would be OK. However I am planning to reuse this piece of SW for bounce from wall, for bounce from some slippery slope, so I cannot afford on such workaround because earlier or later I will get lost.
Does anybody have idea how to solve this problem and where I made a mistake that I got opposite direction?

algorithm for point in triangle doesn't work

06 January 2015 - 04:18 PM

In website there is on many sites some popular barycentric algorithm for detecting point in triangle:

bool isPointInTriangle(D3DXVECTOR3 P, D3DXVECTOR3 A, D3DXVECTOR3 B, D3DXVECTOR3 C)
{       
D3DXVECTOR3 v0 = C - A;
D3DXVECTOR3 v1 = B - A;
D3DXVECTOR3 v2 = P - A;


float dot00 = D3DXVec3Dot(&v0, &v0);
float dot01 = D3DXVec3Dot(&v0, &v1);
float dot02 = D3DXVec3Dot(&v0, &v2);
float dot11 = D3DXVec3Dot(&v1, &v1);
float dot12 = D3DXVec3Dot(&v1, &v2);


// Compute barycentric coordinates
float invDenom = 1 / (dot00 * dot11 - dot01 * dot01);
float u = (dot11 * dot02 - dot01 * dot12) * invDenom;
float v = (dot00 * dot12 - dot01 * dot02) * invDenom;


// Check if point is in triangle
return (u >= 0) && (v >= 0) && (u + v < 1);
}

However it is wrong.

It doesn't work for this input data:

D3DXVECTOR3 P(0.379488, 0.113208, 0.0695381);
D3DXVECTOR3 A(0.293016, 0.294949, 0.0872371);
D3DXVECTOR3 B(0.282774, 0.126041, 0.122983);
D3DXVECTOR3 C(0.26794, 0.127092, 0.0825565);

Point P has x coordinate=0.379488 which isn't in a range of x coordinates of A,B,C. So based on this without any calculation I know that for sure point P is outside the triangle. However algorithm return true that point is inside triangle.

The same is with P.y and P.z coordinate.

Could anybody who has in his code algorithm for detecting point in triangle check how your algorithm behaves for the above input data? 

PARTNERS