- Home /
What if you really, truly want real-time shadows on iPhone/iPad?
NOTE -- it looks like Unity4 has realtime shadows on iOS, so this question is now of historic interest only
Unless I'm mistaken or something has changed recently, essentially you cannot use realtime "actual" shadows on mobile - iPhone, iPad. Of course, you can:
bake in some shadows, awesome for static objects ( http://unity3d.com/support/documentation/Manual/Lightmapping.html )
you can use a blob shadow solution (which is a projector ... http://unity3d.com/support/documentation/Components/class-Projector.html ) which is a fantastic solution for implying the sense of a shadow under a moving character or vehicle (particularly useful to help mentally suggest the altitude of the item, if it bounces up and down)
However, in some cases you may need an actual, hard, calculated shadow of a particular object.
(I don't really have a use case example - but you can imagine a game where, say, the shape of the shadow of some key character or element is literally important to game play for some reason.)
The only way I know of to do this is literally "calculate it yourself" and pretend you are a gpu on an ongoing basis. This is of course untidy. It is messy for very regular objects (cubish) and really messy for any complex object.
Perhaps ..
(*) someone already sells some sort of package that solves this problem "So you need shadows on the iPhone..."
(*) there may be some obvious technology in Unity I am too dense to know about?
(*) is there some very simple way to cast shadows do-it-yourself that everyone knows about other than me? at least for, perhaps, overhead beams on to a flat ground? (perhaps an isometric projection of the object shape or something, just guessing?)
Any ideas or info appreciated!
I have tried using the Beast Lightmapping to create baked-in shadows for my iOS game, but I never get any results. The whole terrain dims or lights a bit, but no shadows to speak of. Is there a working example project somewhere that shows off baked in shadows for iOS?
Can you give a link of how to use Unity4 realtime shadows?
Nothing special is required. Just use your Unity Pro + iOS Pro license. This allows you to use the normal receive shadow / cast shadow checkboxes to enable and disable shadows. Additionally to that, you need to ensure that you are running on OpenGL ES 2.0 (default in Unity 4) and that the quality settings allow shadows at all
heh @dreamora ... I don't think you noticed this! -->
"NOTE -- it looks like Unity4 has realtime shadows on iOS, so this is now of historic interest only"
For you young people growing up with Unity4, you wouldn't understand the problems of the old days ...
Indeed, I missed that one as I jumped to the actual content as the question popped up at the top of the list.
And I agree, U4 users are kinda spoiled compared to us Unity iOS 1.0 users were back then ;)
Answer by Eric5h5 · Dec 12, 2011 at 08:46 PM
Ha, that's great :D the alpha channel as stencil buffer ;) I've got to look at the implementation...
+1
Answer by runonthespot · May 22, 2012 at 08:38 AM
The character shadow on the Unity wiki worked well for me; it's a neat trick involving RenderTexture and a projector (so requires Unity IOS pro unfortunately). Dial down the size of the texture to speed it up (and to taste).
http://www.unifycommunity.com/wiki/index.php?title=Character_Shadow
Results here:
Fantastic tip - thanks! That's a fantastic AR scene, congrats
Answer by Bunny83 · Dec 12, 2011 at 07:08 PM
"Real" realtime shadows are near to impossible. I guess stencil shadows won't work on iPhone because (i guess) the iPhone doesn't have a stencil buffer. It depends on what shadow you need. In this post( ricardo_arango's answer ) there's a script that will kind of "project" a mesh to a flat surface. Of course this will only work for flat surfaces.
Your answer
Follow this Question
Related Questions
Behavior of Realtime Shadows on iOS 1 Answer
iPhone Resolution Screen Switch 0 Answers
Mini Mac - Can this Compile Unity? 2 Answers
Too much triangles and more doubts performance-related 1 Answer
Unity modules for iOS? 1 Answer