Jump to content
  • Advertisement

isu diss

Member
  • Content Count

    65
  • Joined

  • Last visited

Community Reputation

-2 Poor

1 Follower

About isu diss

  • Rank
    Member

Personal Information

  • Role
    Programmer
  • Interests
    Art
    Programming

Recent Profile Visitors

2268 profile views
  1. isu diss

    3D Rigidbody Simulation

    My code finally works!!! I'm so happy. Not only I changed the radius of the rigidbody ball, I also changed the radius of the ball's 3D model. Thank you @Irlan Robson.
  2. isu diss

    3D Rigidbody Simulation

    I'm sorry for repeated inquiries. I couldn't get my code to work, I did everything that you said. still the result is same. Anyway, I'm happy that my code works in your environment. Thanks for your support.
  3. isu diss

    3D Rigidbody Simulation

    I checked the shaders, they are just fine. Can you please create a opengl or d3d project using my sourcecode? You might be able to see the problem. Because I have no idea. I hope I'm not asking too much.
  4. isu diss

    3D Rigidbody Simulation

    Thanks @Irlan Robson I changed quat2matrix and matrixtoquat functions with the ones provided by directxmath. The result is still the same, the ball spins around the world x-axis. I don't know what to do.
  5. isu diss

    3D Rigidbody Simulation

    Rigidbody, Ball is initialized like this. These are the parameters. float CB_Mass = 0.156f;//kg float CB_Radius = 0.36f;//0.036f;//m float g = 9.83f; //ms-2 float I_tmp = (0.4f)*(CB_Mass*(CB_Radius*CB_Radius)); XMMATRIX IBody = XMMatrixSet(I_tmp, 0, 0, 0, 0, I_tmp, 0, 0, 0, 0, I_tmp, 0, 0, 0, 0, 1); rbBall = new RigidBody(CB_Mass, IBody, XMVectorSet(-100.0f, 70.0f, 0, 1), XMVectorSet(0, 0, 30.0f, 0), XMVectorSet(8e-3f, 0, 0, 0), XMMatrixRotationZ(XM_PIDIV2));
  6. isu diss

    3D Rigidbody Simulation

    I started to build a physics engine using "An Introduction to Physically Based Modeling" http://www.cs.cmu.edu/afs/cs/user/baraff/www/pbm/pbm.html by by the authors (Andrew Witkin, David Baraff and Michael Kass). This physics engine is used in a cricket simulation. So far I'm trying to simulate the cricket ball. The problem is, the ball should spin around its body space x- axis, given the angular momentum around body space x-axis but it only spins around the world space x-axis. How do I change the coordinate axis? Rigidbody dynamics code RigidBody::RigidBody(float M, XMMATRIX IBody, XMVECTOR x0, XMVECTOR v0, XMVECTOR L0, XMMATRIX R0) { Mass = M; IBodyInverse = XMMatrixInverse(NULL, IBody); x = x0; v = v0; L = L0; I0_Inverse = XMMatrixMultiply(XMMatrixTranspose(R0), IBodyInverse); I0_Inverse = XMMatrixMultiply(I0_Inverse, R0); Omega = XMVector4Transform(L0, I0_Inverse); q = MatrixToQuaternion(R0); F_Total = XMVectorSet(0, 0, 0, 0); Tau_Total = XMVectorSet(0, 0, 0, 0); } XMMATRIX RigidBody::QuaternionToMatrix(XMVECTOR q) { float vx = q.m128_f32[0]; float vy = q.m128_f32[1]; float vz = q.m128_f32[2]; float s = q.m128_f32[3]; return XMMatrixSet( (1 - ((2*vy*vy) + (2*vz*vz))), ((2*vx*vy) + (2*s*vz)), ((2*vx*vz) - (2*s*vy)), 0, ((2*vx*vy) - (2*s*vz)), (1 - ((2*vx*vx) + (2*vz*vz))), ((2*vy*vz) + (2*s*vx)), 0, ((2*vx*vz) + (2*s*vy)), ((2*vy*vz) - (2*s*vx)), (1 - ((2*vx*vx) + (2*vy*vy))), 0, 0, 0, 0, 1); } XMVECTOR RigidBody::MatrixToQuaternion(XMMATRIX m) { XMVECTOR q_tmp; float tr, s; tr = m.r[0].m128_f32[0] + m.r[1].m128_f32[1] + m.r[2].m128_f32[2]; if (tr >= 0) { s = sqrt(tr + 1); q_tmp.m128_f32[3] = 0.5f*s; s = 0.5f/s; q_tmp.m128_f32[0] = (m.r[2].m128_f32[1] - m.r[1].m128_f32[2])*s; q_tmp.m128_f32[1] = (m.r[0].m128_f32[2] - m.r[2].m128_f32[0])*s; q_tmp.m128_f32[2] = (m.r[1].m128_f32[0] - m.r[0].m128_f32[1])*s; } else { int i = 0; if (m.r[1].m128_f32[1] > m.r[0].m128_f32[0]) i = 1; if (m.r[2].m128_f32[2] > m.r[i].m128_f32[i]) i = 2; switch(i) { case 0: { s = sqrt((m.r[0].m128_f32[0] - (m.r[1].m128_f32[1] + m.r[2].m128_f32[2])) + 1); q_tmp.m128_f32[0] = 0.5f*s; s = 0.5f/s; q_tmp.m128_f32[1] = (m.r[0].m128_f32[1] + m.r[1].m128_f32[0])*s; q_tmp.m128_f32[2] = (m.r[2].m128_f32[0] + m.r[0].m128_f32[2])*s; q_tmp.m128_f32[3] = (m.r[2].m128_f32[1] - m.r[1].m128_f32[2])*s; break; } case 1: { s = sqrt((m.r[1].m128_f32[1] - (m.r[2].m128_f32[2] + m.r[0].m128_f32[0])) + 1); q_tmp.m128_f32[1] = 0.5f*s; s = 0.5f/s; q_tmp.m128_f32[2] = (m.r[1].m128_f32[2] + m.r[2].m128_f32[1])*s; q_tmp.m128_f32[0] = (m.r[0].m128_f32[1] + m.r[1].m128_f32[0])*s; q_tmp.m128_f32[3] = (m.r[0].m128_f32[2] - m.r[2].m128_f32[0])*s; break; } case 2: { s = sqrt((m.r[2].m128_f32[2] - (m.r[0].m128_f32[0] + m.r[1].m128_f32[1])) + 1); q_tmp.m128_f32[2] = 0.5f*s; s = 0.5f/s; q_tmp.m128_f32[0] = (m.r[2].m128_f32[0] + m.r[0].m128_f32[2])*s; q_tmp.m128_f32[1] = (m.r[1].m128_f32[2] + m.r[2].m128_f32[1])*s; q_tmp.m128_f32[3] = (m.r[1].m128_f32[0] - m.r[0].m128_f32[1])*s; break; } } } return q_tmp; } XMVECTOR RigidBody::GetPosition() { return x; } XMMATRIX RigidBody::GetOrientation() { return R; } void RigidBody::AddForce(XMVECTOR Force) { F_Total += Force; } void RigidBody::AddTorque(XMVECTOR Torque) { Tau_Total += Torque; } void RigidBody::Update(float h) { x += h*v; v += h*(F_Total/Mass); XMVECTOR Omegaq = XMQuaternionMultiply(q, XMVectorSet(Omega.m128_f32[0], Omega.m128_f32[1], Omega.m128_f32[2], 0)); q += 0.5f*h*Omegaq; L += h*Tau_Total; R = QuaternionToMatrix(XMQuaternionNormalize(q)); IInverse = XMMatrixMultiply(XMMatrixTranspose(R), IBodyInverse); IInverse = XMMatrixMultiply(IInverse, R); Omega = XMVector4Transform(L, IInverse); } Rendering code mgWorld = XMMatrixMultiply(rbBall->GetOrientation(), XMMatrixTranslation(rbBall->GetPosition().m128_f32[0], rbBall->GetPosition().m128_f32[1], rbBall->GetPosition().m128_f32[2])); cuvscb.mWorld = XMMatrixTranspose( mgWorld ); cuvscb.mView = XMMatrixTranspose( mgView ); cuvscb.mProjection = XMMatrixTranspose( mgProjection ); cuvscb.mLightView = XMMatrixTranspose(mgLightView); cuvscb.mLightProjection = XMMatrixTranspose(mgLightProjection); cuvscb.vCamPos = XMFLOAT3(MyCAM->GetEye().m128_f32[0], MyCAM->GetEye().m128_f32[1], MyCAM->GetEye().m128_f32[2]); cuvscb.vSun = XMFLOAT3(cos(Theta)*cos(Phi), sin(Theta), cos(Theta)*sin(Phi)); cuvscb.MieCoeffs = MC; cuvscb.RayleighCoeffs = RC; pImmediateContext->UpdateSubresource( pVSCUConstBuffer, 0, NULL, &cuvscb, 0, 0 ); pImmediateContext->VSSetConstantBuffers(0, 1, &pVSCUConstBuffer); Draw code...
  7. isu diss

    How to do Cascaded Shadow Map

    I read the aricle. It gave me an idea. I'm not saying I understood it all. I found the source code for that. It's complex. I have problems regarding the implementation. @turanszkijCan you enlighten me on the implementation?
  8. I have set up a normal shadow mapping but the result is not so good. So, I decided to do cascaded shadow mapping. Can anyone point out to me a good source or place to start with?
  9. isu diss

    Gap between Sky and Terrain

    I want my terrain to look like in Far Cry 5, large terrain. No matter how much I scale the terrain, it can't cover the gap. That's because I disable depth buffer writes. @Cat's macheteHow can I stretch the sky? It's a dome, you mean extend the dome? Any help?
  10. How do I fill the gap between sky and terrain? Scaling the terrain or procedural terrain rendering?
  11. isu diss

    Light Shafts

    pls help me
  12. isu diss

    Light Shafts

    As my shadow map generation for tessellated terrain failed, I decided to implement this (https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch13.html) as my last try. Can anyone help me (the steps) to implement that in D3D11? Pls...
  13. I'm following rastertek tutorial 14 (http://rastertek.com/tertut14.html). The problem is, slope based texturing doesn't work in my application. There are plenty of slopes in my terrain. None of them get slope color. float4 PSMAIN(DS_OUTPUT Input) : SV_Target { float4 grassColor; float4 slopeColor; float4 rockColor; float slope; float blendAmount; float4 textureColor; grassColor = txTerGrassy.Sample(SSTerrain, Input.TextureCoords); slopeColor = txTerMossRocky.Sample(SSTerrain, Input.TextureCoords); rockColor = txTerRocky.Sample(SSTerrain, Input.TextureCoords); // Calculate the slope of this point. slope = (1.0f - Input.LSNormal.y); if(slope < 0.2) { blendAmount = slope / 0.2f; textureColor = lerp(grassColor, slopeColor, blendAmount); } if((slope < 0.7) && (slope >= 0.2f)) { blendAmount = (slope - 0.2f) * (1.0f / (0.7f - 0.2f)); textureColor = lerp(slopeColor, rockColor, blendAmount); } if(slope >= 0.7) { textureColor = rockColor; } return float4(textureColor.rgb, 1); } Can anyone help me? Thanks.
  14. isu diss

    Light Shafts

    2nd paper is based on my choice, "Real-time Volumetric Lighting in Participating Media". @Vilem Otte Can you help me on this, sir? Cos you explain things very clearly. I really appreciate anything you have to say.
  15. isu diss

    DX11 Light Shafts

    I decided to implement light shafts using http://sirkan.iit.bme.hu/~szirmay/lightshaft_link.htm So far I've only managed to implement the shadow map. Can anyone help me to implement this in D3D11? (I mean steps, I can do the rest). I'm new to all these shadow maps and etc.
  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!