Archived

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

Shadowmaps

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

OK, I got some problems with shadowmaps. I read some documents about it, and understand the idea how it works. I also grabbed source for it from NVidia''s site, but it''s a little confusing (too much code) - I need more simple, like tuts here So, anyone knows any URL where I could find some source code for shadowmaps, preferably that are more ''for beginners''? Oh, also.. take a look at my current work: Currently only terragened map, 512k triangles, split with octrees, also uses skymap, multitexturing, frustum culling and volumetric fog.. tell me what u think of it Sum pics: http://faust.irb.hr/~nfrances/scr1.jpg http://faust.irb.hr/~nfrances/scr2.jpg http://faust.irb.hr/~nfrances/scr3.jpg http://faust.irb.hr/~nfrances/scr4.jpg .. and exe if someone wants (be warned.. currently it''s real memory hog, and startup calculations will take some 40sec on 1.4GHz): http://faust.irb.hr/~nfrances/Terra.rar

Share this post


Link to post
Share on other sites
Disassemble his binary and find out

BTW, this isn't really the forum to be posting questions like that... This is a newbie forum and gamedev.net has more appropriate forums for this kind of information. Try 'OpenGL' for example, if you can't find out what you need to know there, maybe some of the more advanced maths / 3d theory forums on www.flipcode.com may yield more information.

[edited by - TheGilb on September 10, 2002 1:20:28 PM]

Share this post


Link to post
Share on other sites
Anon Poster:
Well, fog is calculated realtime - you can change ''height'' of it, also the nearer vertices are less fogged (as you can see when you are close to ground). Fog intensity is also calculated per each vertex. It isn''t so much math anyway so it doesnt slow up so much (more impact is in gfx card).

BGCJR:
I took a look at your source, but it seems you''ve been doing it hard/slow way! (no offense) - since you read each pixel, etc..
As far as I understand - this is something like rendering should look (OK, this is what I found so far... in theory):
- render from light''s point of view, but only into depth buffer, which will be shadowmap
- copy depth buffer to texture
- render from viewer position, and use shadowmap as projective texture, with help of T&L in hardware

Thus it''s needless to calculate ''by hand'' for each pixel, as GFX card can do it in HW to speed it up.
I''ve tried to examine NVidias source code for shadow maps, but it''s.. hmm.. kinda complex .. gues I''ll have to take more time to look into it.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
About your fog (sorry to slightly hijack your thread) - so you caculate the vertex colour on the cpu (based on what? height, viewing angle and distance?) and send that to the card. Does this mean that you''re not using display lists to speed things up?

Share this post


Link to post
Share on other sites
Things that are considered for fog:
First, you set up 'height' under which fog starts.
The lower terrain is, more dense fog is.
If viewer is in fog, that is added to fog strength.
Next we calculate depending on those, and distance of triangle how dense we'll draw fog (remember, when inside fog, if triangle is close, you see it more clear than triangle that is more far away).
Also about vertex colors, I re-calculate them on the fly.. it's still faster this way than to render each one 'by hand'.

Well, here's a snippet of code to calculate those (yes, it's 'ugly' code... but it works
Sum info: Player structure is actually viewpoint, and what you pass to this functions are coordinates of vertex.

Oh, one more thing... feel free to e-mail me at: nfrances@thphys.irb.hr if u want full code - but remember.. it's kinda messy

Hmh.. have problems post code here, anyway, grab that part here:
http://faust.irb.hr/~nfrances/snippet.txt


[edited by - Nick7 on September 11, 2002 8:56:14 AM]

Share this post


Link to post
Share on other sites
That''s great BGCJR! As latest version u had wasn''t too fast on GF2/P4@1.4.
Anyway, I''m off to study more that NVidia''s example.. definitely gonna try to make some use of it
Well, if I manage to get it working, I''ll post some info on board here!

Share this post


Link to post
Share on other sites
Nick, i''ll save you some trouble.
I''ve been trying to splice out code from NVIDIA''s site, and, for the most part, have been successful. I''ve been disabling platform independent things (IE Register combiners) and took a TON of their ''options'' out. I''ve got a pretty slim version right now.
My problem i''m running into is the multi texturing. Seems anytime i use the:
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR); tag, my GL_TEXTURE0_ARB goes to shit. I can post the code i''ve spliced, someone drop me an e-mail.. it''s a pretty shitty hack job, just so i can understand the algo better.

~Main

Share this post


Link to post
Share on other sites