Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

dragon.R

Member Since 02 Apr 2011
Offline Last Active Yesterday, 09:09 PM
-----

Posts I've Made

In Topic: FPS rise suddenly every few seconds

28 February 2013 - 06:51 AM

Are you using .NET?

I'm using c++ and D3D 9


In Topic: FPS rise suddenly every few seconds

28 February 2013 - 02:50 AM

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.


In Topic: FPS rise suddenly every few seconds

28 February 2013 - 01:51 AM

This is just a guess. I read something that drivers are sometimes able to counter-act bad code by recognizing problematic instructions. For example, you code something in your rendering loop that should be elsewhere in the application. It could be that the same problem exists on the HD5670 and the GT430 but the driver is preventing the issue from being really noticed on both. But without more info it is impossible to say for sure.

 

However, it could be a bunch of different things. Like switching shaders between geometry and pixel. It is almost impossible to be helpful without more information.

 

 

PS, I would try on some other hardware as well. 2 is not enough, there could be a defective card.

 

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~


In Topic: DX9 How much bones is supported for hardware skinning?

26 February 2013 - 03:07 AM

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).


In Topic: Deferred decal and texel offset

12 November 2012 - 01:16 AM

Can you post up the code for how you calculate the screen-space texture-coordinates from vertices (with and without your not-working 0.5 fix)?


here is my 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;
}

In the pixel shader I use oUV.xy/oUV.w as texture coordinate.

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));
}

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.

PARTNERS