Translucency and Subsurface Scattering

Hey guys, recently I started working on Translucency Shader since I didn’t find any free solution that suited my needs - namely something that reproduced light scattering inside the object, not just view-dependent light transmission based on depth. So I wanted to write a shader that approximated the light propagation inside the object’s volume.

I tried to approach the subject in a few different ways. First I wrote a custom raytracer to map the light scattering and produce a volume texture.

2264135--151553--Volume3.jpg

It works fine for simple objects but it takes a long time to calculate for complex objects in order to achieve a good result. Still, it was a good starting point.

Then I figured out a way to do it much faster while still retaining most of the quality. It still requires a custom pre-calculation (which unfortunately cannot be done externally on xNormal for example) which I’m trying to improve, but I’m very pleased with the results so far.

Here’s a bit of an extreme example, a cylinder with a directional light at noon. There’s no light falloff, no light hitting at the sides and the top of the cylinder normals aren’t “smoothed”.

Last but not least, some nice transparency with a volumetric feel:

13 Likes

That’s the most beautiful green booger I’ve ever seen. :slight_smile:
Does it have to pre-calculate everytime the light direction changes?

2 Likes

Awsome !!! Almost Renderman Quality .:slight_smile:

Very nice. I’ve wanted to work with translucency shaders, but haven’t had time. I could use one for some of the current stuff I’m doing for my game Aeronautica.

It does look pretty disgusting, right? I modeled something abstract with all the shapes I wanted to test in one model. It ended up looking like that.

As for your question - No, you can change light at run-time without problem. It’s not static lighting.

1 Like

Great work!
Will you be releasing this shader on the Asset Store?

This is Gorgeous!!

Thanks!

I’m not sure yet. They’re probably not very friendly with mobile devices and what not, but at least they work with both Forward and Deferred cameras.The problem is that these shaders require some setup, they’re not plug-and-play. I’m trying to automate it and make it as simple as possible.

Whoa, it looks awesome

Here’s an exaggerated translucency and scattering applied to a sculpture. Figured it’d show the effect better.

4 Likes

I guess you could use this as a skin shader as well?

This looks amazing!

Thanks!

Probably. I’ve added a few things that could help achieve that effect like a subdermal map, though I haven’t done a lot of testing yet.

I’ve been working on transparency today, made a nice transition from clear to blurred transparency based on depth.

2267319--151849--Translucency_Transparent2.jpg

I think I’ve solved the traditional issues with z-writing and depth but I haven’t started working on it yet. Hopefully it will work.

3 Likes

amaze. I was re-watching Jurassic World earlier this week and Jurassic World Spoiler when Chris Prat is first chased by the Indominus Rex, the dino bends down and you can see the flesh stuck on the INSIDE of the teeth, WOW, whoever spent time on that awesome , my jaw drops with some good Sub Surface Scattering.

Good God this is so delicious. I’ve yet to dive into shaders, but this really makes me want to, now.

Beautiful work. And please consider releasing to Asset store. :smile:

I started to get into shaders a while back, but gave up. This is definitely make me want to give it another try.:slight_smile:

Were you making these shaders for a specific project, or were you just experimenting?

I’ll work on cleaning the code next week and see how it goes, but no promises. If I feel confident that I can deliver something stable and intuitive I’ll publish it.

No specific project but the lack of subsurface scattering shaders in general is something that has bothered me for some years now.

Here’s something a bit caramel-like.

2269379--152074--Translucency_caramel.jpg

6 Likes

I’m in the process of rewriting the shader, which due to my limited spare time might take a while, so no time frame. Basically learning the new stuff that came in 5.0 and how to integrate it. I also hit a bit of a brick wall trying to make one of the variants energy-conserving.

I think no current asset uses the same method that I do, so I’ve decided that I’ll release it on the Asset Store when I’m done. Again, I can’t promise on a time frame, but if I feel like this is gonna take longer than it should I’ll release the simpler version used in the first post (the green thing) for a reasonable price.

amazing, do you compute a thickness map?