Home Unity

SSAO with different settings for one object?

AlecMoody
ngon master
Offline / Send Message
AlecMoody ngon master
Is there any way to get an object to cast shadows with SSAO differently than the rest of the scene? It seems like it should be possible with layers but I haven't been able to figure out how to do it. Basically, I want a stronger shadow under the car, but not elsewhere. Image:

Replies

  • EarthQuake
    Options
    Offline / Send Message
    I don't know about Unity specifically, but because SSAO is a screen space effect, generally you can't use it in any sort of per-object way. SSAO doesn't really know about "objects", but moreso all of the geometry currently on your screen.

    Though I could be wrong.

    Could you do something like project a shadow decal underneath the car? Assuming the car isn't going to flip over or anything that should work.
  • AlecMoody
    Options
    Offline / Send Message
    AlecMoody ngon master
    A decal was my initial thought but I wasn't able to figure out how to set this up (needs to move across non flat mesh).
  • Brendan
    Options
    Offline / Send Message
    Brendan polycounter lvl 8
    The blob shadow default prefab is a good example of how to do this. It uses a projector that has configurable distance and size falloff, that's how 99% of games do shadows under cars.

    The way to make one is to put your car on a white square ground plane and do an AO bake on the ground plane. Then crop the darkened bits from the ground plane, tighten it up with levels adjustment so it fits nicely into a 512x1k or 512x512 texture, and use that for the blob shadow.
  • Farfarer
    Options
    Offline / Send Message
    SSAO can be done per-object, technically.

    The camera with the SSAO effect on it, needs to have the render layers set up so that it doesn't render the objects you don't want included in the SSAO pass.

    But, assuming your camera with the SSAO on is also the camera that renders the scene, you might need two cameras, one for rendering the scene and another identical one that renders the SSAO.

    But in this case, I suspect a blob shadow will be a lot easier :)
  • AlecMoody
    Options
    Offline / Send Message
    AlecMoody ngon master
    lol- It never occurred to me that unity would have a projector system. Easy and cheap:
Sign In or Register to comment.