Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Arcibald Wearlot

using vertex shaders AND fixed function: flashing triangles

This topic is 5327 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

i cannot solve this strange bug: i render the entities using a vertex shader, like this:
		pEntity=m_pEntityManager->GetEntity(i);
		m_pTextureManager->SetCachedTexture(0,pEntity->GetTextureIndex());

		m_pShaderManager->SetVertexShader(0);
		m_pShaderManager->SetPixelShader(0);
		D3DXMATRIX Transform;
		Transform=pEntity->GetTransform()*View*Projection;
		D3DXMatrixTranspose(&Transform,&Transform);
		m_pShaderManager->SetVertexShaderConstant(0,&Transform,4);

		//draw the model
		m_pModelManager->DrawModel(pEntity->GetModelIndex(),NULL,NULL);
   
it works perfectly. CShaderManager::SetVertexShader() just calls LPDIRECT3DDEVICE::SetVertexShader() passing an indexed handle. after i do this, if i try to draw other stuff with the fixed function pipeline, calling SetVertexShader(D3DFVF_MYVERTEX) for example, and then setting up the vertex buffer and stuff, the new geometry is ok, but all the geometry previously rendered with the vertex shader is "flashing". this is really strange because drawing new geometry anyway shouldnt modify previously rendered stuff! is there some known issue in drawing with both programmable pipeline and fixed function? should i stick to vertex shaders for everything i want to draw? another thing, this doesnt happens if i use transform and lit vertices the second time. i think its because T&L vertices do not pass into the geometry pipeline so the problem is avoided.. [edited by - Arcibald Wearlot on April 15, 2004 3:29:35 AM]

Share this post


Link to post
Share on other sites
Advertisement
Could you please provide more details? What are you rendering, exactly? What is the relation between the FFP-rendered objects and the VS-rendered objects? (i.e. Decals or something?)

- It sounds to me like some z-fighting issue. The FFP and VS paths have different precision, and that could cause some small z-difference between polygons with the same depth, which would cause z-fighting.

Muhammad Haggag,
Optimize
Bitwise account: MHaggag -

Share this post


Link to post
Share on other sites
it isn''t a z-buffer issue, as im drawing completely different models. i always get flashing triangles no matter of what models i draw. for example the first time i render a rotating planet and the second time a "ground" model. the planet model start flashing. the more fps i get, the faster it flashes. it is as if there is another model that overlaps the original one, and some of its triangles get shown. this seems to be affected by the rotation of the camera: when i am in a certain angle the flashing triangles are almost white, while in another angle they are almost transparent. this makes me think of something related to lighting, but i disabled it..

Share this post


Link to post
Share on other sites
I''ve seen this on GeForce3 and XBox hardware. I never figured out what the problem was. On PC, in windowed mode, if you click on your titlebar the app should halt until you let go of the button. While clicked can you see any triangles missing? I know it sounds odd, but we''ve never been able to see any problem when halted, but it flashes quite a bit when left to run. The odds of us never seeing an incorrectly rendered image seem pretty low, which makes me think it''s actually a timing issue, where the backbuffer is presented before everything is drawn.

Once or twice I saw this same effect in NFSU on one or two polys, which made me feel better.

Share this post


Link to post
Share on other sites
got it. it was pixel fog.
the documentation says that "Pixel fog is not supported when using a vertex shader."
it was enabled so when i switched back to fixed function it was activated again and messed up with the shader.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!