fasterStencil plugin

Posted By: ChrisB

fasterStencil plugin - 07/03/08 15:25

Hey,
i'm currently working on my own stencil shadows and i noticed that they are much faster then the a6/a7 stencil shadows. I think i will release it as a free plugin, but at the moment this is just for study.
The shadows still produce artefacts with some models which works with the a6 shadows. (There are also some models which works better with my shadows then with the a6 shadows) I hope i can solve this.
Some screenshots:
fasterStencil:



A6 stencil shadows:




At the moment i'm using z-pass stencil shadows, z-fail stencil shadows are also working though they are a bit slower.

Screenshots taken on:
Pentium D820 2*2.8 GHz
1gb ram
Geforce 6600GT
Posted By: broozar

Re: fasterStencil plugin - 07/03/08 15:35

the pig's butt always seems to be blocky.

- can we switch on/off self shadowing?
- looking at the skull, i assume your stencil method works with open meshes as well as with cloesd ones?
- 18 fps is still much too little for the skull, but a giant improvement over 3 (600%!)

it's good to have you in the community smile great work, i hope you'll be able to fix the remaining issues.
Posted By: cro_games

Re: fasterStencil plugin - 07/03/08 21:21

Originally Posted By: broozar
the pig's butt always seems to be blocky.

- 18 fps is still much too little for the skull, but a giant improvement over 3 (600%!)



That is because he have slow pc.
Great job man!


Posted By: PHeMoX

Re: fasterStencil plugin - 07/03/08 21:58

Unless you've changed the light source position in between, the fasterStencil's second screenshot definitely has wrong angles on the shadows... regardless, it could (still, whether you fix this or not) be useful if it's indeed a lot faster. smile
Posted By: ChrisB

Re: fasterStencil plugin - 07/03/08 22:09

@broozar: thx for the kind words. Well sometimes it works, sometimes not. Its not that easy to explain, it doesn't only depends if a mesh is open.
@PHeMoX: Yes, the sun is moving.

thx@all.
Posted By: VeT

Re: fasterStencil plugin - 07/03/08 22:39

great, man, as i see, shadows is a great trouble in GameStudio... so we are waiting for your shadows
Posted By: JibbSmart

Re: fasterStencil plugin - 07/03/08 23:41

a lot of the artifacts can probably be reduced if you can deflate the shadow-volume slightly.

i hope you know what i mean. don't know if you can do it (i've never dealt with stencil shadows), or if it's clear enough from my beautiful artwork there.

good on you, though. they're looking pretty cool.

one question though: don't gs's stencil shadows default to z-fail?

julz
Posted By: oliver2s

Re: fasterStencil plugin - 07/04/08 09:48

Great job Chris. Now the question is: why are the in-built stencil shadow much slower then yours?
Posted By: PHeMoX

Re: fasterStencil plugin - 07/05/08 12:22

Yeah, I'd wonder the same, as it seems to be almost equally as accurate?

Quote:
@PHeMoX: Yes, the sun is moving.


I see, then small changes make sense of course. smile
Posted By: MarcoGS

Re: fasterStencil plugin - 07/08/08 19:50

It's great. Very good work. The shopping caddy and the projector are my models laugh
Posted By: frazzle

Re: fasterStencil plugin - 07/14/08 13:45

Great work indeed, the fps improvement is a nice plus point smile smile

Stencil shadow volumes most have a preformance lack due to heavy silhouette computation and a costly invisible fillrate due to the technique of z-pass/z-fail.

Most of the time, this can be solved by using a a low-polygon model of the occluder to compute the shadow volume.
An even better methode is to use welded meshes. Since the structure of a vertex within D3D is not just the position but also color and normal information. E.g. you would assume that a cube exist out of 8 vertices but due to the algorithm of D3D, the 8 is turned into 24 wink wink
For low poly models, this is still acceptable but for high end models, you can say: "Houston, we have a problem" ^^ I guess you made advantage of this technique which is a smart thing to do when comparing the framerates.

About the artifacts, my idea to this is that you use conditional branching to perform the entire operation.

Thanks in progress

Frazzle
Posted By: Matt_Coles

Re: fasterStencil plugin - 07/14/08 23:15

this looks very promising, hope the plugin is going steady.

Will it be possible to implement a soft shadow shader on your shadows on release?

I'm guessing soft shadows will be a lot more practical with the frame rate improvement with shadows

Matt
Posted By: Storm_Mortis

Re: fasterStencil plugin - 07/15/08 12:23

Wooha, very well done so far!

Good shadows are really importent to improve a Games atmostpere^^

I was wondering ... why are the "inner shadow borders" this blocky? is it a big deal to get them soft like in Doom3?



Anyway, looking forward to use our work laugh
Posted By: Poison

Re: fasterStencil plugin - 07/15/08 13:24

you have to use a shader which blurs the stencil shadows and this is how they made it in doom 3^^.
Posted By: ventilator

Re: fasterStencil plugin - 07/15/08 13:39

doom3 doesn't blur anything. in doom3 the borders are much less noticeable because it does additive multipass light rendering * and not simply multiply all shadows over the already completely rendered scene.

(* so the borders are exactly where the model starts to get dark because of the lighting equation. only with a method like this lights and shadows really work together correctly.)

stencil shadows are outdated anyway though. nowadays almost everyone goes with shadow mapping.
Posted By: Inestical

Re: fasterStencil plugin - 07/15/08 14:01

Shadow mapping is actually the way to go yes. Also it's easy to implement, if you know anything about depthmaps and projective texturing.

Also shadowmaps allow you to do screenspace blur, that makes the shadow looks smooth and with some additional parameters, add penumbra to the already existing umbra.
Posted By: ChrisB

Re: fasterStencil plugin - 07/15/08 14:33

Yes ventilator is right, you have to multiply the shadow with the diffuse and specular lighting, and not to the final image as 3dgs does (though this is the fastet method, for better shadows you need the render the scene again (if you render the scene already twice, for example for a depth map, there will be no slowdown)).
You can also screenspace blur the stencil shadows, and there are algorithmen for correct penumbra softshadows.
For larges scenes only lit by the sun, i would definitly prefer shadowmapping.
But for indoor scenes with more than 1 pointlights stencil shadows are still better, especially if only your actor and enemys need dynamic shadows.
Also point lights, area lights, tube lights etc are easier to do with volume shadows then with shadowmapping. So i think stencil shadows are still suitable for some applications.

Btw, i would'nt say that shadowmapping is easier then stencil shadows, especially if you need to implement algorithm to enhance the quality of the shadowmaps like psm, lispm,tsm, pssm etc, you need strong mathematical skills to understand these thinks.
Posted By: frazzle

Re: fasterStencil plugin - 07/16/08 09:09

Shadow maps are indeed hard to figure out at the start. The biggest disadvantage of the methode behind shadow maps (SM) is that it's not easy to implant on pre-DX9 graphics hardware. Thus this would cause performance/quality problems on old hardware which means that other shadowing technique must be used there. A great plus point of SM is that it can be used in combo with very high tessellated models. In comparison towards stencil shadows (volume dependent), using high tessellated models would lead into performance problems. Though, it is known that shadow volumes run better on older DX version which might sound strange at first wink wink Not to mention the perfectly sharp shadows (without any flickering, Moiré-like effects and aliasing) which is a pain in the as* when doing SM ^^. Off course, PCF in combo with with ABF should cover up most of the artifacts for SM.

It's just a matter of choosing the right methode for the right situation like ChrisB mentioned smile smile

Cheers

Frazzle
© 2024 lite-C Forums