1
votes

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 textalt textalt 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

2
well i have no clue how to do this but posting an image of the result you want would help i guess!Peter
I have heard a blinn shader may be similar to what im looking for? but if so how is it different?Tristan
Blinn shading is a faster approximation of Phong shading, which is used for specular reflection. You could use this for surface reflections in addition to something else, but Blinn by itself won't give you the diffuse light transmission you're looking for.LarsH

2 Answers

4
votes

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.

2
votes

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.