Jump to content
  • Advertisement

Christian Johansson

  • Content Count

  • Joined

  • Last visited

Community Reputation

130 Neutral

About Christian Johansson

  • Rank
  1. Christian Johansson

    Pixel Shader Render probs.

    Okey i've got my Pixel Shader implemented but i have a weird prob. When i try to draw my effect (pass) on the mesh it's just dissapears and when i try render the mesh without the effect (pass) it renders but ofcourse without any effect. Here's my SetShader snippet: void SetShader() { effectShader->SetMatrix("worldViewProj", &proj); effectShader->SetMatrix("worldView", &proj); effectShader->SetVector("lightPos", &lightPos); Device->SetVertexDeclaration(ShaderDeclaration); } here's where i Load my Mesh: void LoadPSObjects() { D3DXLoadMeshFromX("crate.x", D3DXMESH_SYSTEMMEM,Device, NULL, NULL, NULL, NULL, &Model); // Copy declaration into mesh model. Model->CloneMesh(D3DXMESH_MANAGED, SDec, Device, &Model); // Calculate all the normals of the model. D3DXComputeNormals(Model, NULL); // Calculate the tangents and binormals. D3DXComputeTangent(Model, 0, 0, 0, true, NULL); // Load the decal image. D3DXCreateTextureFromFile(Device, "decal.tga", &Texture); // Load bump map. D3DXCreateTextureFromFile(Device, "normal.tga", &bumpMap); } Here's where i load my .FX file void LoadFXFile() { // Set our states. // We can use this to store any errors when compiling the shader effect file. LPD3DXBUFFER errors = NULL; // Load the effect file. if(FAILED(D3DXCreateEffectFromFile(Device, "effect.fx", NULL, NULL, 0, NULL, &effectShader, &errors))) { // Display errors. LPVOID compileErrors = errors->GetBufferPointer(); // Show the errors to the user. MessageBox(NULL, (const char*)compileErrors, "Shader Compile Error...", MB_OK | MB_ICONEXCLAMATION); } } And at last the render part: ... Device->BeginScene(); ... effectShader->SetTechnique("BumpMapping"); effectShader->SetTexture("decal", Texture); effectShader->SetTexture("bump", bumpMap); SetShader(); effectShader->Begin(NULL, 0); effectShader->Pass(0); Model->DrawSubset(0); effectShader->End(); effectShader->End(); I can't see the prob? Can you? Best regards, Christian.
  2. Christian Johansson

    Pixel Shader Probs.

    OKey i found a solution for VC++ 6.0 =P Or it's inside DX9. Latest Dx9 SDK doesn't use BeginPass and EndPass ut uses Pass (as beginpass) and End (as endpass) Thansk for the help anyway! regards, Christian.
  3. Christian Johansson

    Pixel Shader Probs.

    Okey i have implemented Pixel Shader in my Engine however i read somewhere that in the latest DirectX 9 SDK there's an incompatibility with VC++ 6.0 that makes this happen: BeginPass' : is not a member of 'ID3DXEffect' Am i right? If so how to solve it? Best regards, Christian.
  4. Christian Johansson

    Normal Mapping?

    Quote:Do you know how to write shaders? Yes i do! =) Okey i found one now, gonna look into it now! =) Thx anyway! Kind regards, Christian.
  5. Christian Johansson

    Normal Mapping?

    Okey I KNOW that this isn't the first thread nor the last that has/gonna been posted here however i just don't seem to come over a GOOD Source,Tutorial, explenation on how to do normal mapping. I've searched and searched with really no good result. So, is there anyone who knows of something that i might have use for? Kind regards, Christian.
  6. Christian Johansson

    Stencil Buffer (Shadow) Problem

    Thank's paic and haegarr. IMO i think i have to combine both of ur will and come up with a solution rather then a workaround. I haven't tried your solution yet paic though i think as haegarr stated, i must check the Shadow Render. But i'll give it a shot and maybe i can dig up a solution based on your theory?(solution). Else, i just have to dig up another Shadow code that works better. =) Best regards, both of you, Christian. [Edited by - Christian Johansson on November 10, 2005 10:34:34 AM]
  7. Christian Johansson

    Stencil Buffer (Shadow) Problem

    Yeah i know that, BUT it doesn't matter WHAT i set as a light it can be a cube a sphere or a Car, it's just numbers of a position, however that position is based upon the lightsources position so that we think that "the light casts a shadow" ;P This confusing me just MORE =P But i managed to get some progress, i managed to move my object AND the shadow, but it remains as in picture number 2 (Moved!) =) Here's what i've added: inside the part where the shadow is calculated and drawn: [SOURCE] D3DXMatrixIdentity( &m_matCrate ); D3DXVECTOR3 vLightInWorldSpace(plight1.Position.x, plight1.Position.y, plight1.Position.z); D3DXVECTOR3 bposition(Boxposition[0],Boxposition[1]-2,Boxposition[2]); D3DXVECTOR3 vLightInObjectSpace; D3DXMatrixMultiply(&m_matCrate, &m_matCrate, &W); // _NEW_ D3DXMATRIXA16 matInverse; D3DXMatrixInverse( &matInverse, NULL, &m_matCrate ); D3DXVec3TransformNormal( &vLightInObjectSpace, &vLightInWorldSpace, &matInverse ); m_pShadowVolume->render(Device); // _NEW_ Device->SetTransform(D3DTS_WORLD, &m_matCrate);// _NEW_ m_pShadowVolume->buildShadowVolume( Crate, vLightInObjectSpace ); [/SOURCE] Damn i got to read urs twice before i'm getting it! =P What are u doing to my brain? *L* ;) [Edited by - Christian Johansson on November 9, 2005 4:43:40 PM]
  8. Christian Johansson

    Stencil Buffer (Shadow) Problem

    Quote:Original post by haegarr Well, I actually _have_ missed something: the render routine _does_ set the trafo to the space of the crate. Sorry for that. xP Quote: Hi, if m_pShadowVolume->buildShadowVolume(Crate, vLightInObjectSpace); is the line that build the shadow volume, then the error probably comes from this method. So post the code and we'll be able the spot it ^^ For your problem, you have to transform the vertices used for the shadow extrusion by the model matrix. And for the problem with the "another Shadow Example" ... I don't understand it ^^ Try posting a screenshot ^^ Done! ;) A picture says more then 1000 words... is hat why we like screenshots? ;) Oh BTW, here's a screenie of the shadow with my actual code i'm using right now (the one i posted first): Moved! [Edited by - Christian Johansson on November 9, 2005 3:45:11 PM]
  9. Christian Johansson

    Stencil Buffer (Shadow) Problem

    Hehe yeah the light CAN be confusing. Think of he pointlight as this: A light bulb, that i think might clear some of ur confusiness! ;P Well yes, i agree, i think i have to implement a code that changes the shadow aspect depending on the objects position. How that should be done is another chapter... =) BUT i have another Code snippet of stencil buffer that renders shadow AND moves it along with the object BUT doesn't changes in align depending on the light source so it remains as if the shadow was from where it once was rendered: The code is slightly simplier: void RenderShadow() { Device->SetRenderState(D3DRS_STENCILENABLE, true); Device->SetRenderState(D3DRS_STENCILFUNC, D3DCMP_EQUAL); Device->SetRenderState(D3DRS_STENCILREF, 0x0); Device->SetRenderState(D3DRS_STENCILMASK, 0xffffffff); Device->SetRenderState(D3DRS_STENCILWRITEMASK, 0xffffffff); Device->SetRenderState(D3DRS_STENCILZFAIL, D3DSTENCILOP_KEEP); Device->SetRenderState(D3DRS_STENCILFAIL, D3DSTENCILOP_KEEP); Device->SetRenderState(D3DRS_STENCILPASS, D3DSTENCILOP_INCR); // increment to 1 // position shadow D3DXVECTOR4 lightDirection(plight1.Position.x, plight1.Position.y, plight1.Position.z, 0.0f); D3DXPLANE groundPlane(0.0f, 0.1f, 0.0f, 0.0f); D3DXMATRIX S; D3DXMatrixShadow( &S, &lightDirection, &groundPlane); D3DXMATRIX T; D3DXMatrixTranslation( &T, Boxposition[0], Boxposition[1], Boxposition[2]); D3DXMATRIX W = T * S; Device->SetTransform(D3DTS_WORLD, &W); // alpha blend the shadow Device->SetRenderState(D3DRS_ALPHABLENDENABLE, true); Device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); Device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); D3DMATERIAL9 mtrl = d3d::InitMtrl(d3d::BLACK, d3d::BLACK, d3d::BLACK, d3d::BLACK, 0.0f); mtrl.Diffuse.a = 0.5f; // 50% transparency. // Disable depth buffer so that z-fighting doesn't occur when we // render the shadow on top of the floor. Device->SetRenderState(D3DRS_ZENABLE, false); Device->SetMaterial(&mtrl); Device->SetTexture(0, 0); Crate->DrawSubset(0); Device->SetRenderState(D3DRS_ZENABLE, true); Device->SetRenderState(D3DRS_ALPHABLENDENABLE, false); Device->SetRenderState(D3DRS_STENCILENABLE, false); } And the result: Object Not moved! Object Moved!
  10. Christian Johansson

    Stencil Buffer (Shadow) Problem

    Quote:Original post by paic Hi, if m_pShadowVolume->buildShadowVolume(Crate, vLightInObjectSpace); is the line that build the shadow volume, then the error probably comes from this method. So post the code and we'll be able the spot it ^^ For your problem, you have to transform the vertices used for the shadow extrusion by the model matrix. And for the problem with the "another Shadow Example" ... I don't understand it ^^ Try posting a screenshot ^^ Oops... yeah there's more code... sorry... Here it comes: (shadowvolume.h): class ShadowVolume { public: void reset() { m_dwNumVertices = 0L; } HRESULT buildShadowVolume( LPD3DXMESH pObject, D3DXVECTOR3 vLight ); HRESULT render( LPDIRECT3DDEVICE9 pd3dDevice ); private: void addEdge( WORD* pEdges, DWORD& dwNumEdges, WORD v0, WORD v1 ); D3DXVECTOR3 m_pVertices[32000]; // Vertex data for rendering shadow volume DWORD m_dwNumVertices; }; struct ShadowVertex { D3DXVECTOR4 p; //D3DXVECTOR4 n; D3DCOLOR color; enum FVF { FVF_Flags = D3DFVF_XYZRHW | D3DFVF_DIFFUSE }; }; //----------------------------------------------------------------------------- // Name: render // Desc: //----------------------------------------------------------------------------- HRESULT ShadowVolume::render( LPDIRECT3DDEVICE9 pd3dDevice ) { pd3dDevice->SetFVF( D3DFVF_XYZ ); return pd3dDevice->DrawPrimitiveUP( D3DPT_TRIANGLELIST, m_dwNumVertices/3, m_pVertices, sizeof(D3DXVECTOR3) ); } //----------------------------------------------------------------------------- // Name: buildShadowVolume() // Desc: Takes a mesh as input, and uses it to build a shadow volume. The // technique used considers each triangle of the mesh, and adds it's // edges to a temporary list. The edge list is maintained, such that // only silohuette edges are kept. Finally, the silohuette edges are // extruded to make the shadow volume vertex list. //----------------------------------------------------------------------------- HRESULT ShadowVolume::buildShadowVolume( LPD3DXMESH pMesh, D3DXVECTOR3 vLight ) { // Note: the MESHVERTEX format depends on the FVF of the mesh struct MESHVERTEX { D3DXVECTOR3 p, n; FLOAT tu, tv; }; MESHVERTEX* pVertices; WORD* pIndices; // Lock the geometry buffers pMesh->LockVertexBuffer( 0L, (LPVOID*)&pVertices ); pMesh->LockIndexBuffer( 0L, (LPVOID*)&pIndices ); DWORD dwNumFaces = pMesh->GetNumFaces(); // Allocate a temporary edge list WORD* pEdges = new WORD[dwNumFaces*6]; if( pEdges == NULL ) { pMesh->UnlockVertexBuffer(); pMesh->UnlockIndexBuffer(); return E_OUTOFMEMORY; } DWORD dwNumEdges = 0; // For each face for( DWORD i=0; i<dwNumFaces; i++ ) { WORD wFace0 = pIndices[ 3 * i + 0 ]; WORD wFace1 = pIndices[ 3 * i + 1 ]; WORD wFace2 = pIndices[ 3 * i + 2 ]; D3DXVECTOR3 v0 = pVertices[ wFace0 ].p; D3DXVECTOR3 v1 = pVertices[ wFace1 ].p; D3DXVECTOR3 v2 = pVertices[ wFace2 ].p; // Transform vertices or transform light? D3DXVECTOR3 vCross1(v2-v1); D3DXVECTOR3 vCross2(v1-v0); D3DXVECTOR3 vNormal; D3DXVec3Cross( &vNormal, &vCross1, &vCross2 ); if( D3DXVec3Dot( &vNormal, &vLight ) >= 0.0f ) { addEdge( pEdges, dwNumEdges, wFace0, wFace1 ); addEdge( pEdges, dwNumEdges, wFace1, wFace2 ); addEdge( pEdges, dwNumEdges, wFace2, wFace0 ); } } for( i=0; i<dwNumEdges; i++ ) { D3DXVECTOR3 v1 = pVertices[pEdges[2*i+0]].p; D3DXVECTOR3 v2 = pVertices[pEdges[2*i+1]].p; D3DXVECTOR3 v3 = v1 - vLight*500; D3DXVECTOR3 v4 = v2 - vLight*500; // Add a quad (two triangles) to the vertex list m_pVertices[m_dwNumVertices++] = v1; m_pVertices[m_dwNumVertices++] = v2; m_pVertices[m_dwNumVertices++] = v3; m_pVertices[m_dwNumVertices++] = v2; m_pVertices[m_dwNumVertices++] = v4; m_pVertices[m_dwNumVertices++] = v3; } // Delete the temporary edge list delete[] pEdges; // Unlock the geometry buffers pMesh->UnlockVertexBuffer(); pMesh->UnlockIndexBuffer(); return S_OK; } //----------------------------------------------------------------------------- // Name: addEdge() // Desc: Adds an edge to a list of silohuette edges of a shadow volume. //----------------------------------------------------------------------------- void ShadowVolume::addEdge( WORD* pEdges, DWORD& dwNumEdges, WORD v0, WORD v1 ) { // Remove interior edges (which appear in the list twice) for( DWORD i = 0; i < dwNumEdges; ++i ) { if( ( pEdges[2*i+0] == v0 && pEdges[2*i+1] == v1 ) || ( pEdges[2*i+0] == v1 && pEdges[2*i+1] == v0 ) ) { if( dwNumEdges > 1 ) { pEdges[2*i+0] = pEdges[2*(dwNumEdges-1)+0]; pEdges[2*i+1] = pEdges[2*(dwNumEdges-1)+1]; } --dwNumEdges; return; } } pEdges[2*dwNumEdges+0] = v0; pEdges[2*dwNumEdges+1] = v1; dwNumEdges++; }
  11. Christian Johansson

    Stencil Buffer (Shadow) Problem

    Okey i got Shadows up and set, renders fine. Now to my prob. Let's say i have a PointLight @ 6.0,6.0,6.0 and a Crate @ 0.0,0.0,0.0 (Center) it casts a shadow of the crate on the floor. BUT when i move the Crate in let's say + X-Axis the Crates moves but the light still casts a shadow as if the Crate was @ 0.0,0.0,0.0. I know it's my Shadow Part that is the prob, however i've tried another Shadow Example that moves the shadow with the Crate BUT the light casts the shadow as if the light was moved WITH the crate even if it's still @ same place. So i guess i will stick wih my shadow example i'm using now and trying to get some help instead. Here's my code: void renderShadowToStencilBuffer( void ) { // Disable z-buffer writes (note: z-testing still occurs), and enable the // stencil-buffer Device->SetRenderState( D3DRS_ZWRITEENABLE, FALSE ); Device->SetRenderState( D3DRS_STENCILENABLE, TRUE ); // Dont bother with interpolating color Device->SetRenderState( D3DRS_SHADEMODE, D3DSHADE_FLAT ); // Set up stencil compare fuction, reference value, and masks. // Stencil test passes if ((ref & mask) cmpfn (stencil & mask)) is true. // Note: since we set up the stencil-test to always pass, the STENCILFAIL // renderstate is really not needed. Device->SetRenderState( D3DRS_STENCILFUNC, D3DCMP_ALWAYS ); Device->SetRenderState( D3DRS_STENCILZFAIL, D3DSTENCILOP_KEEP ); Device->SetRenderState( D3DRS_STENCILFAIL, D3DSTENCILOP_KEEP ); // If z-test passes, inc/decrement stencil buffer value Device->SetRenderState( D3DRS_STENCILREF, 0x1 ); Device->SetRenderState( D3DRS_STENCILMASK, 0xffffffff ); Device->SetRenderState( D3DRS_STENCILWRITEMASK, 0xffffffff ); Device->SetRenderState( D3DRS_STENCILPASS, D3DSTENCILOP_INCR ); // Make sure that no pixels get drawn to the frame buffer Device->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE ); Device->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_ZERO ); Device->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_ONE ); if( g_bTwoSidedStencilsAvailable == true ) { // With 2-sided stencil, we can avoid rendering twice: Device->SetRenderState( D3DRS_TWOSIDEDSTENCILMODE, TRUE ); Device->SetRenderState( D3DRS_CCW_STENCILFUNC, D3DCMP_ALWAYS ); Device->SetRenderState( D3DRS_CCW_STENCILZFAIL, D3DSTENCILOP_KEEP ); Device->SetRenderState( D3DRS_CCW_STENCILFAIL, D3DSTENCILOP_KEEP ); Device->SetRenderState( D3DRS_CCW_STENCILPASS, D3DSTENCILOP_DECR ); Device->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE ); // Draw both sides of shadow volume in stencil/z only Device->SetTransform( D3DTS_WORLD, &m_matCrate ); m_pShadowVolume->render( Device ); Device->SetRenderState( D3DRS_TWOSIDEDSTENCILMODE, FALSE ); } else { // Draw front-side of shadow volume in stencil/z only Device->SetTransform( D3DTS_WORLD, &m_matCrate ); m_pShadowVolume->render( Device ); // Now reverse cull order so back sides of shadow volume are written. Device->SetRenderState( D3DRS_CULLMODE, D3DCULL_CW ); // Decrement stencil buffer value Device->SetRenderState( D3DRS_STENCILPASS, D3DSTENCILOP_DECR ); // Draw back-side of shadow volume in stencil/z only Device->SetTransform( D3DTS_WORLD, &m_matCrate ); m_pShadowVolume->render( Device ); } // Restore render states Device->SetRenderState( D3DRS_SHADEMODE, D3DSHADE_GOURAUD ); Device->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW ); Device->SetRenderState( D3DRS_ZWRITEENABLE, TRUE ); Device->SetRenderState( D3DRS_STENCILENABLE, FALSE ); Device->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE ); } void renderShadowToScene( void ) { // Set render states Device->SetRenderState( D3DRS_ZENABLE, FALSE ); Device->SetRenderState( D3DRS_STENCILENABLE, TRUE ); Device->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE ); Device->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA ); Device->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA ); Device->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); Device->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); Device->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE ); Device->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); Device->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); Device->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); // Only write where stencil value >= 1 (count indicates # of shadows that // overlap that pixel) Device->SetRenderState( D3DRS_STENCILREF, 0x1 ); Device->SetRenderState( D3DRS_STENCILFUNC, D3DCMP_LESSEQUAL ); Device->SetRenderState( D3DRS_STENCILPASS, D3DSTENCILOP_KEEP ); // Draw a big, gray square Device->SetFVF( ShadowVertex::FVF_Flags ); Device->SetStreamSource( 0, m_pBigSquareVB, 0, sizeof(ShadowVertex) ); Device->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2 ); // Restore render states Device->SetRenderState( D3DRS_ZENABLE, TRUE ); Device->SetRenderState( D3DRS_STENCILENABLE, FALSE ); Device->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE ); } [/SOURCE] And here's the code for create it inside "Main loop": D3DXMatrixIdentity( &m_matCrate ); D3DXVECTOR3 vLightInWorldSpace(plight1.Position.x, plight1.Position.y, plight1.Position.z); D3DXVECTOR3 vLightInObjectSpace; D3DXMATRIXA16 matInverse; D3DXMatrixInverse( &matInverse, NULL, &m_matCrate ); D3DXVec3TransformNormal( &vLightInObjectSpace, &vLightInWorldSpace, &matInverse ); m_pShadowVolume->buildShadowVolume( Crate, vLightInObjectSpace ); [/SOURCE] The plight1 is the pointlight named plight1. Best regards, Christian.
  12. Christian Johansson

    3D Studio MAX "Scaling" problem...

    A strange problem (at least I think it's a problem, it might be me that is the problem =P) occurs everytime i scale a mesh inside MAX and then trying to use it in my engine as a mesh (.x). If the Object in MAX is HUGHE from the beggining and i want to scale it it doesn't appears in my engine or looks weird. If i keep the actual size it returns to be normal. How Come? Or am i missing something important? Kind regards Christian
  13. Christian Johansson

    specularenable = true?

    Quote:Original post by S1CA Assuming you're talking about Direct3D 9 and the fixed function pipeline... Sorry if some of these are obvious questions, but you didn't give much detail in your post: 1. What is the Specular member of your D3DMATERIAL9 set to? If it's set to 0 (or not set...), when the specular light is multiplied by that colour, 0*N=0 so you get black which gives you no specular. 2. What's the Power member of your D3DMATERIAL9 set to? It shouldn't be 0, the Blinn-Phong specular equation used by the D3D FFP exponentiates the specular contribution by the power (aka "shininess") which controls how sharp the specular highlights are. 3. What's the Specular member of your D3DLIGHT9 set to? As with the Specular member of your material, this gets multiplied by the specular intensity and the material; if it's 0 you won't see any specular. 4. What's in your vertex format? a) a normal? If you're seeing correct diffuse, then I'll assume you have, if not, then you'll need one or Mr Blinn's magic N.H aint gonna work. b) a RHW? If you have, pre-transformed vertices and the fixed function pipeline don't mix very well; use one or the other if you are. c) a D3DFVF_SPECULAR (or declaration using COLOR1)? If you have, then you'll need to make your intentions clear to D3D's FFP using the D3DRS_SPECULARMATERIALSOURCE render state. Even then, beware that there's only one specular iterator available on most hardware (COLOR1) so don't expect to be able to interpolate more than 2 non-texture colours per vertex. 5. What's in your SetTextureStageState() calls? Anything involving D3DTA_SPECULAR? If so, bear in mind that D3DRS_SPECULARENABLE=TRUE enables the post pixel processing specular addition so any use (or abuse) of specular during pixel processing can interfere with the result you get. 6. Have you set the D3DRS_LOCALVIEWER render state to TRUE at all (or not set it to a decent default)? a) If so, how have you set your projection matrix up? Orthogonal won't work; "W-friendly" is preferable. b) If so, do you set your view matrix separately from your world and projection matrices? If not, try doing so. 7. Do you use any form of frame buffer blending for what's being rendered? Multiplactive blends in particular aren't going to show much of white specular highlights... 8. Are you using fog? If so, which settings? Fog and specular are often applied in the same part of the graphics chip - older chips sometimes share stuff between them so things like alpha in the specular colour can interfere with the fog and vice versa. BTW: the stencil buffer operations shouldn't affect anything with specular on its own - but it depends on the particular flavour of shadow technique you're using (there are lots of variations on the plain stencil shadow!). If you're using a method that performs a dark/unlit or bright/lit pass separately based on what's in the stencil, then it is worth checking that one isn't causing the other to be rejected. Z buffer occlusion for multipass techniques is also an issue with stencil shadows - though usually shows up as Z fighting when the camera gets close rather than nothing appearing at all. Simple way to tell though... disable your shadows and see if your specular highlights come back [smile] divide and conquer debugging is sometimes the only way! Oh NO... What a shame... forgot to add light.Specular.r ,g ,b ,a... Oops.. Anyway, Thank so much for ur offer and will. Great regards, Christian.
  14. Christian Johansson

    specularenable = true?

    Okey i have this line in my code and i know exactly what it does: Device->SetRenderState(D3DRS_SPECULARENABLE, true); However, i DON'T gets any specular on my textures! =/ Yes i'm using a lightsource (pointlight) and it's enabled! Any suggestions? Oh btw, i also have shadow (stencil buffer), could that be a reason? Kind regards, Christian.
  15. Christian Johansson

    Okey, last try! Coding Help needed!

    Quote:Original post by Armadon using D3DXMatrixTranslation() translates a matrix by a giving set of coordinates. For each object in your game you will essentially have a world matrix. This world matrix will represent the objects position in world space. What the position of each entity represents is the coordinates in world space and this is all you need. You don't need to transform the entities back into object space. I hope this helps. Take care. It'll sure help! I appriciate your will and patience. I'm glad that ppl like you stays at forums of this kind, 'couse ur needed indeed. Have a great time rest of your day. Kind regards, Christian. Edit: God damn, u helped me out. It works =D *L* Man i'm so glad right now! *jumping* [Edited by - Christian Johansson on November 7, 2005 3:01:43 PM]
  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!