EDIT: Things are fixed now heres a high res shot:
(Original post)
Yes ladies and gentlemen you are looking at a fully texture based shadow. Able to stretch, uneffected by complexity of geometry, and waaaay faster than stencil shadows. I have managed to partially integrate into irrlicht, the current shot has no texture but I have textures working, although there is too many artifacts to take a decent screenshot (So i have dropped to the light projection stage.).
This current screenshot is from a Radeon 9200 and is running at around 50fps, compared to stencils which drop to 15fps up close, and cause horrible self shadowing artifacts (The artifacts in this screenshot dissappear when textures are enabled, altho there r others which I have to fix first..).
Over the next few days/weeks, I will be thinking about making a shader effects library for irrlicht, particularly for lower end cards, such as the Radeon 9200 which only supports PS 1.4, or the 440MX which only supports 1.1 vertex shaders (But no shadow maps on 440mx im afraid..). I have a collection of converted NVidia shaders and others here and I think I can set up an efficient framework fairly quickly, that will allow you to do texturing, phong lighting, shadows, colour and movement effects using shaders.
Here is another shader named Mr Wiggles which I converted, it textures the object, applies diffuse (and specular I think) lighting and makes it wiggle about:
The non-textured, non-lighted version only uses a vertex shader and should work fine on very old or integrated graphics cards. Also note that this is not a post processing effect, but moves the vertices of the model themselves similar to the water scene node.
Cheers.
The Beginning of a shadow map...
The Beginning of a shadow map...
Last edited by BlindSide on Mon Jun 11, 2007 11:53 am, edited 1 time in total.
Here it is with texture enabled, notice how her head creates a nice shadow on her shoulder? (From the light source above)
The problem as you can see is many many artifacts on the (flat) terrain, can anyone please help me?
Last edited by BlindSide on Mon Jun 11, 2007 9:10 am, edited 1 time in total.
Nice. Is there any way to make the shadow look not-so pixelated? Anyway, keep it up.
My company: http://www.kloena.com
My blog: http://www.zhieng.com
My co-working space: http://www.deskspace.info
My blog: http://www.zhieng.com
My co-working space: http://www.deskspace.info
Yes there are many ways, the simplest is to increase the resolution of the shadow map. Right now it is at 512, and with no filtering this is very bad quality. However Irrlicht in Direct3D doesnt let me set RTT bigger than the device (Which is 800,600, but I need to use a pow2 so 512 is the biggest one) .Virion wrote:Nice. Is there any way to make the shadow look not-so pixelated? Anyway, keep it up.
There are many ways to filter it and make it "soft shadow", the most common is PCF. Also you can take many samples of the shadow map and mix them together to produce a better result.
Unfortunately, all of this I could not fit into my crappy cards pixel shader so the next best thing to do is just increase the resolution to 1024 or similar and make the light closer so that the object gets more shadow map resolution.
The current approach uses 2 shaders. First the scene is rendered from the lights point of view using the first shader which is a simple depth shader (This is very fast, with no texturing) then this is put into a RTT. The second time the scene rendered normally but the second shader is applied which takes the RTT and transforms the current pixels coordinates to match the lights' ones and compares them to see if the depth match. For more information google "Shadow mapping techniques" or "Depth Buffers".
Cheers
That is a nice addition to Irrlicht indeed. Shadow mapping is a must have and I'm glad you're working on it.
As for making shadows better looking, even better than smoothing the aliasing later on is to prevent it from happening in the first place.
What makes them occur is the uneven contribution of each pixel in the texture map to the actual scene as rendered from the camera POV. Whether a 1m² shadow area is far away or nearby it needs the same amount of space on a texture map with standard projection, eventhough the shadow farther away is contributing far less to the final image.
Perspective shadow mapping fixes this. There shadows farer away use less space, which leaves much more texture space for shadows near the camera, which greatly improve their quality. Light space perspective shadow mapping is an improvement on the orginal technique, which fixes problems with PSM and further improves quality.
Here is the full paper with sample code and introduction: http://www.cg.tuwien.ac.at/research/vr/lispsm/
It is faster and more accurate than PCF.
As for making shadows better looking, even better than smoothing the aliasing later on is to prevent it from happening in the first place.
What makes them occur is the uneven contribution of each pixel in the texture map to the actual scene as rendered from the camera POV. Whether a 1m² shadow area is far away or nearby it needs the same amount of space on a texture map with standard projection, eventhough the shadow farther away is contributing far less to the final image.
Perspective shadow mapping fixes this. There shadows farer away use less space, which leaves much more texture space for shadows near the camera, which greatly improve their quality. Light space perspective shadow mapping is an improvement on the orginal technique, which fixes problems with PSM and further improves quality.
Here is the full paper with sample code and introduction: http://www.cg.tuwien.ac.at/research/vr/lispsm/
It is faster and more accurate than PCF.
Cool! The progress is fast. XD
My company: http://www.kloena.com
My blog: http://www.zhieng.com
My co-working space: http://www.deskspace.info
My blog: http://www.zhieng.com
My co-working space: http://www.deskspace.info
Please redirect replies to Demo thread:
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=22225
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=22225