• Advertisement
Sign in to follow this  

How does this look?

This topic is 1668 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement

Love the weapon, though it need a little bit of light and it will look better.

 

A bump map for the walls will make the scene better.

Share this post


Link to post
Share on other sites

Agree with belfegor, Great Work!

 

And the position/orientation of the weapon is almost perfect (nothing is perfect though tongue.png )

 

Keep it up!

Share this post


Link to post
Share on other sites

Looks very cool.

Have you implemented skeletal animation yet? If so, what models format are you using for this?

Share this post


Link to post
Share on other sites

It's a bit dark but you might want to increase the brightness of your montior. :)

 

Looks great cozzie. Glad you're making progress. :)

Share this post


Link to post
Share on other sites

How are you rendering the weapon to move with the view matrix?

Share this post


Link to post
Share on other sites

Good start!  If you remove some of the sharp edges on your buildings and objects then things will look even better.

Share this post


Link to post
Share on other sites

@anddos: When i create the projection matrix, I also create and save a identity view * projection matrix. As soon as I need to render the weapon, I send the viewIdentityProjection matrix to the shader (shader constant).

@guardianX: no animations yet, will dig into that probably in a few weeks. I've added a nice flexible class with the FMOD audio api yesterday. So much things to do, so little time.
Things on my list: space positioning, mesh animation, hud class, particle system, level editor (although I love going wild with notepad, editing my own scene file format smile.png)

@meddo337: currently point lights don't affect the weapon, because I set the identityViewProjection matrix to the projectionMatrix shader constant. But I think I know how to solve it:
- have 2 uniform inputs in my (lighting) shader, one for regular viewProjection matrix and one for the identity one. Then add a new technique specifically for weapon rendering, where the 1st matrix is used for passing worldpos to the pixelshader and the 2nd is used for calculating the VS output pixel position. This means I would need to keep track and update a world matrix for the camera position though. If it works out I'll post another screenshot.

 

Update: too bad it's not that simple, the problem isn't the viewIdentityProjection matrix, but the world matrix. For positioning I need the camera oriented world matrix, but for the point lights I need the world positon world matrix.... I'll think about it.

Edited by cozzie

Share this post


Link to post
Share on other sites

@anddos: When i create the projection matrix, I also create and save a identity view * projection matrix. As soon as I need to render the weapon, I send the viewIdentityProjection matrix to the shader (shader constant).

@guardianX: no animations yet, will dig into that probably in a few weeks. I've added a nice flexible class with the FMOD audio api yesterday. So much things to do, so little time.
Things on my list: space positioning, mesh animation, hud class, particle system, level editor (although I love going wild with notepad, editing my own scene file format smile.png)

@meddo337: currently point lights don't affect the weapon, because I set the identityViewProjection matrix to the projectionMatrix shader constant. But I think I know how to solve it:
- have 2 uniform inputs in my (lighting) shader, one for regular viewProjection matrix and one for the identity one. Then add a new technique specifically for weapon rendering, where the 1st matrix is used for passing worldpos to the pixelshader and the 2nd is used for calculating the VS output pixel position. This means I would need to keep track and update a world matrix for the camera position though. If it works out I'll post another screenshot.

 

Update: too bad it's not that simple, the problem isn't the viewIdentityProjection matrix, but the world matrix. For positioning I need the camera oriented world matrix, but for the point lights I need the world positon world matrix.... I'll think about it.

Would it be possible to see that code?, i could never understand what people ment by rendering with an identity matrix for fps weapons,if i set a model to the identity and pass it to the shader,it just apears in 0,0,0 world cordinates.

Share this post


Link to post
Share on other sites

Anddos, no problem.

Below I've pasted the current/ working situation, with the remark that my point lights are not affecting the weapon.

 

I'm trying to solve this by using the regulier viewProjection matrix and the camera view matrix inverse as world matrix.

 

The code:

bool CD3d::RenderWeapon(const CD3dscene &pD3dscene, const CD3dcam &pCam, const char *pTechnique)
{
	int mInst	= pD3dscene.GetCurrentWeapon();
	int mesh	= pD3dscene.mWeaponMeshInst[mInst].GetMeshId();
	int fxIndex = 0;				
	// = pD3dscene.mWeaponMeshInst[mInst].GetEffectIndex();		NOT POSSIBLE/ TRICKY, BECAUSE OF LIGHTING SHADER

	// Set the ViewProjection (Camera) matrix to 'identity view matrix' version
	if(FAILED(pD3dscene.mShaders[fxIndex].mEffect->SetMatrix(pD3dscene.mShaders[fxIndex].mHViewProjMatrix, &pCam.GetViewIdentProjMatrix()))) return false;	

	if(!pD3dscene.mMeshes[mesh].SetBuffers()) return false;					
	if(!pD3dscene.ShaderSelectWeaponMeshInst(mInst)) return false;

	if(!ShaderSetTechnique(pD3dscene, fxIndex, pTechnique)) return false;	
	pD3dscene.mShaders[fxIndex].Begin(); 

	for(unsigned int p=0;p<pD3dscene.mShaders[fxIndex].GetNumPasses();++p)
	{
		pD3dscene.mShaders[fxIndex].BeginPass(p); 

		for(int mat=0;mat<pD3dscene.mNrMaterials;++mat)			// OPTIMIZE; only go through materials of specific mesh
		{
			if(!pD3dscene.ShaderSelectMaterial(mat, fxIndex)) return false;
			
			pD3dscene.mShaders[fxIndex].Commit(); 

			for(DWORD sub=0;sub<pD3dscene.mMeshes[mesh].GetSubMeshSize();++sub)
			{
				if(pD3dscene.mMeshes[mesh].mMatIdPerSubMesh[sub] == mat)
				{
					pD3dscene.mMeshes[mesh].RenderSubMesh(sub, LIST);
				}
			}
		}
		pD3dscene.mShaders[fxIndex].EndPass(); 
	}
	pD3dscene.mShaders[fxIndex].End();
	return true;
}

You might need some thinking on it, but basically it's a 'regular' shader, but with 2 differences:

- viewProjection = identityViewProjection (calculated @cpu)

- worldMatrix = local space instead of world space (which I have for all mesh instances in the scene)

Share this post


Link to post
Share on other sites

Point lights on the selected weapon also fixed smile.png

 

testscene-weapon-plight.jpg

 

Not using the identity view * projection matrix anymore, just normal viewProjection.

But as world matrix for the weapon I send the inverse of the camera viewmatrix to the shader.

 

Only problem is that I haven't figured out yet how to 'add' the local space world matrix of the weapon to the inverse viewmatrix of the camera, before sending it to the shader. Just adding them up doesn't work (D3DXMATRIXA16 inverseview + D3DXMATRIXA16 localworld);

Edited by cozzie

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement