10 Replies - 1007 Views - Last Post: 03 February 2013 - 06:18 PM Rate Topic: -----

#1 archonoffate  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 37
  • Joined: 08-May 12

Simple Motion Blur Issues in C++

Posted 01 February 2013 - 04:27 PM

Hi, I'm currently messing around in C++ and have so far made a simple scene with a teapot but I'm trying to get a simple motion blur to appear as the scene rotates from my mouse & keyboard controls. However I'll have to admit I'm a little lost. Any pointers would be greatly appreciated

Initial values:

mCameraRadius    = 15.0f;
	mCameraRotationY = 1.4f * D3DX_PI;
	mCameraHeight    = 5.0f;


Keyboard & Mouse movement

void updateScene(float dt)
{
	mGfxStats->update(dt);

	// Get snapshot of input devices
	gDInput->poll();

	// Check input

	// KEYBOARD
	if (gDInput->keyDown(DIK_W))	 
	{
		mCameraHeight += 25.0f * dt;
	}
	if (gDInput->keyDown(DIK_S))	 
	{
		mCameraHeight -= 25.0f * dt;
	}

	if (gDInput->keyDown(DIK_A))	 
	{
		D3DXMatrixTranslation(&mTeapotWorld, 3.0, 0.0f, 0.0f);
	}
	if (gDInput->keyDown(DIK_D))	 
	{

		D3DXMatrixTranslation(&mTeapotWorld, -3.0f, 0.0f, 0.0f);
	}

	// MOUSE
	// (Scale to make mouse less sensitive) 
	mCameraRotationY += gDInput->mouseDX() / 100.0f;
	mCameraRadius    += gDInput->mouseDY() / 25.0f;

	// If we rotate over 360 degrees, just roll back to 0
	mCameraRotationY = fmodf(mCameraRotationY, 2.0f * D3DX_PI);

	// Don't let radius get too small.
	mCameraRadius = max(mCameraRadius, 3.0f);

	// The camera position/orientation relative to world space can 
	// change every frame based on input, so we need to rebuild the
	// view matrix every frame with the latest changes.
	buildViewMtx();
}


Is This A Good Question/Topic? 0
  • +

Replies To: Simple Motion Blur Issues in C++

#2 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3463
  • View blog
  • Posts: 10,669
  • Joined: 05-May 12

Re: Simple Motion Blur Issues in C++

Posted 01 February 2013 - 05:19 PM

What DirectX version are you using? It looks like you are using a framework on top of DirectX. What framework is it and does it support motion blur?

In the end, I believe that you have to use a pixel shader to get the effect that you are looking for. The issue will be whether you have to code the shader yourself or if you can get the effect ready made.
Was This Post Helpful? 0
  • +
  • -

#3 archonoffate  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 37
  • Joined: 08-May 12

Re: Simple Motion Blur Issues in C++

Posted 01 February 2013 - 05:41 PM

oh sorry I'm using directX 9's framework on this and it should support motion blur.
Was This Post Helpful? 0
  • +
  • -

#4 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3463
  • View blog
  • Posts: 10,669
  • Joined: 05-May 12

Re: Simple Motion Blur Issues in C++

Posted 01 February 2013 - 06:46 PM

Have you looked at the sample in the DirectX 9 SDK that demonstrates motion blur?
http://doc.51windows.../motionblur.htm

Looks like it uses a shader to me.

This post has been edited by Skydiver: 01 February 2013 - 06:47 PM

Was This Post Helpful? 1
  • +
  • -

#5 archonoffate  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 37
  • Joined: 08-May 12

Re: Simple Motion Blur Issues in C++

Posted 01 February 2013 - 07:31 PM

thanks I'll see if I'm able to decifer where the motion blur happens
Was This Post Helpful? 0
  • +
  • -

#6 archonoffate  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 37
  • Joined: 08-May 12

Re: Simple Motion Blur Issues in C++

Posted 03 February 2013 - 12:37 PM

Sorry for the double post, but its been a few days since I last posted so hopefully that makes up for this... I attempted to use the pixelshader fx file in my current project to see if that method of integration would work. It has to a degree however I'm being presented with alot of errors that really don't tell me what's going on.

FX File:

Spoiler


Error Captures:

Spoiler


however I do notice alot of invalid call errors when it runs:

_INVALIDCALL (0x8876086c)

So my initial thoughts are something isn't initializing correctly

(I also used spoilers to hide the error captures and fx file so this post wouldn't be huge)
Was This Post Helpful? 0
  • +
  • -

#7 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3463
  • View blog
  • Posts: 10,669
  • Joined: 05-May 12

Re: Simple Motion Blur Issues in C++

Posted 03 February 2013 - 02:34 PM

Have you attached a debugger to see what is causing the unexpected error?
Was This Post Helpful? 0
  • +
  • -

#8 archonoffate  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 37
  • Joined: 08-May 12

Re: Simple Motion Blur Issues in C++

Posted 03 February 2013 - 03:04 PM

I've tried Breakpoints and have looked at the debugger when the program was running. Only thing of note I saw was the invalid calls most likely something to do with the fx script probably.
Was This Post Helpful? 0
  • +
  • -

#9 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3463
  • View blog
  • Posts: 10,669
  • Joined: 05-May 12

Re: Simple Motion Blur Issues in C++

Posted 03 February 2013 - 05:09 PM

Can you show us the callstack when the message box pops up?
Was This Post Helpful? 0
  • +
  • -

#10 archonoffate  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 37
  • Joined: 08-May 12

Re: Simple Motion Blur Issues in C++

Posted 03 February 2013 - 05:32 PM

here is the debug stack when the issue arises:

Spoiler


all the cannot find file errors never hindered the program its seems to just be the invalid call


heres the function in question:
void Lab2::buildViewMtx()
{
	float x = mCameraRadius * cosf(mCameraRotationY);
	float z = mCameraRadius * sinf(mCameraRotationY);
	D3DXVECTOR3 pos(x, mCameraHeight, z);
	D3DXVECTOR3 target(0.0f, 0.0f, 0.0f);
	D3DXVECTOR3 up(0.0f, 1.0f, 0.0f);
	D3DXMatrixLookAtLH(&mView, &pos, &target, &up);

	HR(mFX->SetValue(mhEyePos, &pos, sizeof(D3DXVECTOR3)));
}


however if I try to continue the program I get even more errors but this is the initial start

This post has been edited by archonoffate: 03 February 2013 - 05:35 PM

Was This Post Helpful? 0
  • +
  • -

#11 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3463
  • View blog
  • Posts: 10,669
  • Joined: 05-May 12

Re: Simple Motion Blur Issues in C++

Posted 03 February 2013 - 06:18 PM

That's not a debug callstack, that's the debug output console. Anyway, the invalid call error at that point is usually due to either making the call with invalid values, or the framework is in still not yet in the correct state at the time it is called.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1