Archived

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

null_vector

Traingles coming out black??? WTF!

Recommended Posts

what renderstates might cause a model to come out pitch black.....i have lighting disabled and diffuse done per vertex and set to 0xFFFFFFFF so I''m fairly sure the problem must be a renderstate but I''m pretty sure i''ve been through them all. Any help?

Share this post


Link to post
Share on other sites
Are you setting a material for starters? Secondly, what render states are you using? Are your textures loading correctly and being set correctly, are you sure your vertex information is specified in the correct order? A little more info would be handy, but that might help you a little.

Share this post


Link to post
Share on other sites
yes a pure white material is begin set.

disabling the cull mode and disabling the lighting.

there are no textures nor texture coordinates.

yes the model is formed correctly

the definition is basically

          
struct vertex {
float x, y, z;
DWORD diffuse;

enum { FVF = D3DFVF_XYZ|D3DFVF_DIFFUSE };
};


its a basic open flight viewer at the moment using the GLU tesselator to triangulate nionsimple polygons. the resulting triangles are push into one large vb.

there is font rendering as well going on, i'll try disabling all other rendering and see if that helps any.

EDIT: disabling the font rendering gives the correct white but all i'm doing in the font code is setting the texture stage states, enable blending, setting the srcblend and destblend states, setting the texture factor, rendering and then disabling blending. why would this cause this?

EDIT #2: ok setting a texture seems to be the culprit. a texture affects a vertex with no texture coordinates???

[edited by - null_vector on May 7, 2003 5:53:31 PM]

Share this post


Link to post
Share on other sites
no texture coords as in none present in the structure or the fvf : /

well since i''ve had this laptop i''ve already reported 2 IHV bugs to ATI so I''ll test this on other machine and see what happens?

Is this supposed to work like this?

I''ve gotten around all this by setting the stage 0 texture to null before rendering the model, but I didn''t think that was nessecary.

Share this post


Link to post
Share on other sites
I actually think that is how it works...its the same thing as if you turn on mapping without using it...I dont think it uses diffuse color as default if there are no coords in texture mode.

Brian J

Share this post


Link to post
Share on other sites
quote:

I actually think that is how it works...its the same thing as if you turn on mapping without using it...I dont think it uses diffuse color as default if there are no coords in texture mode.



I don''t think I understand you. If you have diffuse but don''t have tex coords, it doesn''t use the diffuse?

Or do you mean set stage 0 texture stage colorarg1 to D3DTA_DIFFUSE?

Share this post


Link to post
Share on other sites
quote:
Original post by null_vector
no texture coords as in none present in the structure or the fvf : /

well since i''ve had this laptop i''ve already reported 2 IHV bugs to ATI so I''ll test this on other machine and see what happens?

Is this supposed to work like this?

I''ve gotten around all this by setting the stage 0 texture to null before rendering the model, but I didn''t think that was nessecary.


If your Texture Stages are set up to use a texture, then you will get undefined behaviour if you have no texture coordinates in your vertices.

COLOROP -> SELECTARG1
COLORARG1 -> DIFFUSE
COLORARG2 -> DIFFUSE (doesn''t really matter, but doesn''t hurt to set it to something sane)
ALPHAOP ->SELECTARG1
ALPHAARG1 ->DIFFUSE
ALPHAARG2 ->DIFFUSE
NOTE: Do NOT disable the alpha processing for an active stage. Some drivers may allow it, but others will fail in bizarre and interesting ways.

This will read from the diffuse colour of your vertices.


Stay Casual,

Ken
Drunken Hyena

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Try turn lighting off if it''s on. If the triangles are no longer black then you''ll know that the problem was caused by insuficient lighing or maybe wrong normals.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Oh, pardon me, I see you''ve already disabled lighting. Sorry

Share this post


Link to post
Share on other sites
Thanks Ken, that was what i had figured. This seems to only happen if there is a texture set so this never appeared for me before since I pretty much always use textures.

Maybe this should be mentioned somewhere in the docs?(or is it already?)

Share this post


Link to post
Share on other sites
Lighting wont affect this triangle, it''s a lit FVF, I wonder why you came up with lighting. I never faced this problem with lit vertices, so I don''t know whats wrong, I wish I could help you more.

Share this post


Link to post
Share on other sites
What about mipmapping? If you don''t set all the texture levels on that, it''ll make polys come out black at certain distances.

Just a thought...

Share this post


Link to post
Share on other sites
I know you have ruled out lighting but in my application i have to disable lighting in order for the vertices to show their proper color.

No idea why this is though....

Share this post


Link to post
Share on other sites