Advertisement

Shadowmaps

Started by September 10, 2002 08:49 AM
9 comments, last by Nick7 22 years, 5 months ago
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
Nice fog, how do you calculate it and keep the speed up?
Advertisement
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]
do you mean Shadow maps or lightmaps?

My ShadowMap demo is in download section w/ source.
Game Core
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.
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 ...
Advertisement
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?
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]
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
Game Core
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!

This topic is closed to new replies.

Advertisement