Jump to content
  • Advertisement

Archived

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

Nekhmet

20 bucks if know where my lighting went.

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

20 bucks to the first person who can solve this problem. I''m currently porting my engine to use D3D. Things were going OK until I tried supporting multitextured models. The problem is this: the multitextured models are multitextured, but they''re not lit - they are equally bright on all sides. The single-textured models are lit just fine. I discovered that if I remove D3DFVF_TEX2 from set of flags I''m passing to SetVertexShader, the lighting reappears. Of course, that makes the multitexturing vanish. Does anybody have a clue what''s going on? - Josh

Share this post


Link to post
Share on other sites
Advertisement
I have no ideas what could be causing this, but a few guesses:
1) Make sure your normals are good. When you say it works with just one texture, it makes me think that this is fine.
2) Check to make sure the light was created properly. Again, since it worked with one texture, I can''t see why it wouldn''t work with 2, so this probably isn''t the problem.
3) Check to make sure your renderstates are being set correctly and that lighting isn''t being turned off for some reason when you draw the second texture.

How about posting some of the source?

Moe''s site

Share this post


Link to post
Share on other sites
Okay. I put the source code at this URL:

egenesis.com/bug.txt

Note that the interesting routine is at the bottom of the file.

- Josh

Share this post


Link to post
Share on other sites
Er... you can''t just change the D3DFVF flags willy-nilly without also changing your vertex format struct, right? What is the complete set of flags you are passing? And what does your struct look like? Email me and I''ll send you the address you can send my $20 to.

Seriously, post your code. I know nothing about D3D.

Share this post


Link to post
Share on other sites
I honestly don''t know whether it''s allowed to create a FVF with a tex2 field, and then not use the tex2 field. I couldn''t find an answer in the DX8 docs, but maybe I was looking in the wrong place.

The code''s at http://egenesis.com/bug.txt

- Josh

Share this post


Link to post
Share on other sites
Here is a good example
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dx8_c/directx_cpp/Graphics/ProgrammersGuide/ProgrammablePipeline/PixelShaders/PixelShaderExamples.asp

Mmmm.... what am I gonna do with that $20...

Share this post


Link to post
Share on other sites
No... not allowed. The FVF flags are telling Direct3D what your vertex structure looks like. So if you send it the wrong vertext structure definition, things aren''t going to work. Look at the examples.

Another thing you are doing wrong is that you are using D3DFVF_TEX1 | D3DFVF_TEX2. This is wrong. The D3DFVF_TEX2 flag means you have 2 sets of texture coordinate sets. Don''t use more than one TEX# flag at a time.

Share this post


Link to post
Share on other sites
Pyabo, right on target about TEX1 | TEX2. Send me your mailing address, and I''ll send you the $20. jyelon@egenesis.com

BTW, I''ve noticed that this is a recurring feature of D3D - when I make a mistake, it doesn''t return an error code. Instead, it BSODs, or it garbles the results. Is this a problem with the NVidia DirectX driver, or is it a problem with D3D in general?

- Josh

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!