# arkerone

Member

28

113 Neutral

• Rank
Member
1. ## how to calculate the texture coordinates (heightmap)

Thanks kauna it works fine ;)!
2. ## how to calculate the texture coordinates (heightmap)

Hello, I create a terrain from a heightmap, I would like to correctly calculate the texture coordinates for this terrain. At the moment I apply this formula: [source lang="cpp"]tu.x = vertex.x/terrainWidth; tu.y = vertex.z/terrainHeight;[/source] but I get this: how to calculate the texture coordinates? thx.

Ok thank you
4. ## DX11 reverse y coordinates texture for refraction/reflection

Hello, i have a question, i found a tutorial to implement water in directx http://rastertek.com/dx11tut29.html and in shader to compute the textures coordinates of refraction and reflection, the y coordinates is reversed. Why? [source lang="cpp"] // Calculate the projected reflection texture coordinates. reflectTexCoord.x = input.reflectionPosition.x / input.reflectionPosition.w / 2.0f + 0.5f; reflectTexCoord.y = -input.reflectionPosition.y / input.reflectionPosition.w / 2.0f + 0.5f; // Calculate the projected refraction texture coordinates. refractTexCoord.x = input.refractionPosition.x / input.refractionPosition.w / 2.0f + 0.5f; refractTexCoord.y = -input.refractionPosition.y / input.refractionPosition.w / 2.0f + 0.5f;[/source] thx!
5. ## Why reverse the light direction?

thank you everyone I have just realized
6. ## Why reverse the light direction?

Hello, I have a question why do reverse the direction of a directional light? [source lang="cpp"] // Invert the light direction for calculations. lightDir = -lightDirection; // Calculate the amount of light on this pixel. lightIntensity = saturate(dot(input.normal, lightDir));[/source] Thx!
7. ## Rotate an object on another

yes, but if I apply a rotation to rotate the propeller, the transformation matrix isn't same.

Thx!!
9. ## Rotate an object on another

Hello, I have a little problem, I have an object split into two (this is a helicopter) and I would like to turn the propellers of the helicopter, so I applied successive rotations each frame on propellers so that they turn on themselves. The problem is that the helicopter can move in four directions (left, right, down, up) so I applied rotations (20 °) on the helicopter and the propellers but the worry is that propellers no longer remain attached to the helicopter. How to keep "hanging" the propellers on the helicopter? Here's a video of the problem:
10. ## 3D scrolling

Hi, I develop a 3D shoot'em up with vertical scrolling. I want to know how to calculate the edges of the screen (the cone of vision?) to that my aircraft remains in the screen when the camera moves? thx.
11. ## onFrameMove and jerky camera

Hi everybody, I have a problem, I use DXUT and at times when I move my camera, it's jerky. I use these callback : DXUTSetCallbackFrameMove (OnFrameMove, scene); DXUTSetCallbackD3D11FrameRender (OnFrameRender, scene); void WINAPI OnFrameMove( double fTime, float fElapsedTime, void* pUserContext ) { Scene &s = *static_cast<Scene*>(pUserContext); // if the camera move if(s.pCamera.getMove()){ s.pCamera.frameMove(fElapsedTime); // update the position s.pCamera.render(); // compute the matrix s.pCamera.renderReflection(s.pWaterPlane->getHeight()); // compute the matrix of reflection } //move the water s.pShaderWater.setWaterMove(s.pShaderWater.getWaterMove() + 0.0001f); if(s.pShaderWater.getWaterMove() > 1.0f) { s.pShaderWater.setWaterMove(s.pShaderWater.getWaterMove()- 1.0f); } }; The message callback : LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam,bool *pbNoFurtherProcessing,void *pUserContext) { Scene &s = *static_cast<Scene*>(pUserContext); switch( msg ) { case WM_KEYDOWN:{ switch(wParam) { case VK_UP : s.pCamera.setMoveForward(true);break; case VK_DOWN : s.pCamera.setMoveBackward(true);break; case VK_LEFT: s.pCamera.setMoveLeft(true);break; case VK_RIGHT : s.pCamera.setMoveRight(true);break; case 'A': s.pCamera.setMoveUp(true);break; case 'Z' : s.pCamera.setMoveDown(true);break; } } break; case WM_KEYUP:{ switch(wParam) { case VK_UP : s.pCamera.setMoveForward(false);break; case VK_DOWN : s.pCamera.setMoveBackward(false);break; case VK_LEFT: s.pCamera.setMoveLeft(false);break; case VK_RIGHT : s.pCamera.setMoveRight(false);break; case 'A': s.pCamera.setMoveUp(false);break; case 'Z' : s.pCamera.setMoveDown(false);break; } } break } return 0; } And the move function : void Camera::MoveForward(float p_time){ if(m_moveForward) m_position.z+=m_speed * p_time; } and in my function onFrameRender , i draw the differents objects of my scene one by one. in 7 sec my camera jumps: [media][/media] An idea of this problem?
12. ## Dynamic array on Shader

Thx, i solved my problem i used a buffer like a ressource. And in my shader i used my buffer : struct cbInstance { Matrix mWorldInstance; float4 colorInstance; }; StructuredBuffer<cbInstance> instanceObject : register(t10); VSout VSmain( VSin Vin,uint InstId:SV_InstanceID) { VSout Vout = (VSout)0; float4 worldPosition; worldPosition = mul(float4(Vin.pos,1), instanceObject[InstId].mWorldInstance); Vout.pos = mul(worldPosition, mViewProj); return Vout; };
13. ## Dynamic array on Shader

Hi, I would create a dynamic table on a shader that contains a global matrix like this: CPU: D3DXMATRIX * mWorld; GPU: Matrix *mWorld How do that? Thx.

Thx!
15. ## how to enable anisotropic filtering?

Hi everybody, i would like enable the anisotropic filtering? How do this in directx 11? Thx.