#### Archived

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

This topic is 5570 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 on other sites
Nice fog, how do you calculate it and keep the speed up?

##### 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 on other sites
do you mean Shadow maps or lightmaps?

##### 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 on other sites
Hmmm.. actually NVidia''s source code makes some sense after reading thru it for few times
... will try to make something based on parts of it ...

##### Share on other sites
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 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 on other sites
i do have a new version of shadowmap. it uses pbuffers.
it runs at 60+ fps ,now. but, i haven''t uploaded it.

That''s on GF256, 800 t-bird

##### Share on other sites
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 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

• ### Forum Statistics

• Total Topics
628645
• Total Posts
2984015

• 9
• 9
• 10
• 21
• 20