You know that realtime shadow is just for Unity Pro. But you also can use Projector object to create semi realistic shadow (depends on how you draw the shadow).
- First what you need is shadow projection shader. You can download it here,
- And then open photoshop. Create some black and white shadow.
- Create new image with 256×256. Click Rectangular Marquee tool and set the feather to 30 / 15. And then draw it
- Press CTRL + Backspace to fill the selection. Make sure the color is white, black.
- Save it as .JPG
- You also need a falloff image.
- Create new image (photoshop) 256x*8. Choose the Gradient tool and then drag it from left side to right side (left side : black, right side : white). Save it as .JPG
- In Unity, create new material and then choose the shader to FX / Projector Multiply
- You also need to set the shadow image and the falloff image properties
- for shadow image, Set texture type to Advanced. Turn on the “Alpha from Grayscale”, and “Border Mip Maps”. Set the Mip Maps Filtering to Kaiser. And the final, set the Wrap Mode : Clamp
- Do the same for Falloff image.
- and then import shadow image to cookie (in shadow material), and falloff to falloff.
- Create new Projector object. Rotate it 90 in the X Axis.
- Create a new Layer named “NoShadow”. And then select to an object you want to ignore the layer. For Instance, blob shadow for player, set blob shadow as the child of Player, and then click player change the layer from Default to NoShadow.
- You also can use a script to lock the projector (for something like crate) by using private var awakeRot : Quaternion. At the Start function, write awakeRot = transform.rotation; and then at Update function, write transform.rotation = awakeRot;
July 18, 2012 at 2:59 AM
Very interesting information!Perfect just what I was looking for!
July 19, 2012 at 1:02 AM
You have mentioned very interesting details! ps decent internet site.
Pingback: [Tutorial] Fake ‘baked’ shadow in Unity Indie | Imagination XD
October 31, 2016 at 5:54 AM
Hello, In my case I find its better to put compression to Automatic Truecolor otherwise I will have artifacts in the borders when projector does rotate.
October 31, 2016 at 8:44 PM
Of course truecolor always better, but it’ll take more size and performance. But it still OK to use