Home Technical Talk

Photorealism

DarkSquirrel
polycounter lvl 17
Offline / Send Message
DarkSquirrel polycounter lvl 17
i've been 3d modeling for a while now and there are a few things (some new some old) that i still have yet to fully understand when dealing with photorealistic models.

(bear with me i believe these questions largely deal with shaders, but since i know very little about shaders [beyond that you should use them] you can never be too sure)

1. An effect i've seen recently in a couple of tech demos and a few very snazzy renders that i've seen on the boards. Reffering to a back lighting and transperacy effect with skin. An example would be the nose and ears, when lit from behind (or certain angles) a red sort of transparent glow can be seen, not making them transparent, but enhancing that realistic affect.
playstation3eccola_speciale.jpg


2. Different hues for shadows on skin. Example: instead of going to skin color to darker skin color (via adding more black) it mixes in red and yellow values, looks nice and realistic.

3. Also what maps are essential when making a photorealistic model (preferably models that would appear in a next-gen game...or next-gen portfolio perhaps)

i had meant to add more of these when i started but, i guess those neurons mis-fired while writing ...hopefully i'll think of them later.

-thanks in advance

Replies

  • Joseph Silverman
    Options
    Offline / Send Message
    Joseph Silverman polycounter lvl 17
    I believe the effect you're talking about is Subsurface scattering.
  • DarkSquirrel
    Options
    Offline / Send Message
    DarkSquirrel polycounter lvl 17
    ahh, then would anyone happen to know of any tutorials for sub-surface scattering?
  • Daz
    Options
    Offline / Send Message
    Daz polycounter lvl 18
    For realtime or for rendering? In both cases all you really need is a shader, and they are out there. If you state what 3D. app you're using and whether you're interested in SSS for realtime or rendering then it'd be easier to point you in the right direction.
  • DarkSquirrel
    Options
    Offline / Send Message
    DarkSquirrel polycounter lvl 17
    Maya 7.0
    and both realtime and rendering (i'm interested in both)
  • Daz
    Options
    Offline / Send Message
    Daz polycounter lvl 18
    cgtalk is currently down, but there is an entire maya sub forum there for rendering.

    Try: http://www.highend3d.com/maya/downloads/shaders/

    There's a ton of shaders there. I don't know If you're using software or mental ray. I've tried a few SSS shaders. Some are a lot better than others. There's one there on the first page for mental ray that seems to be rated highly. I cant remember off the top of my head which ones I've tried. Render times are generally a biatch. But there are other shaders that are not true SSS but attempt to fake it.
    As for realtime, that might be tricky without an engine platform. Because mayas realtime viewport display is hardly the most sophisticated thing in the world.

    As for your earlier question about maps, again, it sorta depends on the final rendering situation, but at the least you'll usually need colour, specular colour, bump. But there are many others possible depending on what you're doing with your assets and how youre rendering and presenting them. Displacement, occlusion, all sorts of stuff. I sometimes use incandesence or ambient maps to fake SSS by painting a faint red glow on a black background in areas like ears, nose tip, lips and eyes.
  • DarkSquirrel
    Options
    Offline / Send Message
    DarkSquirrel polycounter lvl 17
    Thanks a bunch, do you know of any pages that explain exactly what a lot of these maps do (detailedly) i mean i know what a spec, bump, colour and whatnot do, but i don't exactly know how or why they work (especially for SSS)this has always plagued me a bit. sorry for the incovenience.
  • Daz
    Options
    Offline / Send Message
    Daz polycounter lvl 18
    http://en.wikipedia.org/wiki/Subsurface_scattering

    As its name suggests, Sub Surface Scattering is a complex algorithm that attempts to bounce light around beneath a surface in the same way that it does in reality. Beyond that I'm not sure I follow what you mean by 'how' they work. Sounds to me like you're wanting to get to higher level rendering theory? This is an awesome book for that stuff: http://www.amazon.com/gp/reader/1562059548/ref=sib_dp_pt/002-3899493-7024832#reader-page
    but it's not geared toward skin. But you will find out what stuff like ambient occlusion and caustics are.
  • DarkSquirrel
    Options
    Offline / Send Message
    DarkSquirrel polycounter lvl 17
    why thank you very much, i am in fact very interested in complex rendering theory, i want to become proficient to write very solid shaders (not to mention i'm also working on C++ game coding involving rendering) so again, thank you.
  • Daz
    Options
    Offline / Send Message
    Daz polycounter lvl 18
    I have no clue how to write a mental ray shader, but Im sure these people do: http://www.mentalimages.com/2_1_3_literature/index.html
  • John Warner
    Options
    Offline / Send Message
    John Warner polycounter lvl 18
  • Eric Chadwick
    Options
    Offline / Send Message
    Hey Daz, did you guys ever implement that lightmap-blurring SSS hack I mentioned looong ago? I think we were talking about it on the old gamespy forum. Curious if it turned out.
  • Daz
    Options
    Offline / Send Message
    Daz polycounter lvl 18
    Implement in game?
  • Eric Chadwick
    Options
    Offline / Send Message
    Yeah, guess not eh?

    I'm starting to play with some in-game lighting options now, like that pseudo-BRDF I mentioned in the other thread, plus some other shader ops like rim lighting, light-oriented masks, normalmap tricks, etc.

    I was curious about your take on realtime skin lighting, if you saw anything promising lately, besides those shaders from J.I. Styles and Ben Cloward (which are pretty nice btw).
  • J.I. Styles
    Options
    Offline / Send Message
    J.I. Styles polycounter lvl 18
    Bit off topic, but still within the photorealism domain -- Eric, if you're looking into in-game lighting and shader ops at the moment, one of the best things in my experiance is to implement a full featured specularity pass instead of the vanilla crappy approximation used in most all cg. In other words, treat specular like real life surface reflections with fresnel based specularity on the base/master material. If you know vray's setup, that's pretty much exactly what you want -- treat specularity as reflection, gloss as bluriness and radius of that reflection, IOR for fresnel effect, and use any method to kludge high range highlights (or just use hdr floating point cubemaps). Looks fantastic, and is one of the biggest visual improvements you can give an artist to use over every surface type.

    In regards to skin specific, if you're using a depth buffer for your shadows, use that to create a depth volume for sss on your models so you can differentiate between thickness of surface and light penetration.
  • Eric Chadwick
    Options
    Offline / Send Message
    Awesome info, thanks. I like the depth buffer idea, but have no experience with it. Does the gradient range generally cover the whole scene? Or is it kind of a full white-to-black range for each entity (or per-surface?)?


    We have some interesting controls going into the specular bits, don't know if it'll be enough yet.

    First is separate spec-width controls for R,G,B, plus an overall scalar.

    2nd is bump alpha being per-pixel scalar for specular/reflection/transmission.

    3rd is per-pixel specular color, gotta have that.

    4th is that BRDF thing (thread), which sounds like it'll allow tight control over fresnel-like effects, except it's light- not camera-oriented. Sounds like you're talking about camera-facing fresnel though. Hmm.

    5th is this other control that biases the light between straight-on and sideways-on, which is then perturbed by the per-pixel normals. Kind of a "rim amount" spinner. This might be camera-oriented, need to check.

    6th is this interesting (but potentially expensive) masking technique we call "veils" that lets us blend between multiple surfaces based on gradients, which can be oriented/constrained to the light, the camera, another object, etc.

    Oh well, kind of blabbing here. Stimulating though, wondering about these things. Curious about the depth buffer idea.

    Seems on-topic to me btw.
  • J.I. Styles
    Options
    Offline / Send Message
    J.I. Styles polycounter lvl 18
    Here's a bit of a rant on it:
    Ideally you'd use the depth buffer with floating point precision per object -- then you have a range from paper thin (0) which would be full transmission minus surface density, to a user controlled cutoff value (your "roof" value where the object is too thick to let any light penetration through at all). The trouble there is once you've got that range and clamp it to your values, you need to do the scatter radius/co-efficient, and that means a render to texture and blur, or do a point search per pixel to neighbouring pixels. I'm sure there's a few other ways too but the problem is that then gets into raytracing territory :/
    The nvidia demo in the first post uses the basis of this method but they also have occlusion and base it solely off the ramp.
  • Eric Chadwick
    Options
    Offline / Send Message
    Hmmm, then that sounds like we could do something similar to the Nvidia method, since our "veil" method can constrain the gradient to units of the bbox of the surface entity (could even have multiple surfaces per mesh, ala Multi/Sub-Object material), and the gradient would be in a line pointing toward the viewer.

    Not sure about how we can do the occlusion part though (without some programmer time).

    Why do the scatter radius? I did a quickie approximation of our veil effect in Max (waiting on our material makeover), and it seems like this could work without a scatter/blur.

    sss_gradient.jpg
    Biggest problem I see is that the depth is per-surface, not per-finger. Oh, and computation cost, but let's just ignore that for now. crazy.gif

    I thought the blur trick was when you render a lightmap, then blur that, because it tends to grow outwards, simulating the subsurface scatter. So it's not really a depth effect at all, it's just expanding/smoothing the area that the light hits...
  • J.I. Styles
    Options
    Offline / Send Message
    J.I. Styles polycounter lvl 18
    The veil effect you've posted may be a way to get a subtle approximation, but it unfortunately won't work with differentiating between thickness (see how the light is just as strong on the fingers as it is on the wrists) -- to get that thickness you need to do a two pass depth test on forward and backward facing geom. The nvidia technique is pretty much exactly that, but they're doing it in a very literal and cumbersome way (but! it works wink.gif )

    Here's the nvidia write up, a really good read:
    http://download.nvidia.com/developer/presentations/2005/SIGGRAPH/Truth_About_NVIDIA_Demos.pdf

    The blurring of the depth test is pretty much to simulate the scattering part of the sub-surface light transportation -- in other words a cheap way to soften up the geometrys effect in the process so it's not just straight linear light transport through one side and out the other; you get a scatter angle happening from impurities within the volume bouncing light through as well as backwards and forwards (if you animate that hand turning around you'll see the difference of the faces when their normals start to become perpindicular -- you can see this with the sharper bands of gradient in the pic).

    as such it's not truly needed, but it's another level of control and kludges a look that's closer to being "more right" wink.gif
  • Whargoul
    Options
    Offline / Send Message
    Whargoul polycounter lvl 18
    I am currently a big fan of the "blur-the-lightmap-and-reapply" method: it get a very nice, subtle (and that's the key) softening of the light striking the skin.

    I find the thin-skin translucency thing is way overdone - in real life it's a very subtle, and rarely seen effect except in certain special cases (sunlight coming through the ears). I've seen far too many people slamming on an SSS shader and cranking it up, and ending up with the glowing ear tips syndrome. I don't like that at all.

    I'm sure it has it's uses in-game, at special moments only (nuclear blast going off in the background - bat wings in front of sun, etc) - but for a genreal purpose I find it obnoxious. Maybe because it's the "hot" thing, it's being overused, and used improperly.

    Remember - skin is subtle. Soft shading, and good texture maps will take you %99 of the way there. Most of these effects are very expensive, it's probably better to make better textures and put 3X the number of characters on screen. Save this crap for special moments in the game.

    Example of overused SSS shader (why the fuck are the ears glowing?):

    http://206.145.80.239/zbc/attachment.php?attachmentid=24487

    (drinking always gets me in a ranty mood wink.gif )
  • J.I. Styles
    Options
    Offline / Send Message
    J.I. Styles polycounter lvl 18
    haha wooooo and check out that tongue made of jelly smile.gif

    absolutely agree with you -- it really should be a subtle affair with skin. I'm interested in a wide application of such a technique - yes the ears should not be bioluminescant like a jellyfish, but at the same time it's quite obvious when there's no thin penetration at all through a volume (and blurring the lightmap unfortunately doesn't get this). Doing a lightmap blur is a good solution to light wrapping, but not light going through a surface - the matrix movies all suffered from this, the solution being to make sure there was enough ambient to dispell any backward facing dark spots. So that's an easy way to get around it is just have no harsh lighting conditions. easy done. Any light condition with harsh single point light can really do with it though -- virtually all the survival horror games suffer from concrete characters when it's lit by their single oddly small-coned flashlight.

    Like you pointed out, it's all really not needed, but is a desirable in certain conditions (which really should be in the minority). View-hands lighting up when casting a fireball in an fps... membrane of wings... marble surfaces... vegetation... from making in-game food look appetising and not like concrete, right up to that putrid looking giant grub boss.
  • CrazyButcher
    Options
    Offline / Send Message
    CrazyButcher polycounter lvl 18
  • Eric Chadwick
    Options
    Offline / Send Message
    Thanks everyone, good stuff to chew on.
Sign In or Register to comment.