Jump to content
  • Advertisement

Archived

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

aker_jus

DIFFUSE & NORMAL coexisting

This topic is 5480 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 have an idea to select rendering modes: Lighting and Vertex colored, so I came up with this model: I have an FVF which has both DIFFUSE and NORMAL, pretty much like the following: const DWORD FVFTEST = D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_NORMAL | D3DFVF_TEX2; and a vertex structure:
struct TEST1
{
float x,y,z;
float nx,ny,nz;
DWORD diffuse;
float tu, tv;
};
 
Then, I would change between vertex color and D3D lighting, using the Renderstate D3DRS_*MATERIALSOURCE. Now, my question is, would this be efficient? Would it even work? I can do it with 2 separate types, a lit vertex and a normal vertex, but that would require 2x more calculation time (its for my terrain engine btw.) That''s it. I hope there is an answer.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Yes, it works fine. We use it here all the time. I''ve heard many times that it''s an odd combination since you''re either calculating lighting, or using prelit vertices. While that''s true, there are other reasons to change the vertex diffuse.

Anyway, yes it works. If you have a good use for it, then by all means use it.

Share this post


Link to post
Share on other sites
Great, and I was wondering when and where I should use those renderstates. Also, can they be a bottleneck? I will change them 10 times a frame, maximum.

So, in other words, I can combine DIFFUSE and NORMAL fvfs. I want to do that so I can select between vertex/normal lighting for my terrain engine (Remember the demo I uploaded several days ago here?)

Thank you

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!