Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by headkitgames · Nov 22, 2010 at 02:28 PM · iphonelight

how to simulate candle light on iphone

hi there!

i want to simulate a candle on iphone (no pro version) and I wonder if anybody just did this before. any hints?

thnx!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by skovacs1 · Nov 22, 2010 at 04:57 PM

I cannot say that I have done this before nor am I sure that I have truly accounted for the nuances and restrictions of iphone development in this answer, but here is how I would approach the problem:

Dynamic candle:

  • The light of the candle is represented by a point light. If you want shadows that react to this light, then you're stuck with Deferred Rendering.
  • If you need a visual representation of the flame itself, you could do this with particles, a flare or an animated texture.
  • The color of the light would be something of your choosing (green, purple, blue, orange) as best suits your use case.
  • You will want to vary the intensity of the light. This can be done by lerping between some random values or more effectively by doing some texture lookups to some noise texture that can provide you with smooth and more tweakable transitions, etc.
  • If using a visual representation of the light, you may want them to coincide. With particles, using the number of particles, their size or something to that effect could be directly proportional to your light intensity. With some customized sprite, etc. for a GUITexture or Flare, you would share control parameters for these as you would for particles. With a fixed animation of some sort, then you would be best off making an animation clip for your light and setting it up to sync with the other animation(s).

Baked candle:

This is the same thing, but a lot simpler for the engine and you aren't restricted to a given render mode. Since your light doesn't move, you can create lightmaps for the the light (and it's shadows) and then animate the lightmap(s) in stead of the light. The visual representation stuff would be about the same. If you needed the animation(s) to sync, the animation of the lightmap should sync with that of the visual representations in the same way light intensity would above.

It should be noted that to do this would involve controlling the lightmapping, which means that you might not be able to leverage Unity's built-in lightmapping as you typically would, but may have to roll your own and possibly even leverage a legacy lightmap shader.

Comment
Add comment · Show 6 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image headkitgames · Nov 23, 2010 at 01:09 PM 0
Share

thanx, sounds good. i started to play around with the particle emitter, butt I'm not shure how many candles the iphone would run. I also thought about fil$$anonymous$$g a candle and then animate a texture. maybe this would be the fastest?

your baked candle sounds interesting but I never worked with lightmaps before.

avatar image skovacs1 · Nov 23, 2010 at 03:24 PM 0
Share

As far as the particle emitters, it would depend on how you set them up, what the particles are, etc. There are some standard assets for things like fire, explosions, etc. Perhaps you might consider giving them a try. They shouldn't be too bad though. Fil$$anonymous$$g a candle sounds like a bad idea because trying to key out the alpha on live video is a pain and it doesn't usually composite beautifully into 3D space. A better approach would be to generate your candle video in another program and in there you can render it out with alpha as well.

avatar image skovacs1 · Nov 23, 2010 at 03:32 PM 0
Share

Lightmaps are fun, easy and can make your life so much better because they are cheaper than real-time lighting and can look much better. Essentially a lightmap is a texture mapping your lighting and is applied on top of the appearance of your material to give the illusion of being lit. It is a representation of what your light is doing to your object, stored in a texture. Because it is a texture, it doesn't do anything fancy like real-time dynamic shadows, etc. and it doesn't really change. It's generally for lighting that doesn't move and doesn't interact with anything that does move.

avatar image headkitgames · Nov 24, 2010 at 09:46 AM 0
Share

i now tried the iphone with 15 candles and 15 particle emitter flames. works quite well. thanx! is there a goor tutorial about using animated lightmaps? i thought dynamic shadows doesn't work with iphone in the first place (is this correct english?)

avatar image skovacs1 · Nov 24, 2010 at 03:53 PM 0
Share

Indeed, dynamic shadows do not work with iphone and are apparently a pro-only feature. Unity's Beast lightmapping can be done as directed here (http://unity3d.com/support/documentation/$$anonymous$$anual/Lightmapping.html). Lightmaps are generally treated as emissive and you can get something tunable by changing one of the built-in legacy lightmap shaders (Diffuse for example) to take in a Range(0,1) that you multiply the lightmap by. You would change this value in code and you have just animated your lightmap.

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

How many lights could affect at an object at the same time 1 Answer

Light not showing after iPhone build 1 Answer

How to turn on camera light (make a flashlight) on iPhone/iPad? 2 Answers

Unity iPhone - Do we get access to the iPhone's light sensor? 2 Answers

How to turn on camera light on iPhone? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges