Search code examples
graphics3dshaderhlslpixel-shader

HLSL Translucent Plastic Shader


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


Solution

  • 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.