# Denzin

Member

197

100 Neutral

• Rank
Member
1. ## Applying screen space measurements to 3D

I am currently working on a project, in which projectiles are fired based on where two dimensional textures are placed in relation to the character in the 3D environment, however am having an issue getting the projectile particle effect to rotate to emit in the correct direction. First, a texture is placed. When this happens I am converting the player to screen coordinates and am left with 2 2D vectors. I can get the angle of these vectors however it does not re apply to the 3D environment since the camera can be turned in any specific direction around the player so axis will not be aligned. Is there any efficient technique to accomplish accounting for the camera's orientation on the axis so I can calculate the quaternion needed to be applied to go from the player's forward vector to the angle represented in 2D space?
2. ## Volumetric Mesh Culling C#- Unity

Frameshift actually doesn't use projection decals, which does make it faster however does not allow for aesthetically pleasing corner decal wraps, which I can afford the performance hinder from projects due to low poly environments. int TriPlaneIntersect(Vector3[] tri, Vector3 p, Vector3 pNormal) { float d0,d1,d2; d0 = Vector3.Dot(pNormal, tri[0] - p); d1 = Vector3.Dot(pNormal, tri[1] - p); d2 = Vector3.Dot(pNormal, tri[2] - p); if(d0 == 0 || d1 == 0 || d2 == 0) //one of the values = 0, triangle lies on the plane return LIES_ON; if((Mathf.Sign(d0) == Mathf.Sign(d1) && Mathf.Sign(d1) == Mathf.Sign(d2))) { //no intersection, however need to test if the triangle is within the volume //if all are in obb return INSIDE; //else return OUTSIDE; } else { //signs are not all the same, intersection occurs return INTERSECT; } } This is my basis for the test, However I still need to hammer out the point inside an OBB check.
3. ## Volumetric Mesh Culling C#- Unity

Hey all, I am currently against a wall with some fun physics work I could use some insight on. My goal is projection decal generation during runtime in Unity C# scripting. Here are my steps I am currently attempting, however facing many issues with implementation. 1) Raycast to object to get exact point of impact. 2) Copy objects mesh at exact same location of object. 3) Create box collider to represent size of decal. 4) Clip copied mesh to box collider bounds. 5) Store new mesh as game object and render. I am having issues with step 4. I've attempted a few techniques, including SAT but was not able to get it working with tri - OBB. My current train of thought involves 6 infinite planes of the bounding volume and comparison of normals of the triangle and faces of the cube. Is this a reasonable approach?
4. ## DirectX Animations

Yea but no one replied yet, no reason to make a new thread. And we are just currently resetting the time on the controller for the instance than advancing it to the frame we want to freeze on. -edit. yea this doesnt work. Why doesnt directx animation controllers have a set time function...
5. ## DirectX Animations

I have an animation issue that could use some insight. Currently I have multiple animation controllers all linked to a single entity of mesh data, given the case of an entities death, the animation for that unit needs to halt. Where others will continue to update and mold the mesh data. Is there a way to set the dx animationcontroller to a specific timeset, (not using animController->AdvanceTime())
6. ## C++ inheritance byte order

Thanks for the quick reply. We pragma pack, and we can guarantee our server-client will utilize the same compiler, even with the option of casting the data back to its original packet structure before use on client. There is only the single parent to serve as the header for the packet data.
7. ## C++ inheritance byte order

I'm working on a network system which will send various sized packets, all which need a specific set of bytes at the beginning of each packet structure. With inheritence, does byte order go... [parent bytes][][][][][childbytes][][][][][][] If I were to access these child structures through raw byte data?
8. ## DirectX animation get frame by name

I already made my own because it really is a simple thing, but thank you for reassuring me I'm not crazy
9. ## DirectX animation get frame by name

I have just a quick question someone may be able to help me with, Is there a prebuild directx c++ function for traversing a frame hierarchy and returning a frame with a given name or do I need to build my own? I remember seeing something along these lines a while ago but am having no luck finding it now while digging around.
10. ## Displacement on render issue

Sorry, top right near the fps counter there is a floating body of a gremlin. At 0,0,0 the skeleton and gremlin allign perfectly with the same transformation matrix as they should, however when translation is added, the gremlin model begins rendering off target. My question is would a difference in file unit scale(1 u = 1m .. 1u = 1i) cause this in directx?
11. ## Displacement on render issue

I'm back again with another fun issue that has come up on my project. Model displacement. These models are using the exact same world matrix for their rendering which is.. D3DXMATRIX a; D3DXMATRIX s,r; D3DXMatrixScaling(&s,1,1,1); D3DXMatrixRotationYawPitchRoll(&r, 0,0,0); D3DXMatrixMultiply(&s, &s, &r); D3DXMatrixTranslation(&a,10,10,10); D3DXMatrixMultiply(&a, &s, &a); renderer->QueueSkinned(&instanceMesh,&a); renderer->QueueSkinned(&instanceMesh2,&a); The only potential issue I have seen that could cause this is while opening the displaced model's .max file, it alerts me the unit scale is 1 unit = 1 meter as opposed to 1 unit = 1 inch. Would this cause such a displacement?
12. ## Fidgeting Animations Dx9

When I said frames I meant keyframes of the animation, sorry for not being clear with that. I did check exactly what dt was hitting the animation controller, and it is a very simple clear statement. void CSkinnedInstance::Update(float dT) { currentTime += dT * transitionTime; elapsedTime = dT * transitionTime; } void CSkinnedInstance::FrameMove(const D3DXMATRIX* worldMat) { if(animationController) animationController->AdvanceTime(elapsedTime, NULL); skinnedMesh->UpdateFrameMatrices(NULL, worldMat); ... Where transition time is .001f (the ticks per anim in the file itself was missing so we had to do a large scale down on speed)
13. ## Fidgeting Animations Dx9

I'm working with some assets on a game project right now, however I have noticed an issue with animation. There seems to be an extreme limb twitch that happens between frames. I've been looking into resolving this issue but with no luck. Does anyone know a way to help smooth animations via code? (The animation runs perfectly smooth in tng viewer). The video kind of shows the issue, however it is more obvious in real runtime.
14. ## Frustum Culling Dx9

whats the new tags if it is no longer [source] -edit guessed it right. fixed now.
15. ## Frustum Culling Dx9

I'm having an issue that could require some fresh eyes to look at while attempting frustum culling. Everything ends up outside the frustum regardless of where the camera is positioned. Here are the steps i'm taking with my camera and cull check. First I Set the projection matrix.. void CD3DCamera::SetLens(float fov, float aspect, float nearZ, float farZ) { D3DXMatrixPerspectiveFovLH(&projMat, //projection matrix D3DXToRadian(fov), //field of view aspect, nearZ, farZ); } The camera updates its position and rebuilds its view matrix as follows.. void CD3DCamera::BuildView() { //keep axes orthoganal D3DXVec3Normalize(&look, &look); //up D3DXVec3Cross(&up, &look, &right); D3DXVec3Normalize(&up, &up); //right D3DXVec3Cross(&right, &up, &look); D3DXVec3Normalize(&right, &right); //fill view matrix float x = -D3DXVec3Dot(&position, &right); float y = -D3DXVec3Dot(&position, &up); float z = -D3DXVec3Dot(&position, &look); viewMat(0,0) = right.x; viewMat(1,0) = right.y; viewMat(2,0) = right.z; viewMat(3,0) = x; viewMat(0,1) = up.x; viewMat(1,1) = up.y; viewMat(2,1) = up.z; viewMat(3,1) = y; viewMat(0,2) = look.x; viewMat(1,2) = look.y; viewMat(2,2) = look.z; viewMat(3,2) = z; viewMat(0,3) = 0.0f; viewMat(1,3) = 0.0f; viewMat(2,3) = 0.0f; viewMat(3,3) = 1.0f; } Next the frustum planes are extracted with void CD3DCamera::BuildFrustum() { D3DXMatrixMultiply( &viewProj, &viewMat, &projMat ); //D3DXMatrixMultiply( &viewProjection, &m_mView, &m_mProjection ); // Left plane frustum[0].a = viewProj._14 + viewProj._11; frustum[0].b = viewProj._24 + viewProj._21; frustum[0].c = viewProj._34 + viewProj._31; frustum[0].d = viewProj._44 + viewProj._41; // Right plane frustum[1].a = viewProj._14 - viewProj._11; frustum[1].b = viewProj._24 - viewProj._21; frustum[1].c = viewProj._34 - viewProj._31; frustum[1].d = viewProj._44 - viewProj._41; // Top plane frustum[2].a = viewProj._14 - viewProj._12; frustum[2].b = viewProj._24 - viewProj._22; frustum[2].c = viewProj._34 - viewProj._32; frustum[2].d = viewProj._44 - viewProj._42; // Bottom plane frustum[3].a = viewProj._14 + viewProj._12; frustum[3].b = viewProj._24 + viewProj._22; frustum[3].c = viewProj._34 + viewProj._32; frustum[3].d = viewProj._44 + viewProj._42; // Near plane frustum[4].a = viewProj._13; frustum[4].b = viewProj._23; frustum[4].c = viewProj._33; frustum[4].d = viewProj._43; // Far plane frustum[5].a = viewProj._14 - viewProj._13; frustum[5].b = viewProj._24 - viewProj._23; frustum[5].c = viewProj._34 - viewProj._33; frustum[5].d = viewProj._44 - viewProj._43; // Normalize planes for ( int i = 0; i < 6; i++ ) { D3DXPlaneNormalize( &frustum, &frustum ); } } last, bounding coordinates are checked with bool FrustumCheck(D3DXVECTOR3 max, D3DXVECTOR3 min, const D3DXPLANE* frustum) { D3DXVECTOR3 P; D3DXVECTOR3 Q; bool ret = false; for(int i = 0; i < 6; ++i) { for(int j = 0; j < 3; ++j) { if( frustum[j] > 0.0f ) { P[j] = min[j]; Q[j] = max[j]; } else { P[j] = max[j]; Q[j] = min[j]; } } if(D3DXPlaneDotCoord(&frustum, &Q) < 0.0f ) // outside ret = false; } return ret; } Note, all the aabbs to be checked are technically 2D as y is constant. If anyone notices something that is wrong with this calculation please reply.