• Content count

  • Joined

  • Last visited

Community Reputation

247 Neutral

About hflong325

  • Rank
  1. Thanks for your reply~It's a good solution and I'll try it later.
  2. Hi~I've read some papers about using an environment cube map for secondary specular lighting and want to try this in my engine, but I don't know very clearly about how to create environment map for an outdoor scene, since the scene is so large, and different area may need different cube maps. If I create them on several places, how can I make sure all the objects can sample the right light infomation, especially for the dynamic objects? If I create cube maps for every single object,then the memory cost may be a problem,and this also cause problems when I deal with the moving object.So how do current game engine usually manage their environment maps? 
  3.   Yes,the texture have a background color of black. What is the 'dilate' filter ? Can I use this in D3D9 ? Thank you~   simply said: for every 'background' pixel search the closest non-background pixel and use that color instead. that's done when you generate the mipmaps. for testing you could e.g. in photoshop select all black areas, apply a blur filter repeatedly until no background color is visible anymore.   Thanks~I will try it.
  4.   Yes,the texture have a background color of black. What is the 'dilate' filter ? Can I use this in D3D9 ? Thank you~
  5. Hi~Recently I downloaded some skined meshes for my demo,some of them were mirrored and just have a half of contents in the texture(since the UV in mesh were also mirrored). Then I found a problem that when the mip level increases,a black line appears in the middle of mesh.Is it because the GPU  samples some background color in the border of the actual image content when  I sample the smaller mipmap? How can I sovle this problem ? Do I need to make some bias or clamp the mip level ?
  6. Yesterday I found a problem of my demo, when the object and camera were far away from (0,0,0), such as  an object at (2000,2000,0) and camera at (2010,2000,0) , the accuracy of Z seemed to declined, lots of Z-Fighting problems appears.   The transform code of my model is:   output.oPosition=mul(output.oPosition,WorldMatrix); output.oPosition=mul(output.oPosition,ViewProj);   When I change to :   output.oPosition=mul(output.oPosition,WorldViewProj);   It became just ok.   Sometimes I need to transform the object to the world space first and do some other transformations, so I'm afraid this problem will apear again,and I don't know why this two pieces of code have such a big difference.
  7. FPS rise suddenly every few seconds

    I'm using c++ and D3D 9
  8. FPS rise suddenly every few seconds

    Some one said,If  "Maximum pre-rendered frames"  is set to more than one, then the CPU is allowed to start rendering subsequent frames without waiting for the current one to be presented. So I think sometimes my update frame rate may be much higher than the truely display frame rate,at that time the FPS will be rised suddenly.
  9. FPS rise suddenly every few seconds

      Thanks for replying. I`ve tried a lot of ways to fix it, and finally I found that when I set the "Maximum pre-rendered frames"  to 1,it will become ok. While the default setting or other values higher than 1 will cause this problem. Instead of setting this parameter on the NVIDIA control panel,Can I set this value by code?Or maybe there have some other ways to solve this problem?Thank you~
  10. I use 80 bones per submesh.Every bone uses 2 constants,the first float4 is a quaternion for rotation,the second is translation(xyz) and scale(w).
  11. Hi. My demo runs well on my HD5670 home computer,but I don't know why when I test it on GT430,the FPS becomes not steady.In most of time it runs at about 30+ frames per second,but every few seconds it well suddenly rise to 200+ frames per second and drop to 30+ immediatly on the next frame. This problem causes my demo runs not smoothly on that machine, and when I lock the frame rate to 30,it became just ok. Does anyone know the reason?
  12. Deferred decal and texel offset

    [quote name='Hodgman' timestamp='1352703549' post='5000133'] Can you post up the code for how you calculate the screen-space texture-coordinates from vertices ([i]with and without your not-working 0.5 fix[/i])? [/quote] here is my code [CODE] void VolumeDecl_vp( float4 iPosition:POSITION, out float4 oUV:TEXCOORD0, out float4 oPos:TEXCOORD1, out float4 oPosition:POSITION ) { iPosition = mul(iPosition,WorldMatrix); oPosition = mul(iPosition,ViewProj); float2 tPos = oPosition.xy/oPosition.w; float2 vPos = float2(0.5*tPos.x,-0.5*tPos.y)+float2(0.5+0.5/screenSize.x,0.5+0.5/screenSize.y); oUV = float4(vPos,0,1)*oPosition.w; oPos = oPosition; } [/CODE] In the pixel shader I use oUV.xy/oUV.w as texture coordinate. [CODE] void VolumeDecl_fp( float4 iUV : TEXCOORD0, float4 iPos : TEXCOORD1, out float4 oColor : COLOR ) { float2 spos = float2(iPos.x / iPos.w, iPos.y / iPos.w); float2 uv = iUV.xy/iUV.w; float depth = tex2Dlod(depthTex,float4(uv,0,0)).r; float4 pos=mul(float4(spos,depth,1),InverseViewProj); pos.xyz/=pos.w; pos.w = 1.f; float4 tPos = mul(pos,DeclMat); float3 uvw = float3(tPos.x,tPos.y,tPos.z); uvw.x = (uvw.x + 1.f) * 0.5f; uvw.y = 0.5f - uvw.y * 0.5f; uvw.z = (uvw.z + 1.f) * 0.5f; clip(uvw.xyz); clip(1 - uvw.xyz); oColor = tex2D(decalTex,float2(uvw.x*DeclParam.z + DeclParam.x,uvw.y*DeclParam.w + DeclParam.y)); } [/CODE] I found that the bright color of edge was came from the transparent part of my decal texture,when I changed the transparent part color to black,the egde became grey.
  13. I have implemented the deferred decal this weekend, I'm using Direct3D9 and hacked the depth buffer as a rendertexture(FOURCC('I','N','T','Z')).Every decal is a cube box.To find the uv coordinate of decal pixels,I have to sample the depth texture and caculate the world position of each pixel,then transform the position to decal space. My problem is, when I have an object in front of the decal,there will be some bright edges around the object.It seems that the depth result on the edge is not currect. I've tried to add 0.5 pixel offset, but it not works.Can someone help me?
  14. [quote name='MJP' timestamp='1350761135' post='4992236'] If you want your transparent geometry to fit in with your HDR scene, you need to light them properly with the same overall lighting intensity that you use for your opaques. You can't just composite them in afterwards with LDR lighting. If you have emissive geometry that generates its own lighting, then you need to be able to set an HDR intensity value so that it will fit in with the scene. [/quote] Thanks.Do you mean I should set a parameter to scale the emissive color? I wonder if it works everywhere in the scenes which have large brightness range. Maybe using the exposure of last frame will be better?
  15. Hi,I am testing HDR for my engine these days. I tried to add a very bright directional light to the scene ,whitch is 10 times brighter than normal LDR light. It looks good after ToneMaping,except the translucent objects.... Because some translucent objects don`t need to be illuminated,they simply output the LDR color of source texture.So after ToneMapping they became very dark. I solved this problem by rendering them after ToneMapping,but another problem is the water reflection. I need to render scene again to create the reflection map,but the water must be rendered before ToneMaping,so the reflection of translucent objects still become very dark... I don't very clear about how to combine the HDR and alpha blend effects.Do I need to increase their brightness when doing water reflection?