• Content count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About Sokol

  • Rank
  1. Hi I have a problem with proper displaying of Objects(please look at link). Floor is red color, quad is textured. Quad front site starts at z=0.0f, just as floor. But it is quad that should "cover" the floor(if You don't understand what I try to say please look at position coordinates of the objects in code) , but in my program this is wrong and I don't know why. I experimented with culling I set it Back(The floor disappears) Front(nothing changes). Also I tried to set depth stencil to "Less" but it changed nothing. Photo- photo SimpleVertex vertices[] = //Quad vertices { ...... //Other sites { D3DXVECTOR3( -1.0f, -1.0f, 0.0f ), D3DXVECTOR2( 0.0f, 0.0f ) }, //Front { D3DXVECTOR3( 1.0f, -1.0f, 0.0f ), D3DXVECTOR2( 1.0f, 0.0f ) }, { D3DXVECTOR3( 1.0f, 1.0f, 0.0f ), D3DXVECTOR2( 1.0f, 1.0f ) }, { D3DXVECTOR3( -1.0f, 1.0f, 0.0f ), D3DXVECTOR2( 0.0f, 1.0f ) }, { D3DXVECTOR3( -1.0f, -1.0f, 1.0f ), D3DXVECTOR2( 0.0f, 0.0f ) }, //Back { D3DXVECTOR3( 1.0f, -1.0f, 1.0f ), D3DXVECTOR2( 1.0f, 0.0f ) }, { D3DXVECTOR3( 1.0f, 1.0f, 1.0f ), D3DXVECTOR2( 1.0f, 1.0f ) }, { D3DXVECTOR3( -1.0f, 1.0f, 1.0f ), D3DXVECTOR2( 0.0f, 1.0f ) }, }; SimpleVertex floorv[] = //Floor vertices { { D3DXVECTOR3( -3.0f, -1.0f, 0.0f ), D3DXVECTOR2( 0.0f, 0.0f ) }, { D3DXVECTOR3( 3.0f, -1.0f, 0.0f ), D3DXVECTOR2( 0.0f, 0.0f ) }, { D3DXVECTOR3( 3.0f, -1.0f, 4.0f ), D3DXVECTOR2( 0.0f, 0.0f ) }, { D3DXVECTOR3( -3.0f, -1.0f, 4.0f ), D3DXVECTOR2( 0.0f, 0.0f ) }, }; It is how I set culling (it is nearly completely taken from tutorial 14 of sdk) D3D10_FILL_MODE fill[1] = { D3D10_FILL_SOLID }; D3D10_CULL_MODE cull[1] = { D3D10_CULL_FRONT //also tried BACK }; ...... void SetRasterize() { for( UINT i=0; i<1; i++ ) { D3D10_RASTERIZER_DESC rasterizerState; rasterizerState.FillMode = fill[i]; rasterizerState.CullMode = cull[i]; rasterizerState.FrontCounterClockwise = true; rasterizerState.DepthBias = false; rasterizerState.DepthBiasClamp = 0; rasterizerState.SlopeScaledDepthBias = 0; rasterizerState.DepthClipEnable = true; rasterizerState.ScissorEnable = false; rasterizerState.MultisampleEnable = false; rasterizerState.AntialiasedLineEnable = false; g_pd3dDevice->CreateRasterizerState( &rasterizerState, &g_pRasterStates[i] ); } } ... SetRasterize();//On initdevice g_pd3dDevice->RSSetState(g_pRasterStates[ 0 ]); I am not setting any "states" on the fx file, everything in cpp.
  2. Hi I have a problem. Following code is a part of "ParticleGS" sample from DXSDK One thing is bothering me. Why do we first multiply position by inverse of ViewMatrix, and then by "g_mWorldViewProj ". Shouldn't it be correct to leave inverseView and use only "g_mWorldViewProj ". ?(Of course I checked it and it isn't but why?). // GS for rendering point sprite particles. Takes a point and turns it into 2 tris. // [maxvertexcount(4)] void GSScenemain(point VSParticleDrawOut input[1], inout TriangleStream<PSSceneIn> SpriteStream) { PSSceneIn output; // // Emit two new triangles // for(int i=0; i<4; i++) { float3 position = g_positions[i]*input[0].radius; position = mul( position, (float3x3)g_mInvView ) + input[0].pos; output.pos = mul( float4(position,1.0), g_mWorldViewProj ); output.color = input[0].color; output.tex = g_texcoords[i]; SpriteStream.Append(output); } SpriteStream.RestartStrip(); } thx.
  3. Hi I would be grateful If someone could recommend me a good site/book/etc about math/graph . I know that this sound strange so I will try to give an example. In DXSDK there is an example ParticleGS. It is generally not difficult, but before drawing particles we set matViewWorldProj, and Inverse of View matrix. And I don't understand why we are setting inverse. I searched dx documentation but couldn't find any valuable information. As You can see generally I would like to deepen my knowledge about graphics effects and math behind it.
  4. Hi I can't say I am expert on shaders, But Some time ago I wrote really easy class for camera and It was working(i was writing in Dx9 without shaders). Now I am trying to write something similar In Dx10 but the effect is bad. i have problem with rotation. The camera isn't rotating. Object on the screen appears to be blurred or something like that(Instead of rotating). Anyone? Shader // Taken nearly exactly from tutorial 5 matrix World; matrix View; matrix Projection; struct VS_INPUT { float4 Pos : POSITION; }; struct PS_INPUT { float4 Pos : SV_POSITION; }; PS_INPUT VS( VS_INPUT input ) { PS_INPUT output = (PS_INPUT)0; output.Pos = mul( input.Pos, World ); output.Pos = mul( output.Pos, View ); output.Pos = mul( output.Pos, Projection ); return output; } float4 PS1( PS_INPUT input) : SV_Target { return float4(1.0f, 0.0f, 0.0f, 1.0f); } float4 PS2(PS_INPUT input) : SV_Target { return float4(0.0f, 1.0f, 0.0f, 1.0f); } technique10 Render { ///Technique Cut not to make this thread too long } CCamera class void CCamera::Rotation(bool X, bool Y, //Rotation around particular axis for a test only rotation about Right vector bool Z, int rad) { D3DXMATRIX Rot; D3DXMatrixRotationAxis(&Rot, &vRight, rad); D3DXVec3TransformCoord(&vLookAt, &vLookAt, &Rot); D3DXVec3TransformCoord(&vUp, &vUp, &Rot); LookAtLH(); /*Rotation aobut Y it also isn't working D3DXMatrixRotationY(&Rot, rad); D3DXVec3TransformCoord(&vRight, &vRight, &Rot); D3DXVec3TransformCoord(&vLookAt, &vLookAt, &Rot); LookAtLH();*/ } void CCamera::LookAtLH() { D3DXMatrixLookAtLH(&matView, &vEye, &vUp, &vLookAt); } Main cpp void Render() { //.... camera1.Rotation(1,1,1,10.0f); g_pWorldVariable->SetMatrix((float*)&g_World); g_pViewVariable->SetMatrix((float*)&camera1.GetViewMatrix()); g_pProjectionVariable->SetMatrix((float*)&camera1.GetProjMatrix()); D3D10_TECHNIQUE_DESC techDesc; g_pTechnique->GetDesc(&techDesc); for(UINT p=0; p<1; ++p) { g_pTechnique->GetPassByIndex(p)->Apply(0); g_pd3dDevice->DrawIndexed(36, 0, 0); } //...... } camera1.Rotation(1,1,1,10.0f); - As You can see instead of changing variable I put 10.0f But it doesn't matter if I give here t(time variable) or 10.0f the effect is still the same)
  5. Same model different item

    Thank You for your answer now I understand that I don't have to do as much work as I thought. :)
  6. I am sorry if this problem has been discussed before, unfortunately I couldn't find anything about it. I made my first game model It's a dwarf but of course it doesn't matter. In every tutorial I was doing, every model had items(such as weapon) "sticked" to it. But let's say that I want dwarf to be PC and I would like to use 10 different types of weapons(they are completly different not only colour) for him 10 different types of armor, and 10 types of helmets. Would that mean that I have to make 10*10*10=1000 models of dwarf with different items??