Archived

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

Ibanez

Shading DX8

Recommended Posts

Ibanez    122
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   
Guest Anonymous Poster
to use gourad shading set the renderstate,

something like:

pDevice->SetRenderState(D3DRS_SHADEMODE,D3DSM_GOURAD);

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)

later
Marc


Share this post


Link to post
Share on other sites
a person    118
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
Ibanez    122
Well thanks for your help, I tried the

d3d_device->SetRenderState(D3DRS_SHADEMODE,D3DSHADE_GOURAUD);

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