x


How do I make a mesh visible only under a certain light?

Ie for UV/infrared lights.

I already know how to get a particular mesh to be affected only by a specific light, but this can't affect its visibility (just how much it reflects the light).

Basically- I want its visibility (alpha) to change, depending on how much light(from a specific source) it has recieved.

more ▼

asked Oct 15 '10 at 12:52 PM

Grimmy gravatar image

Grimmy
533 58 64 69

(comments are locked)
10|3000 characters needed characters left

3 answers: sort voted first

I'm fairly new to Unity, so I don't know if this is possible, but could you perhaps render once without the UV light, then make the object visible and render again, this time only using the UV light, and overlay the second image on the first?

more ▼

answered Nov 02 '10 at 05:50 AM

AlbeyAmakiir gravatar image

AlbeyAmakiir
45 4 4 12

(comments are locked)
10|3000 characters needed characters left

You can look at a specular shader for an example. Instead of increasing or decreasing reflection strength, you can increase or decrease alpha strength. You would have to make a map for it, depending on what you want the player to see, weather you want to view the object as a colored heat signature or just as a regular diffuse looking textured object.

more ▼

answered Dec 09 '10 at 07:48 PM

Matthew Crawford gravatar image

Matthew Crawford
36 3

(comments are locked)
10|3000 characters needed characters left

I'm sure there is a neat technical way to do this, but I'd just fake it with some triggers.

If you want an object to appear near certain lights, fade it in when it is near them and out when it isn't.

If you want the player to see them when wearing goggles or something, that's even easier. You can just flip them visible when he/she activates the item.

more ▼

answered Oct 15 '10 at 12:55 PM

Grumblekeen gravatar image

Grumblekeen
160 1 8

Its slightly more complicated than that. Imagine a first person game where the player moves a infrared torch around the room. Anything within that beam of light needs to show up.

In saying that, I could fake it with a long collision box which encompases the light beam and anything in the box alphas in?

Sound good enough?

Oct 15 '10 at 01:00 PM Grimmy

That should work.

My first thought was to cast a ray (or four) from your light source every half second or so (no need to do this every frame), and make anything it collides with visible, and anything it doesn't invisible.

http://unity3d.com/support/documentation/ScriptReference/Physics.Raycast.html

You might try both and see which works better in practice. I can see potential problems with the ray cast idea, such as smaller items popping in and out because they just happen to dodge rays, etc.

Oct 15 '10 at 08:37 PM Grumblekeen
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

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

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x86
x58

asked: Oct 15 '10 at 12:52 PM

Seen: 1048 times

Last Updated: Oct 15 '10 at 12:52 PM