Jump to content

  • Log In with Google      Sign In   
  • Create Account


-Tau-

Member Since 13 Jul 2011
Offline Last Active Feb 01 2014 11:43 AM
-----

Topics I've Started

XAudio2 Exception 80000003

31 January 2014 - 01:55 AM

First, idon't know where i should post this, so i post it here.

I'm using XAudio2 in my game for sound. Playing unmodified sound works well but when i use SetOutputMatrix program crashes with Exception 80000003.

void AUDIO_STATE::UpdateAudio(simpleSound *in_ss)
{
	X3DAudioCalculate( x3DInstance, &listener, &in_ss->emitter, dwCalcFlags, &dspSettings );

	if (in_ss->p_SV)
	{
		in_ss->p_SV->SetFrequencyRatio( dspSettings.DopplerFactor );
		in_ss->p_SV->SetOutputMatrix( pMasteringVoice, INPUTCHANNELS, nChannels, matrixCoefficients );
		in_ss->p_SV->SetOutputMatrix( pSubmixVoice, 1, 1, &dspSettings.ReverbLevel );

		XAUDIO2_FILTER_PARAMETERS FilterParametersDirect = { LowPassFilter, 2.0f * sinf(X3DAUDIO_PI/6.0f * dspSettings.LPFDirectCoefficient), 1.0f };
		in_ss->p_SV->SetOutputFilterParameters(pMasteringVoice, &FilterParametersDirect);
		XAUDIO2_FILTER_PARAMETERS FilterParametersReverb = { LowPassFilter, 2.0f * sinf(X3DAUDIO_PI/6.0f * dspSettings.LPFReverbCoefficient), 1.0f };
		in_ss->p_SV->SetOutputFilterParameters(pSubmixVoice, &FilterParametersReverb);
	}
}

When i remove lines in_ss->p_SV->SetOutputMatrix, there are no problems, the sound plays.

Did someone ever had similar problem? Do you know what could cause this?

 

Also most of initialization of my sound engine is a modification to DX sdk XAudio2Sound3D.


Texture colors, debug/release

19 September 2013 - 02:29 AM

Everything works fine in debug version, but when i switch to release shadows and reflection above water are somehow weird. Some objects wont cast shadows at all, and some doesn't seem to work properly. Problems with reflection are only above water. Below water works both relfection and refraction, but above water is only refraction ok, reflection is diplayed with wrong colors.

I include images, also UI textures are darker in release version. Some aren't aven visible, no idea why.

 

Does anyone know the possible reasons for such errors?

 

debug reflection

http://img.pictureup.cz/19092013/1b316d7bb5b2a3834edcb9f95d131c3e4858b906.png

release reflection

http://img.pictureup.cz/19092013/658e95aa048d149cf5687bac130f8daf2878dc91.png

debug shadows

http://img.pictureup.cz/19092013/7f865425919898796061b76a9b3d90849ca386f1.png

release shadows

http://img.pictureup.cz/19092013/8c30b92c80259e75887593cd465149eb412e4996.png

 

Edit:

Refraction is wrong too when rendering below water, which means rendering geometry above water to texture doesn't work as it should.


Animation blending

18 May 2013 - 11:31 AM

Hi everyone,

I have model of a 1-persone submarine with 3 animations. ATM i'm working only with 2 of them: first for back elevator up/down turning and second for side turbine up/down turning. (they are independent)

I'm trying to blend animations with ID3DXAnimationController-s SetTrackPriority, SetTrackEnable and SetTrackWeight. When i have only one enabled it plays correctly, but when i try to blend them, they run only to middle. If i try to play them with double speed they still run only to middle but 2-times. I tried to set SetTrackWeight for both to 0.5 and then both to 1.0 but it didn't work.

Is it possible to blend such animations with ID3DXAnimationController or are there different ways?


Particle rendering problem

21 September 2012 - 03:19 AM

Hi all,
I need som advice for vertex declaration / FVF with particles. Main issue is the texture on particles.
When i first created particle class and class to manipulate with particles, particle vertex had position normal and texcoord. After a while i understood that particle do not need a normal so i removed it. After that particle were either not drawn or drawn with only 1 color. First i used FVF, then i changed to vertex declaration in hope it will solve this problem.


struct PARTICLEVERTEX

{

	D3DXVECTOR3 pos;

	float tu, tv;

};



#define D3DFVF_PARTICLEVERTEX (D3DFVF_XYZ|D3DFVF_TEX1)



void ParticleSystem::OnCreate(IDirect3DDevice9* pd3dDevice)

{

	PARTICLEVERTEX *_Vertices = new PARTICLEVERTEX[4];

	VOID *_pVertices;

	pd3dDevice->CreateVertexBuffer( 4* sizeof( PARTICLEVERTEX ),

									0, 0,

									D3DPOOL_MANAGED, &m_pVB, NULL );

	m_pVB->Lock( 0, 0, ( void** )&_pVertices, 0 );

	{

		_Vertices[0].pos=D3DXVECTOR3(-0.5 , -0.5, 0);

		_Vertices[0].tu=0;

		_Vertices[0].tv=1;

		_Vertices[1].pos=D3DXVECTOR3(-0.5 , 0.5, 0);

		_Vertices[1].tu=0;

		_Vertices[1].tu=0;

		_Vertices[2].pos=D3DXVECTOR3(0.5 , -0.5, 0);

		_Vertices[2].tu=1;

		_Vertices[2].tv=1;

		_Vertices[3].pos=D3DXVECTOR3(0.5 , 0.5, 0);

		_Vertices[3].tu=1;

		_Vertices[3].tv=0;

	}

	memcpy( _pVertices, _Vertices, sizeof(PARTICLEVERTEX)*4 );

	m_pVB->Unlock();

	delete []_Vertices;



	D3DVERTEXELEMENT9 f_par_VDecl[] =

	{

		{ 0, 0,  D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },

		{ 0, 12, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 },

		D3DDECL_END()

	};



	pd3dDevice->CreateVertexDeclaration( f_par_VDecl, &m_pDecl );

}



void ParticleSystem::draw(ID3DXEffect* pEffect, IDirect3DDevice9* pd3dDevice, double fTime, float fElapsedTime)

{

	if (!pfpar)

		return;



	if (pfpar->time_to_die<fTime)

	{

		particle *tdelete=pfpar;

		pfpar=pfpar->pnext;

		delete tdelete;

	}



	particle *akt=pfpar;



	UINT iP,cP;

	HRESULT hr;

	D3DXMATRIXA16 mWorld;

	pd3dDevice->SetStreamSource( 0, m_pVB, 0, sizeof( PARTICLEVERTEX ) );

	pd3dDevice->SetVertexDeclaration( m_pDecl );



	while (akt)

	{

		if (akt->pnext)

			if (akt->pnext->time_to_die<(float)fTime)

			{

				particle *tdelete=akt->pnext;

				akt->pnext=akt->pnext->pnext;

				delete tdelete;

			}



		akt->move(fTime, fElapsedTime);

		D3DXMatrixTranslation(&mWorld, akt->pos.x, akt->pos.y, akt->pos.z);



		V( pEffect->SetTexture( g_efn->g_txScene, v_ints_tex[akt->i_tex].v_tex[akt->akt_texture] ) );

		

		V( pEffect->SetFloat( g_efn->particleScale, akt->scale) );

		V( pEffect->SetVector( g_efn->g_MaterialColor, &akt->color) );

		V( pEffect->SetMatrix( g_efn->g_mWorld, &mWorld ) );

		V( pEffect->Begin( &cP, 0 ) );

		for( iP = 0; iP < cP; iP++ )

		{

			V( pEffect->BeginPass( iP ) );

			pd3dDevice->DrawPrimitive(	D3DPT_TRIANGLESTRIP, 0, 2);

			pEffect->EndPass();

		}

		pEffect->End();



		akt=akt->pnext;

	}

}



////////////////////

////////////////////

void ParticleVS(float4 iPos : POSITION,

				float2 iTex : TEXCOORD0,

				out float4 oPos : POSITION,

				out float2 oTex : TEXCOORD0)

{

	float4x4 wv = mul(g_mWorld, g_mView);

	oPos = iPos*float4(particleScale, particleScale, particleScale, 1.0) + float4(wv._41, wv._42, wv._43, 0.0);

	oPos = mul( oPos, g_mProj );

	oTex = iTex;

}



float4 ParticlePS(float2 iTex : TEXCOORD0) : COLOR0

{

	return tex2D(g_samScene, iTex)*g_MaterialColor;

}

Skinning problems

23 June 2012 - 02:58 AM

Hi
I have some problems with skinning. Skinning in my app is based on DX SDK sample SkinnedMesh, hlsl skinning. The main problem is following: Some of my models work fine just like they should, but some doesn't. I really don't know what the difference between these models is because i created all of them in the same way.
About these wrong models: It appears that in normal state only one bone plays its animation and moves the entire model with it. Also in one case happens that some of its vertices are dragged somewhere into infinity (idk how to describe it, i will add img).
This happens when camera is behind player and player rotates around y-axis. When camera is placed inside player (1st person ) this problem doesn't occur. I don't switch between 1st and 3rd person camera.
I also wanted to add video of this problem but when i started to record with fraps vertices stopped to fly away.
Question is: is something wrong with my models(i downloaded some free animated models from internet and they worked fine)
Or should i adjust the code to draw these "broken" models. (if yes, how)
In zip file are 3ds max and x files of 2 working models and 2 broken models.
http://www.sendspace.com/file/c376c8
http://img.pictureup...55346751deb.png

PARTNERS