views:

92

answers:

2

Hi,

I'm trying to produce a shader to replicate a white plastic object with a colored light inside. Either by having a shader that will be translucent and if I put a light inside the object the light will show through or by having a shader that fakes the effect of a light inside.

The effect im going for is kinda like a light going through a lamp shade similar to these pictures:

alt text alt text alt text

Ideally I would be able to control the strength and colour of the light to get it to pulse and rotate through some nice bright fluro colours

Though I'm not sure where to start!

My question is does anyone know the techniques I should be researching to be able to produce such a shader or have an example of the same/similar shader I can use as a starting point? Or even if you want to provide a shader that might do the job

+1  A: 

Nice photos. It looks like the type of translucent plastic you use can make a big difference. What I see is that the brightness of the plastic at each point is based on the angle between the ray from the light source to that point, and the surface normal at that point. (The viewer angle is irrelevant.)

When the vector from internal light source to surface point is nearly parallel to the surface normal vector, the surface point is bright; when they're nearly perpendicular to each other, the surface point is dark. So try using the dot product of those two vectors. Don't forget to normalize.

In other words, it's basically diffuse reflection, except that you're adding the effect of internal light sources (transmitted) to the effect of external light sources (reflected). See Lambertian_reflectance as a starting point.

You may also want to add a little specular reflection on top of that.

The third image is more complex: I think it's showing the shadows of the inner surfaces on the outer ones.

LarsH
+3  A: 

You might want to do some research on Subsurface Scattering to get an idea of how to go about recreating this kind of effect. Subsurface scattering is important for rendering realistic skin but in that case you are generally dealing with a light in front of or behind a translucent object rather than inside it. The same basic principles apply but some of the tricks and hacks used for real time subsurface scattering approximations may not work for your case.

mattnewport
This looks like the way to go! I looked at some examples of Subsurface scattering and I think with a little work it will be perfect! Thanks
Tristan