PDA

View Full Version : Faking SSS for realtime?


Prophecies
07-23-2010, 01:48 PM
Hey, I was sure I saw something about this around here somewhere, but after spending ages searching, I decided to ask away. Anyone have a tutorial regarding faking SSS in unreal? I would need it for my foliage.

Thanks in advance!

Mark Dygert
07-23-2010, 02:02 PM
I think you're looking for this?
http://www.cgfeedback.com/cgfeedback/showthread.php?t=528

divi
07-23-2010, 03:14 PM
transmissionMask and transmissionColor are things you might want to experiment with since they are just for that.

r_fletch_r
07-23-2010, 03:30 PM
You may be better of searching for translucent shaders than SSS for foliage. Why dont you look at the GDC 2010 tech demo scene that ships with UDK? thats covered in foliage.

http://www.youtube.com/watch?v=VzEKvZKY0Os
http://www.youtube.com/watch?v=M6U3aMo1LdA&feature=related

Prophecies
07-23-2010, 03:34 PM
Ahhh so THAT is the term I needed. Gotcha. Thanks!

Nielsen
07-25-2010, 04:45 AM
I hope this is useful, I based it on the way Crysis handles SSS (although they do it on a per vertex basis I believe) for one of my schoolprojects.

http://i48.photobucket.com/albums/f240/Nielsen144/SubS_Shader.jpg

http://i48.photobucket.com/albums/f240/Nielsen144/Subsurfacescattering.jpg

They plug into both the Transmission and Transmission Colour slots.

Goodluck!

haiddasalami
07-25-2010, 10:19 AM
That is sweet Nielsen. Actually just saw the paper they had, while I was looking for stereoscopic in Crysis 2.

divi
07-26-2010, 02:24 AM
thats brilliant stuff nielsen. the kind of shader construction that seperates the boys from the men :D

Xendance
07-26-2010, 07:35 AM
Considering that Crysis does it per vertex, and you do it per pixel (I assume), wouldn't that make it terribly slow in comparison to the Crysis solution?

r_fletch_r
07-26-2010, 07:39 AM
I think it depends on how he is calculating the vectors. As I recall Unreal lets you do it per vertex

Nielsen
07-26-2010, 08:00 AM
I can't say for sure whether this is calculated per vertex or pixel, I'm guessing the latter though. I suggest you use this on important assets only or swap out materials on the LOD as soon as possible.
It's a start anyways :)

Xendance
07-26-2010, 08:02 AM
I just did a quick test, and indeed it looks awesome. 8)

Andreas
07-26-2010, 08:18 AM
Interesting topic, I've been interested in faking SSS in game art for a while now, but I've been thinking about it in a different way (for characters). Is it possible to bake down an SSS pass like an AO pass and just overlay it on a characters diffuse? I know it wouldn't technically be SSS but it would look nice around the ears/nose to have some soft red showing up... saves painting it in :P

Neox
07-26-2010, 08:22 AM
well the most simple way would be using the inverse of your lighting multiplied by a colour, multiplied by a mask (i.e. your SSS pass, but as this is highly view and light dependend a thickness map would be what you need), basicly what it does is brighten up the areas that don't get hit by light, dependend on the thickness you give it with the mask, the colour could be another texture or just a solid color.

r_fletch_r
07-26-2010, 10:55 AM
You should look at what Nvidia did in their 8 series tech demos. Anything here so far has just been a really broad fake of thin object translucency there is no scattering going on at all.. kinda akin to what specular is to reflection.
The Nvidia stuff actually simulates the diffusion with blurred RTT bakes of the objects diffuse lighting and SSS weight maps. its awesome, Shadows and diffuse lighting are diffused in the skin in a pretty accurate manner.(based on real values sampled from human skin)

The Shader VIG posted was based on the Nvidia method but it uses blurred normal maps instead of RTT (no shadow diffusion)

haiddasalami
07-26-2010, 11:25 AM
http://www.google.com/url?sa=t&source=web&cd=3&ved=0CCAQFjAC&url=http%3A%2F%2Fdeveloper.download.nvidia.com%2Fp resentations%2F2007%2Fgdc%2FAdvanced_Skin.pdf&ei=c9FNTKJuhMaVB9jP4PYN&usg=AFQjCNHC21moDPbKbgJmuTdMdTKgrOUp9A&sig2=HYQu0D03dLKQXhGgahzlpw

Is this the one r_fletch_r

r_fletch_r
07-26-2010, 12:11 PM
Whats also nice is they're actually concerned with preservation of Energy levels and correct gamma.
http://http.developer.nvidia.com/GPUGems3/gpugems3_ch14.html
http://www.youtube.com/watch?v=A838dclFr5U

haiddasalami
07-26-2010, 01:22 PM
Yeah I saw the deal about gamma. On fxphd, if you look at the course mental ray techniques, a nice talk about gamma there. Didnt even know about that!

r_fletch_r
07-26-2010, 01:41 PM
Zap is a legend. I'm enrolled in that course at the moment. If you have the time you should do it. the information there so far isnt really mentalray specific its all about light and rendering.

Xendance
07-27-2010, 10:35 AM
Nielsen, any idea how to prevent your SSS hack making leaves glow when you look at them when the sun/light is directly behind you. I'm no good at math, especially anything vector related :P

Nielsen
07-28-2010, 01:08 AM
Hm, that is not happening to me at all.
Can you post a screenshot of both your network and the actual problem?

Xendance
07-28-2010, 05:52 AM
Actually I think it was because I didn't use a normal map texture, I just used the light and camera vector dot product. And with trees I used transmission masks that were boosted beyond 1 (brightness that is), same thing with colour. I just multiplied the SSS mask with a 3-vector constant before plugging it into transmission colour.