Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About ehsan_the_tiamat

  • Rank
  1. ehsan_the_tiamat

    rendering to render target problem (deferred shading)

    SOLVED the problem was setting render targets and cleaning them anyway thanks for the replies
  2. ehsan_the_tiamat

    rendering to render target problem (deferred shading)

    THX for replies I'm not using different sized textures because in the first pass if you sum up all componets(alpha, red, green, blue) you get 32 bits and it works fine. on second render target if you do the same, you get 64 bits and still they have same sizes. although for each render target the size of textures are equal, i dont get my desired results for the second pass. the question is : Should i use 32 bit render targets for the second pass or I do somthing wrong?
  3. hi everyone i have these render targets : first pass : normal : A8R8G8B8 diffuse : A8R8G8B8 specular : A8R8G8B8 depth : R32F second pass : position map : A16R16G16B16F velocity map : A16R16G16B16F the results of first pass render targets are correct but the second shows weird results. is it because i'm using different textures with different size??? i tried this with two techniques but it showed same results as before. thx in advance for your help
  4. HI i wanted to implement a shadow mapping shader with lighting unfortunately because im using PS_2.0 I hadnt have enough instruction slots(my lighting almost takes it all). now i want to seperate lighting and shadowing in two passes. Is this possible??? if its possile what are PS and VS arguments for the second pass. how should i pass lighting color to the second pass to use it for shadowing??? Is there an alternative solution for my problem???
  5. ehsan_the_tiamat

    problem with creating shadow map

    thanks M3d10n. and forgive me because of being a fool!!!! I posted my answer before testing your suggestion. anyway that solved my problem THX a lot.
  6. ehsan_the_tiamat

    problem with creating shadow map

    i'm not rendering a float texture directly to the screen. i just save the shadow map in a .DDS file and in that texture every geometry is white and the back buffer is green
  7. hi my code : struct VS_OUTPUT_DEPTH_MAP { float4 position : POSITION; float depth : TEXCOORD0; }; VS_OUTPUT_DEPTH_MAP depthMap_VS( float4 inPosition : POSITION ) { VS_OUTPUT_DEPTH_MAP output = (VS_OUTPUT_DEPTH_MAP)0; output.position = mul( inPosition, lightViewProjection ); output.depth = output.position.z; return output; } float4 depthMap_PS( VS_OUTPUT_DEPTH_MAP In ) : COLOR0 { float depth = In.depth; return float4(depth, depth, depth, 1.0f); } the problem is in the shadow map i generate, all geometries are white except the back buffer. and it means every pixel in that geometry has equal Z??!!! how is that possible???? (for example a sphere which is all white) here is how i created my shadow map texture : hr = D3DXCreateTexture(g_pd3dDevice, 512, 512, 1, D3DUSAGE_RENDERTARGET, D3DFMT_R32F, D3DPOOL_DEFAULT, &g_pDynamicDepthMap); THX in advance [Edited by - ehsan_the_tiamat on September 15, 2006 2:06:50 PM]
  8. ehsan_the_tiamat

    a question about fresnel effect...

    thanks buddy that helped alot. i'll search more about this.
  9. ehsan_the_tiamat

    a question about fresnel effect...

    Could you explain a little bit more about R0. what are indices of refraction(n1, n2)??? here is my VS and PS for fresnel effect :: VS_OUTPUT_FRESNEL fresnel_VS( float4 inPosition : POSITION, float2 inTexCoord : TEXCOORD0, float3 inNormal : NORMAL ) { VS_OUTPUT_FRESNEL output = (VS_OUTPUT_FRESNEL)0; float3 incident = inPosition.xyz - eyePosition; output.incident = incident; output.reflectVec = reflect(incident, inNormal); float3 cam2Vert = normalize(eyePosition - inPosition.xyz); output.refractVec = refract(cam2Vert, inNormal, etaRatio); output.oPosition = mul(worldViewProjMat, inPosition); output.texCoord = inTexCoord; output.normal = inNormal; output.objPos = inPosition; return output; } float4 fresnel_PS( VS_OUTPUT_FRESNEL In ) : COLOR { float4 texColor = tex2D(meshTextureSampler, In.texCoord); float4 reflectedColor = texCUBE(envMapSampler, In.reflectVec); float4 refractedColor = texCUBE(envMapSampler, In.refractVec); lightFuncOutput lightResult; float4 diffuseSum = 0; float4 specularSum = 0; for(int i = 0; i < numOfLights; i++) { lightResult = LightPoint(lights, In.objPos, In.normal, In.cam2Vert); diffuseSum += lightResult.diffuseResult ; specularSum += lightResult.specularResult ; } float4 ambient = materialAmbient * globalAmbient; float4 diffuse = materialDiffuse * diffuseSum; float4 specular = materialSpecular * specularSum; float4 lightingColor = ambient + diffuse + specular; float4 objColor = lerp(texColor, lightingColor , 0.5); float reflectionCoefficient = max( 0, min(1, bias + scale * pow(1 + dot(In.incident, In.normal), power) ) ); float4 color = reflectionCoefficient * reflectedColor + (1 - reflectionCoefficient) * refractedColor; return lerp(objColor, color, 0.5); }
  10. ehsan_the_tiamat

    a question about fresnel effect...

    Any idea???
  11. hi guys a few days before I borrowed the "The CG Tutorial" from one of my friends for reading one of its chapters named "environment mapping techniques" and i came up with a wierd formula which is :: float reflectionCoefficient = max( 0, min(1, bias + scale * pow(1 + dot(In.incident, In.normal), power) ) ); althouh the formula in the book was mathematical, you see the HLSL equivalent(since i coudn't write the original formula because of the power i posted the one above). my question is what are "bias" "scale" "power" and in what range they should be initialized. it seems to me that scale is between 0 and 1. and also bias is lesser that one because of the min() function but i have no idea about power. if you have any practical values for these globals please send me. THX in advance.
  12. ehsan_the_tiamat

    how should i render my scene with shadow mapping???

    well you misunderstood my question. but thanks for the reply anyway. I have two effect files on is TnL and the other is shadowmapping. the "ObjTexSpecularHandle" technique isn't for the shadowmapping effect file and its for the TnL effect file. my question is how should i put my shadow mapping render loop in the code I mentioned earlier. for example begin and end the TnL rendering and then begin and end the shadowmapping effect???
  13. HI I have a scene with some objects and a TnL.fx file which i use to have Ambient, Diffuse, Specular and bump mapping. and i have a shadow mapping FX file which has a two pass technique. the question is where should i place the code for rendering the shadow map. for example i have this code for my TnL effect file and a geometry named g_pGun to be rendered. this is the rendering part of it :: WorldMat = WorldMat * SGunRotation; g_pTnLEffect->SetMatrix(g_mWorldHandle,&WorldMat); g_WorldViewProj = WorldMat* V * matProj ; g_pTnLEffect->SetMatrix (g_mWorldViewProjectionHandle,&g_WorldViewProj); g_pTnLEffect->SetFloat(g_fTimeHandle, timeElapsed/700); g_pTnLEffect->SetTechnique(ObjTexSpecularHandle); g_pTnLEffect->Begin(&NumPasses, NULL); g_pTnLEffect->BeginPass(0); for(DWORD i = 0; i< g_dwNumMaterialsGun; i++) { g_pTnLEffect->SetTexture(g_MeshTextureHandle, g_pGunTextures); g_pTnLEffect->CommitChanges(); g_pGun->DrawSubset(i); } g_pTnLEffect->EndPass(); g_pTnLEffect->End(); so where should i place my shadow mapping shader to render the shadow map of this object. should it be after the basic TnL or before it. or should i mix shadow mapping FX file with TnL one by adding 2 more passes to TnL
  14. HI I'm developing a game and i need to know why should I use a scripting language? i've seen people talk about them a lot so they're very popular but I dont know what they do in graphics engines. by the way, for an indie 3d game which one should i use: XML or LUA??? THX in advance
  • 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!