Jump to content
  • Advertisement


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


Shading DX8

This topic is 6202 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 am converting my 2d chess game into the third dimension, but due to the roodiness of my 3d card and CPU speed, I have had to knock the amount of faces on each peice down to about 600, and they are starting to look a bit ''blocky''. I thought by having some better form of shading (I think it is gouraurd I am after, but I am not sure) I could pretty it up a bit. How do I go about implementing this? Do I have to do all the maths algos myself (cant be bothered really) or is there a command like: SetTextureStageState(0,D3DTSS_COOLSHADINGEFFECT,TRUE); Thanks

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
to use gourad shading set the renderstate,

something like:


it _should_ be set as default though...

as a point of interest
most chess pieces are ''circuarly symetrical'' so if back face culling is taken into account there will be about 400 faces per piece.

2*16*400 = 12800 faces per frame

12800 * 30 frames a sec = 385 000 polys / second

which doesnt really seem that high,

have you looked into optimisations? (batching etc)


Share this post

Link to post
Share on other sites
gourad is on by default. fortunatly for you chess games dont require redrawing ALL the pieces every frame. unless of course you allow camera movement. beyond that, if gouard shading is not good enough and yoru card/cpu cant handle the polygon rate. you got a few choices.

make sure you are using indexed primitives (index buffer with a vertex buffer) for your model pices and that NO vertex is ever defined twice in your vertex buffer. (ie all vertives shoudl be unique and not be dups of other vertices since faces meet and use the same vertice) this will probally give you a huge framerate boost, (unless you are doing this already )

each model should be one texture only. all models should be drawn using a single call. similar pieces like pawns should be selected first to be drawn and work yoru way down. this ensures as few state changes as possible. keep all pieces in video memory and dont lock()/unlock() every frame, only if you must (which should be never since when moving the pieces you should use translation matrices)

learn to model better so the lost faces are not noticed too much.

implemenet a better lighting system (most likly will be too costly on yoru card/cpu combo anyway)

better culling algorithms that reduce the amount you draw AND transform/light. this though may be a ibt mathy and you seem to want to stay away form that.

Share this post

Link to post
Share on other sites
Well thanks for your help, I tried the


thing, but didnt seem to appear any different, so I guess my card (TNT2) might not support it. I decided, I dont really need it anyway, coz when you see the whole board + peices, it is in the distance a bit, so you cant really notice the edges (I will just make it you cant zoom in too far).

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!