Jump to content
  • Advertisement
Sign in to follow this  
matthughson

What Shadow Tutorial Did It For You?

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

Hey Guys, I'm starting to do a little bit of research on implementing real-time shadows, and there are a ton of resources, but I'm wondering what tutorial or article explained a technique that just clicked for you. I'd prefer something as simple as posible (shadow quality isn't a high priority), and something I can do in one lump pass, rather than on each mesh induvidually (if that's posible). I'm using DirectX 9, so anything D3D specific is a major plus. I'd prefer to be able to just drop a function into my engine and just call it right before I flip the buffers (I'm not so much interested in learning how/why it works at the moment, just getting it to work is the goal). Thanks! Matt

Share this post


Link to post
Share on other sites
Advertisement
<shameless-plug>
I wrote an article for this very site that is fairly simple Z-Pass shadow volumes: An Example of Shadow Rendering in Direct3D 9. I'd recommend it as a starting point - it's not quite complete enough to be "generally".
</shameless-plug>

I highly recommend The Theory of Stencil Shadow Volumes if you're interested in SV's - that article was really useful to me when I first started messing with them [smile]

hth
Jack

Share this post


Link to post
Share on other sites
While on the subject of Shadow Volumes, I found the DX sample to be quite useful. Has quite a bit of info, if you can get past all the DX framework stuff.

Share this post


Link to post
Share on other sites
Quote:
Original post by dawidjoubert
I Second this Request... Mine is specific to a RTS game so once again im going 2 have +30 units on-screen so i need fast shadows

Any suggestions

From all the discussions (and my own thoughts on the matter) it really depends on the characteristics of your game.

  • What types of lights (point, spot, directional?)
    - Directional lights are easy for shadow maps, point lights can be tricky
  • How many of these lights
    - Can impact greatly on the number of passes required, hence multiplying any per-pass performance problems
  • How geometrically complex are your objects?
    - Lots of complex units can make for a heavy load on a SV implementation
  • Fill rate characteristics?
    - If you're using lots of fancy pixel shader effects then you probably want to pick the least fill-rate intensive shadowing algorithm
  • CPU usage characteristics?
    - If it's mostly GPU work then you could compute shadow volumes on the CPU and make the most of parallelism. Conversely, high CPU loads might make it better to look at shadow implementations that run entirely on the GPU.


    When I first looked into shadowing, it was all about SV's - but SM's have really matured now, and I personally think that I'll be using them in my current/future work.

    hth
    Jack

    Share this post


    Link to post
    Share on other sites
    I achieved some respectable results using D3DXMatrixShadow Function. You send the function a light direction vector and a plane position, and it produces a matrix.

    When applied to your mesh, it flattens it out.

    By setting your texture to 50% alpha blended grey before rendering the shadow helps, then you just render the object as normal over the top!

    Simon

    Share this post


    Link to post
    Share on other sites
    Quote:
    Original post by sipickles
    I achieved some respectable results using D3DXMatrixShadow Function. You send the function a light direction vector and a plane position, and it produces a matrix.

    When applied to your mesh, it flattens it out.

    By setting your texture to 50% alpha blended grey before rendering the shadow helps, then you just render the object as normal over the top!

    Simon


    That work on non-flat surfaces?

    Matt

    Share this post


    Link to post
    Share on other sites
    Quote:
    Original post by jollyjeffers
    When I first looked into shadowing, it was all about SV's - but SM's have really matured now, and I personally think that I'll be using them in my current/future work.


    Exactly what type of shadow maps do you think of?

    It's just my personal opinion, but after reading through perspective shadow maps, light space perspective shadow maps, trapezoidal shadow maps, etc, I still have the feeling that they're still trying to hack around something that is not really suitable for the purpose.
    If they can manage to use the shadow map efficiently (to not have huge shadow texels in large scenes), then another problem arises: shadow edges will change when the light or camera changes. In the result sections, the best thing authors usually say is that the algorithm is way better than the original shadow map algo, and that is does not produce that many artifatcs as the predecessors.

    Maybe I think like this because I'm a shadow volume fan (although I feel it is very painful sometimes)... I really hope there will be another (a third) way to do it :)

    kp

    Share this post


    Link to post
    Share on other sites
    Of all the implementations you can use Shadow Maps for, I think an RTS game is one of the simplest. Usually, theres a very small range of z values your shadow casters can be in, unless you're doing something fancy. This would greatly ease on shadow mapping.

    On the other hand, an RTS would probably mean any shadow you have is quite small in pixel size. This would also make Shadow Volumes run faster, especially on Fill-Rate limited cards (usually the lower end cards). Also, I think soft shadows are less of an issue if the shadow isn't too big.

    Guess it's pretty much up to what you feel more comfortable with doing.

    Share this post


    Link to post
    Share on other sites
    The book shader3 talks about possion disk shadow blur, which has to be the easiest to implement.

    Basically you render the object to a render texture (in solid black with white background), then apply possion disk filter (using a shader) to the texture, then project back to the scene.

    Share this post


    Link to post
    Share on other sites
    Sign in to follow this  

    • Advertisement
    ×

    Important Information

    By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

    Participate in the game development conversation and more when you create an account on GameDev.net!

    Sign me up!