|
Making a DX skin shader
About Truespace Archives
These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.
They are retained here for archive purposes only.
Making a DX skin shader // Tech Forum
Post by RichLevy // Jan 23, 2009, 3:04pm
RichLevy
Total Posts: 1140
|
OK... where to start?
In XSI, I can take a lambert shader and give my character a basic skin color. To that node I can add several other types of shaders to combine together different effects. Sometimes I would use a billowy cloud shader, sometimes a cell shader... I could adjust the percentage of effect each of these shaders had on the overall output to the final shader...
Look at the picture. See the way the skin has variation.
How do I get to do this with DX shaders in TS?
Thanks
Rich |
Post by RichLevy // Jan 23, 2009, 4:12pm
RichLevy
Total Posts: 1140
|
A quok thru PaulA tutorial on shades tells me I am probably going to have to make what I want myself. I looked at the Transluence Material shader in the MAterials DX9 Library, I can get some of the information I need there, that particular shader tends to give very harsh unrealistic results...
I have never tried to make a shader like this... any tips or pointers I should consider?
Thanks
Rich |
Post by prodigy // Jan 23, 2009, 4:18pm
prodigy
Total Posts: 3029
|
The best person to answer your question seems to be Marcel..
If you search on DX shaders you'll find a lambert shader.. but im agree, translucent shader is the key for realistic skin..
Btw, Happy 1000 Posts ;) |
Post by Mr. 3d // Jan 23, 2009, 4:22pm
Mr. 3d
Total Posts: 747
|
Who said that !!!:D:D:D:) |
Post by prodigy // Jan 23, 2009, 4:38pm
prodigy
Total Posts: 3029
|
:) mr3d :) |
Post by RichLevy // Jan 23, 2009, 4:46pm
RichLevy
Total Posts: 1140
|
The best person to answer your question seems to be Marcel..
If you search on DX shaders you'll find a lambert shader.. but im agree, translucent shader is the key for realistic skin..
Btw, Happy 1000 Posts ;)
I don't want to bother Marcel, at least not yet :) I am just getting started, I have lots to learn so I get up to speed as fast as I can on my own and than when I know what I need and basically what I am doing... than I'll start pestering people. :D
Rich
This post makes it 1000 :D boy I sure am a talkive one |
Post by Délé // Jan 23, 2009, 5:38pm
Délé
Total Posts: 1374
|
I'm afraid you'll have to learn HLSL and/or scripting to achieve this in tS right now Rich. I guess it depends on how far you want to take it.
The way I would suggest is to script a bitmap so it creates a tileable skin texture. You could set it up so the user could change the skin tone, variations, freckles, etc. It would definitely take some work to get it looking good, but possible none the less. There are a couple of bitmap creation scripts in the scripts library that you can use as a reference.
You could also use premade bricks to assemble some of the shader. For translucency you would need to dig into HLSL. Parva already made a good skin shader with fake SSS. I started writing a fake SSS shader of my own too. There are some websites you can look up for info on how this is achieved. Basically you just wrap the light around the model farther than it normally would go. Though that only works for convex models. I think there are more advanced methods of faking SSS. I hadn't gotten to that yet.
So basically it would take a lot of work and scripting knowledge Rich. The easiest way of course would just be to use Parva's skin shader. I haven't messed around with it yet, but if I recall, he even had an input for melanin so you can adjust the skin tone. |
Post by RichLevy // Jan 23, 2009, 6:07pm
RichLevy
Total Posts: 1140
|
Thanks Mat
I am not going to pester Parva right now. He said he included one in the free sample pack, though I have not figured out which one it is :) I don't want to keep asking him for help on this... So I am going to venture on with what I know. I have had pretty good luck in the past making Skinn shaders in other packages, I am going to guess that TS should not be any different.
I'll see what I can come up with, the translulent shader that is in the Materials library while not exactly pretty for human skin does come withthe basic ingredients.
Thanks
Rich |
Post by kena // Jan 23, 2009, 9:48pm
kena
Total Posts: 2321
|
One or more image masks would do it. It would end up being a very complicated shader. But I figure that if you can do it with two images/colors, then you could probably do it with more. Good luck! |
Post by parva // Jan 24, 2009, 5:11am
parva
Total Posts: 822
|
skin is a very complex thing.
Sometimes I would use a billowy cloud shader, sometimes a cell shader...
Yes, a voronoi function would be cool :)
Even if I know the math for some HLSL noise shaders they wouldn't work in tS. There tS HLSL can't create empty textures.
Here another scripting language is needed that creates bitmap data.
Like the noise Bitmap from Johny.
I am going to guess that TS should not be any different
Indeed, layering materials is the same like in other programs that use node based material editing.
Only problem in DX could be very complex shaders but so far my gpu could handle every shader yet. |
Post by RAYMAN // Jan 24, 2009, 8:46am
RAYMAN
Total Posts: 1496
|
Best bet i would guess is to ad as much as you can into the base map
and dont go for any procedurals at least not in dx .....:)
But thats just what I think is best... |
Post by RichLevy // Jan 24, 2009, 12:04pm
RichLevy
Total Posts: 1140
|
I figure doing a full procedural skin shader in TS would be beyond my capabilities right now. I am thinking in terms of a Lamgert with normal channel, uv channel, textures alpha and hopefully a transparent channel. The Translucent and the 3XLAmbert seem to be good starting points :) I just have to experiment around some :) I wish there were more documentation and video tutorials on this. It seems a touch sparse.
Thanks all for the tips, pointers, direction pointing and words of warning :D
We'll see where this goes.
Rich |
Post by parva // Jan 25, 2009, 12:21am
parva
Total Posts: 822
|
Keep in mind that there are pros and cons with the translucent and 3x lambert (better a 3x half lambert) shaders.
The default lambertian term is "dot(normal, lightdirection)" which results in a shading
that has a perfect diffuse surface (such a material you won't find in nature).
The half lambert was (as far as I know) introduced from Valve.
It spreads the diffuse range of the lambert term by adding and multiplying with 0.5 (the reason why it's called "half" lambert)
That makes the shading softer there even dark areas can become light.
The problem is, that with these spreading the shadows creates artefacts
there the terminator (the zone between lit and unlit area) is so soft that you won't see it
in contrast to default lambert or phong shader with a hard terminator for example.
Just an explanation why some outputs can create weird results ;)
Layering shaders or math in general is quite easy.
Use the "interpolate" brick in the Components / Operators library
or "lerp" in hlsl which looks like:
color3 = lerp(color1, color2, intensity);
with the intensity value you set how much color 2 should overlay about color 1. |
Post by RichLevy // Jan 25, 2009, 5:29am
RichLevy
Total Posts: 1140
|
Keep in mind that there are pros and cons with the translucent and 3x lambert (better a 3x half lambert) shaders.
The default lambertian term is "dot(normal, lightdirection)" which results in a shading
that has a perfect diffuse surface (such a material you won't find in nature).
The half lambert was (as far as I know) introduced from Valve.
It spreads the diffuse range of the lambert term by adding and multiplying with 0.5 (the reason why it's called "half" lambert)
That makes the shading softer there even dark areas can become light.
The problem is, that with these spreading the shadows creates artefacts
there the terminator (the zone between lit and unlit area) is so soft that you won't see it
in contrast to default lambert or phong shader with a hard terminator for example.
Just an explanation why some outputs can create weird results ;)
Layering shaders or math in general is quite easy.
Use the "interpolate" brick in the Components / Operators library
or "lerp" in hlsl which looks like:
color3 = lerp(color1, color2, intensity);
with the intensity value you set how much color 2 should overlay about color 1.
Thanks for the nice hints and tips Parva, they are going to help. I just need to be able to relate to the way TS builds shaders to the way XSI builds them and I should be ok.
Any idea where Johny put that noise shader you mentioned before. I am not turning it up here on the forums?
Thanks much!
Rich |
Post by RAYMAN // Jan 25, 2009, 11:32am
RAYMAN
Total Posts: 1496
|
Rich !
I´d build everything into my map and just use a slight sss shader.
procedurals used on skin can be counterproductive.
i can only remember one realy good reason for using layered skin
and that was for the Golum in the fellowship of the rings
where the skin had to be realy thin and the veins from underneath had to look
through.
I respect the realtime engine of TS very high but its not suited for this kind
of subtility !
Heres an example of a detailed map and a render. You got to invest time
in photoshop to get good results....
Rich !The map is the ticket !
Peter |
Post by GraySho // Jan 25, 2009, 12:03pm
GraySho
Total Posts: 695
|
I disagree with you rayman, with DX9 a technology has been introduced to realtime graphics where only the imagination is the limit. Look at latest games like crysis, five years ago everyone would have said that this would have been prerendered grafics, but it´s realtime and relys heavily on HLSL shader language. If you own the game you can actually find all the shader scripts used in the game. |
Post by RichLevy // Jan 25, 2009, 2:12pm
RichLevy
Total Posts: 1140
|
Hey Pete
That is a very good method, and I am very familiar with it... but it is not the way to learn a new set of tools. I could have used the sculpting tools in Modo or Silo to make the head, I know enough about both to have done a very good job on the head I did. I chose to use the tools in TS to see what the tools were capable of. I learned they do pretty much whatever I need :) I was able to show other people in the forum the same.
It's about the journey, it's not about creating something. I want to document the process of creating something and what I did, and how I solved it. Using DX shaders is a sparsely covered subject here on these forums. The easy way out is to do them as you suggest. I want to make them with using the technology in TS... DX Shaders are a powerful feature, yet they do not get enough attention... Partly because of the sparce information on them and partly because of the workflow needed to create them.
If I had more time over the last week I would have something by now. Because of the lack of time it will take me longer than I would like... sometimes it's about the journey :D
Rich |
Post by RAYMAN // Jan 25, 2009, 3:56pm
RAYMAN
Total Posts: 1496
|
@ Rich i understand you very well. i too am experimenting with
the dx shaders. whatever I do i dont get the results that I want to have.
Crysis looks awsome I wished I could get that quality out of
workspace. I figured out that Dx9 and Dx9 isnt the same.
at least I dont get it out.:o
I´ll post 2 files the default scenes from daz studio something everybody
can reproduce to show the difference between reltime DX9
and rendered........ thats like day and night !:( |
Post by RichLevy // Jan 25, 2009, 4:50pm
RichLevy
Total Posts: 1140
|
My point of starting the WIP head thread and this one here was not to find all of the faults and slag the program. I am just trying to work with what is here Pete, and find a way to do this. Beating an already dead cow does little to make things better or different... I am learning the differences, both from the programming level, the user input level and the output results level...
DX9 is the little brother to DX10, and down the line for MS DX tools. There is nothing wrong with learning an industry standard...
Hope you understand
Feel free to post in this thread, and lets try to keep this on a high note, I am not interested in finding the faults and trash the program, I want to find the solutions and work a rounds for the kinks in the road.
Rich |
Post by RAYMAN // Jan 25, 2009, 5:06pm
RAYMAN
Total Posts: 1496
|
I am not interested in finding the faults and trash the program, I want to find the solutions and work a rounds for the kinks in the road.
Rich
I didnt trash the program Rich just stated that I never got the results
that I should have gotten and thats the purpose of this thread I asume
to get and to learn how to do it. I´m just miles away..... and whatever i did
just didnt change that.As you said there isnt very much documentation.
some of the wow examples that we saw when Ts 7.5 was presented
included pictures with baked GI and that simply isnt very fair if you dont
have a program to bake out with. I tried with the sss shader that Parva
posted and get orange wax skin with using maps like i normaly do .
I will post some of my results as soon as my offline renders are finished.
I dont blame it on the program I blame it on myself ......
Peter |
Post by noko // Jan 25, 2009, 7:02pm
noko
Total Posts: 684
|
OK... where to start?
In XSI, I can take a lambert shader and give my character a basic skin color. To that node I can add several other types of shaders to combine together different effects. Sometimes I would use a billowy cloud shader, sometimes a cell shader... I could adjust the percentage of effect each of these shaders had on the overall output to the final shader...
Look at the picture. See the way the skin has variation.
How do I get to do this with DX shaders in TS?
Thanks
Rich
Using translucent material in DX library (created by parva :) ) I've have gotten great results from this shader or results I like very much. Here is an example. Lightened up sceen a little using post process on second image more. |
Post by RichLevy // Jan 25, 2009, 7:13pm
RichLevy
Total Posts: 1140
|
Cool, we are on the same page :D
I have tried many of the packaged shaders at this point, I have been collecting everything I can find here on these forums and in the beta forums... I am trying to figure out the basics to working at building them up as Parva does with the bricks, and than looking into some of the scripting involved...
There is lots of experimentation it appears. There are some that seem to have figured out some of it anyway, there are shaders apeparing on these forums and in the beta forums from user's banging away...
Looking forward to whatever you come up with Pete.
Rich |
Post by RichLevy // Jan 25, 2009, 7:16pm
RichLevy
Total Posts: 1140
|
Using translucent material in DX library (created by parva :) ) I've have gotten great results from this shader or results I like very much. Here is an example.
Do you mind sharing your settings here Dave? I have had pretty bad results myself. Plastic looking skin. I am trying to figure out how to get Johny's cloud and noice materials hooked up but I just do not get what it is I am supposed to do yet...
Rich |
Post by RAYMAN // Jan 25, 2009, 7:52pm
RAYMAN
Total Posts: 1496
|
If you look at both Nokos example and examples from the cry engine games
they are not using procedural noise.Its all in the map.
If you look at Parvas shader you get the sss effect and you get an orange
tint which I dont like. Thats what I was saying....
Its very hard to balance !
see the examples from the cryengine 2 also..
http://www.crysis-shooter.de |
Post by noko // Jan 25, 2009, 7:53pm
noko
Total Posts: 684
|
Really high res textures, normal map node which I added to the shader, and Specular map and Translucent map which are the same map in this one. This is a imported Daz figure and textures but the shading is all tS. Here is modified translucent shader with normal map. I started to redo the panel but never finished. This maybe the 7.5 version of shader which parva updated later on for 7.6. It has all the settings except textures I used for last image. Now if material doesn't load I will have to do in 7.6 please let me know. |
Post by noko // Jan 25, 2009, 7:59pm
noko
Total Posts: 684
|
If you look at both Nokos example and examples from the cry engine games
they are not using procedural noise.Its all in the map.
If you look at Parvas shader you get the sss effect and you get an orange
tint which I dont like. Thats what I was saying....
Its very hard to balance !
see the examples from the cryengine 2 also..
http://www.crysis-shooter.de
Actually getting the orange out isn't too hard. Adjusting the different colors can do that. Mostly unsaturating the colors seems to do the trick. |
Post by RAYMAN // Jan 25, 2009, 8:11pm
RAYMAN
Total Posts: 1496
|
Ok Noko thanks I´ll try that..
Peter |
Post by parva // Jan 25, 2009, 11:09pm
parva
Total Posts: 822
|
The math for the translucent shader for tS is very similar with the skin shader from crysis if not even the same.
What I found in the fx shader is nothing very different of what translucent shader offers.
Fresnel calculation and lots of lerping :D
David is right with the tint. You have to adjust the color.
The reason why crysis and games in special looks so "cool" is still the texture work (and postpro effects sometimes).
Take a look at the superb head textures, if you have crysis you have access to all textures and shaders
and can take a look at it.
Regarding shaders. You wouldn't believe but we can use shaders in truespace games wouldn't support
due to the amount of instructions and amount of shaders.
Again crysis as example - it doesn't use cook-torrence shading but simple blinn/phong shading.
The same for oren-nayar. Either simple shaders or shaders that use lookup table instead of calculatiing the shading in realtime.
Personally I switched to C-T there I find the shading a bit better and enhanced it in my custom shader.
Visually you can have the same results as in crysis or in any other game.
There is no difference, DX is the same. It depends how your textures look,
the kind of shading and special / postprocess effects. |
Post by v3rd3 // Jan 25, 2009, 11:57pm
v3rd3
Total Posts: 388
|
Parva, is there a text book or something that would help me get started understanding the terms you are using? |
Post by parva // Jan 26, 2009, 4:39am
parva
Total Posts: 822
|
Parva, is there a text book or something that would help me get started understanding the terms you are using?
The book "Advanced Lighting and Materials with Shaders" which I used for some of the model shaders is a good one even if I think it's not really a book for introduction. Wordware Publishing has some Shader books and those who download the free package get even a price discount.
The book "Shaders for Game Programmers & Artists" is another nice one.
This has also a table with all HLSL instructions and a sample how to use it.
It uses Rendermonkey as sample program.
Regarding HLSL, I think it's no waste of time to understand that language.
I'm absolutly no coder ( I got a very bad grade in PASCAL writing at school :D) but HLSL and GLSL (for OpenGL) aren't difficult.
I would also say thats very easy to setup DX shaders in truespace.
Generally you have to code vertex and pixel pipepline separatly and often first to set transform matrices for eye in world etc..
In tS you don't need that (this has good but also some bad results but thats another story)... |
|