Hey to all,
I was wondering how would anyone go about determining what is a Spec Level map vs. a Glossiness map in terms of actual usage. I might as well make it clear now that I'm also creating my own shader, so that also account for my confusion.
I have been saving ladies and stopping trains, with my mere power of my mind, but everytime I think I have the grasp on how a Glossiness Map works, suddenly, a new challenger appears, under the banner of being a Spec Map.
Please note, I know what I Glossiness map is supposed to do, as well what a Spec Color is, but I'm having a hard time trying to understand what the clear difference is between a Spec Level and Gloss Map is.
To give an example:
http://i32.tinypic.com/orkksy.jpg
Both right maps (up and down) are easy to understand, one is the Spec Color and the other is the Glossiness Map, fair enough.
http://www.plus5awesome.com/img/spts/tex01s.jpg
This is supposed to be a Spec LEVEL map from what I understood, and like most of the 3D totals tutorials and textures DVD's, they also look like that.
HOWEVER, since I'm trying to get on grips with shaders, what makes it worse is this:
http://knol.google.com/k/shader-fx-advanced-material#
Even in the case of UDK and countless other 'displays' on how shaders use these values, people like sticking in a number instead of showing an actual map and how it can be boosted with a constant (I still would like to use my artists skill, thank you very much), my problem is what is what, and why?
I cannot for the life of me understand what to do at this point, because I'm lost, especially on how BOTH a Gloss and Spec Level Map are supposed to work together.
Any help here, pretty please?
Replies
http://wiki.polycount.com/SpecularColorMap
Specular Gloss = the width of the specular. A tight specular mimics a very smooth shiny surface, a wide specular mimics a rougher surface. Also called Specular Power.
http://wiki.polycount.com/SpecularGlossMap
Google images example...
Gloss = left to right. Level = top to bottom.
here spec is y (intensity) and gloss is x (width). that's all that happens in your typical blinn or phong shader. on a math level it's something like
spec calculation ^ (gloss*MAXGLOSS)
where MAXGLOSS is the highest possible gloss value you want to have. I've seen it being 128 or 256 but that's entirely up to you, there isn't any standard that I know of.
you can think of gloss maps as a surface roughness maps. the brighter the gloss value the more uniform the surface is and the more mirror-like the reflections get, while a low gloss value represent a rough surface and blurry reflections.
Since the wiki is abit poor, if anyone wants to add this post (please, pretty please do so I can reference it quickly) that would heaven for me.
Also, I threw up a couple of links I found which can add more value.
http://www.kxcad.net/autodesk/3ds_max/Autodesk_3ds_Max_9_Reference/specular_level_mapping.html
http://www.kxcad.net/autodesk/3ds_max/Autodesk_3ds_Max_9_Reference/glossiness_mapping.html
I have a problem though, I'm trying to control my Glossiness map through a RGB Map I made, but cannot for some reason get it work correctly, problem is, Specular Levels are FIGHTING or BRAWLING (har har, get it? Brawl and Fighting?) my Glossiness Map. Not matter what setting I use, the Specular fight it, and no matter what Gloss, it's fight my Spec level, and my Color Spec suffers in return, is there an easier way to this to use both short of me just throwing in a constant?
This is also impacting my Fresnel/Dot3 function, since it's simply 'brightening' it.
I would like to compile my shader and release it to the public if possible, but I would like to give the user the ability to use both since Glossiness is becoming more prominent as the 'control' map for a lack of better terms. Any help please?
EDIT: I'm using a Node based shader, and I 'r pretty dumb when it comes to code shader, so please be gentle with me.
EDIT2: Silly me, it's working alright, just had to test on a GI based model, bleh. Nothing to see people, move along and go and have sex or something.
I'm using ShaderFX for Max, and after I finish the material, I will most likely recreate it in UDK (if I don't become overly lazy that is) and maybe release that also publicly.
It's nothing special mind you, it's a Master Shader of sorts, Oren-Nayar-Phong, although friends of mine told me to switch to Ward-Anti, but I much prefer using a more standardized Specular Lighting option. Also, it's rather big, and since I don't have an ATi, I can't only support it for my own nVidia card, SM3.0, with shadows.
It uses an RGB mask as a master controller for everything. Each wire will have it's own set of instructions which will be very flexible (hopefully, I really hope since the organization is abit of a mess mind you).
For example, so far I have 2 Fresnel functions, one under Diffuse and one under Self-Illumination Map. For the case of my Diffuse, using the RGB mask, I want each channel to have a set of nodes (Constant and Color to control the strength and color of my Fresnel, and another Color which multiplies to my overall Normal map specifically for the Fresnel if I need to boost it). So this gives the user the ability to control the different levels of colors and strengths of the Fresnel on the Diffuse channel, incase they need to make changes on the fly without too much hassle.
Yes, this all can be done in Photoshop, but there is a reason many people use White SI maps with a Color node next to it, it simply saves time overall (plus, I'm learning alot from how to apply different shader techniques in different areas in a Standard limited shader).
Speaking of Self Illumination, in the case of SI (which I still don't know how to do it mind you) I would like to give the user the option to either use a Mask to create SI on only certain parts of their model as well the ability to use the RGB channel to create, again, using the Fresnel like the one for the diffuse channel, to give an overall glow to all the parts of the body with the required variables.
In this case, I could for example Subtract/Divide a map from my RGB map inorder to make specific falloffs for my model, but ShaderFX (like UDK as well) doesn't give me a button to switch between Math Operators on the fly, so I'm still deciding which one will be more friendlier to the artist/average Max user, while still keeping the idea of a RGB Map controller. I might also add a small animation of sorts, Sine and Rotate functions incase the user wants to animate stuff, although again, I don't know how to do it properly, since I cannot give the user tick boxes to enable disable said options, nor the option to jump between function waves such as Cosine, and etc.
Also, still not implemented, I want to add a Vertex Projection (sort of a decal projection from UDK) option, so incase the user wants to load, say a Cross and position it on certain body part of the character or environment piece, they can do that. Need to look and see how I can use the RGB map to break off parts of the projection incase someone wants to do something fancy
I was going to originally implement a Vertex painting option, RGB Vertex Paint not map this time, with a Subtract/Divide based upon the Ambient/Cavity map, so the user could blend in textures while they conformed to crevices and such, blending lets says Skin to Bone, which doesn't interpolate on the polygons smoothly, but instead blends with the cavity and such, and maybe even be desaturated using the Alpha, but I decided to skip this part and leave it for for another shader which won't be used for characters since it wouldn't make sense, although I could create a Vertex Painting SSS shader now that I think about it which blurs the normals and adds a color/constant falloff...hmmm...
Anyway, oh dear me, look at me go on, sorry mate, pretty sure you didn't ask to be schooled by a hipster like me, enough of my rant, I'll upload files and a copy of SFX tomorrow in another threads and see how that turns out. Will make a FX file also, but it won't be organized, best bet would be to take a peek the SFX.
Cheers.
also i don't recommend you to use a phong spec term. if you want something standard, blinn (half vector instead of reflection vector) is more common, faster and even more accurate.
In the case of UDK, from what I was told (and saw) it's much easier because I have access to a Switch Parameter, so I can toggle on and off willy nilly as I wish certain things I had in mind (as sort of True/False function if you will).
In ShaderFX, I don't have any access to this (or atleast, I don't see it, the closes thing I saw in a Modulate Operator, but I don't need that still).
Although I will try your technique, it sounds interesting for another block-road I had come to in another part of my shader.
I was under the impression that Blinn was limited to extremely metallic looking calculations and phong is better for overall as well organics, is that not so? Please don't beat me to death because I'm going in Google researches and nothing more so I don't know as to which one is better overall.
Also, since I'm at it, should I keep the Light Passes for my Shader to only One or Per Light?
Since I'm using a SM3.0 card, I was told One Pass is the best option, but for people with say an ATi or older cards, Per Light is better, any suggestion here? Also, with Per Light, my models tend to build too much of light saturation, while with One Pass, I feel I have more control, but then again, I'm not sure which is better for people and users down the Pipeline.
You can get very similar results with both, Blinn is cheaper though. Simply rendering them would have told you that though
What is this shader for? You seem to be trying to squeeze every feature under the sun into it. Which isnt really such a good idea if you plan on using it for anything other than presentation. You'd be better off creating 2 or 3 specialised shaders for different jobs.
I did try them out, with a Box, Sphere and Cylinder, and 3/4/5 light setup respectively as well Omni and Spot combo as my monster.
The gain/loss and difference between them was soo marginal with my tests, that I didn't know what to do, so Google search netted me at the fall of my hat an answer and most people said the following to summarize:
Blinn: Cheaper, faster, better for Plastic/Metal like objects.
Phong: Used more for things like leather, velvet, etc. but expensive.
So honestly, I went with the one that thought made more sense.
I think I should follow up about the Shader, I want to create it as a sorts of presentation shader as you put it, but also, as a way for people to experiment with it and take it apart to know what thing does what with which parts.
Even if I wanted to cram everything, I wouldn't be able to because things like Vertex painting need to be a shader of it's own, I can't mix currently.
To give an example: in UDK, the shader of the water of Day and Night cycle map is soo gorgeous that you could literally just change a few settings and still get something amazing, but in terms of game play, it is unfeasible. It can be used to learn how to create certain things (I learned alot from UDK's shaders mind you) and a person can also create a budget version of that shader if they chop it up and learn from it on what does what.
So don't worry, I'm not cramming stuff under the hood for the sake of it or to show that I can create an unoptimized shader with bells and whistles, I'm just trying to make it as flexible as possible, so that people can also prototype with it if needed.
So I should go with Blinn even if it's a presentation shader?
There are some subtle differences at glancing angles, but nothing you would ever notice except on flat planes.
blinn on the left, phong on the right.
Chornic, I just noticed using only one light, that if my character has bumps and crevices, it will show the fall-off of my specs and Fresnel more prominently from behind, especially if it's a Phong, while Blinn will wash it our more, however this only works Omni lights and not spot.
I guess I will go with Blinn, because call me old school, but I never knew sweat could shine in the dark, har har.
Either way, I decided to upload the current version along with maps and a mesh.
http://www.mediafire.com/?bk5amp5klr547dp
Still doesn't have everything I wish for, but the basics are built so far, so it's a matter of expanding them.
I only uploaded my SFX file, so I suggest you grab a copy of ShaderFX and use and take a peek at it. It's abit broken mind you, as in the shadows don't work correctly and only Omni lights function, so please report any issues you might have. Much appreciated.
Now you see, where was that when I needed it, stupid Google, instead of chars like that I get Power Ranger porn...
EDIT: Ooops, broken link, please download new one.
Mind telling me why? I did some research and a quick checkup, but I really have to say that I didn't notice a major difference, but this is what I gathered:
-It's good for skin
-Is not photorealistic (when opposed to Phong)
-Scatters light on it's viewing angle
-Faster then Phong
-Keeps the laws of physics much better (absorbing light, self shadowing, etc...)
Resources I found:
http://developer.nvidia.com/book/export/html/171
http://www.opengl.org/sdk/docs/tutorials/ClockworkCoders/lighting.php
http://artis.imag.fr/~Nicolas.Holzschuch/cours/Practical2/
http://www.smzy.com/smzy/tech4164.html
http://www.labri.fr/perso/knoedel/cmsimple/?Work_Experience:DaimlerChrysler_AG
http://szaber.com/grafx/index.php?id=2&kid=4
http://www.thinkboxsoftware.com/krak-shaders/
http://www.cg.tuwien.ac.at/~bruckner/homepage/content/mastersthesis/html/node34.html
Also, to mention, basic settings are Oren-Nayar, with Diffuse Roughness of 1.
Blinn, phong, oren-nayar, shlick etc all have diffuse and specular implementations.
Most often you'll be seeing a lambertian diffuse model with a blinn or phong specular.
Blinn's model is an approximation of phongs, and can be made to look identical with differing exponents.
Also that specular snapshot for the "argument" appears to have an anisotropic model on the left an isotropic one on the right, rather than just a blinn or a phong specular model. Both Blinn and phong generate round highlights in their basic form.
Phong's model is the most accurate for purely specular isotropic surfaces, these don't actually exist, but highly reflective ones do. Things like plastics, glass, etc. Anything smooth and shiny without much molecular granularity.
Its a slower model to calculate due to multiple dot products, an exponent, and multiple vector operaionts.
blinn = SpecColor * (Normal dot ((EyeVector + LightVector)/2)^SpecPower * LightColor
Blinn approximates phong by calculating a vector halfway between the eye and light vector then comparing that to the surface normal, rather than comparing the eye vector to the reflection vector of the light. Either way the closer the compared vectors are, the brighter the surface pixel.
Schlick's model can have similar results to phong or blinn, and is less computationally expensive due to removing the exponent.
The real question is what kind of look are you going to be supporting? Different diffuse models coupled with different specular models can give a wide variety of surface properties.
Really there is no reason you can not just go with a lambertian diffuse, blinn main specular, and a simple fresnel to replicate most of what is out there. Unless you are either trying to show off your shader skills (been guilty of that), or really need your object to illuminate differently, the least computationally intensive, or least shader instruction hogging models may be the better choices.
No one uses Schlicks approximation because the exponential function it replaces from Blinn is cheap enough not to worry about on modern hardware. The visual result of Schlicks Approx should be identical to Blinn's anyway.
Point being that none of these (blinn, phong, schlick approx) are physically based, they are empirically derived from observation, so you just do what you think looks best for your specular highlight.
Specular is essentially just simulating the reflection of a light source. In fact, Specular is just reflection. Gloss determines how much of that reflection gets absorbed by the surface.
Specular = Reflection
Gloss = Matt or Shininess of said reflection.
Uh, no. Blinn and Phong are models of the specular terms only, and Oren-nayar is an improved diffuse term. If they were all complete BRDFs they couldn't be mixed and matched the way they are sometimes (ie Oren-Nayar-Blinn). Your Schlick is really weird btw, and very different from the version I usually see and use;
fresnel = (1-(h·v)^5) + specvalue * (1-(1-(h·v)^5) )
or
fresnel = (1-(n·v)^5) + specvalue * (1-(1-(n·v)^5) )
It's an isotropic surface viewed at a glancing angle, in case that wasn't clear. Feel free to try it yourself. This has to do with the view angle more than isotropy, because well, perspective.
By the way mr. Ace-angel, I haven't looked at your shader yet but it kind of looks like you're not gamma correcting it. That's a pretty important step if you want good looking results. http://www.sjbrown.co.uk/2004/05/14/gamma-correct-rendering/ here's some information about that.
Schlick's approximation of Fresnel is very useful, much more efficient than trying to to a full fledged Fresnel calculation. No one would try to do a complete Fresnel function for real-time when the approximation is so good.
Thanks for that easy to read breakdown, this makes a whole lot more sense now to me.
I think I'll make two techniques in the shader, one is a Lambert Blinn as you said to keep default, and another one is...well, I can't decided what compliments Oren Nayer the best so far.
chronic:
Har har, nice one, since when is the internet NOT in an argument? Apart from Pony threads that is.
Also, Schlick same as Blinn? I don't mean to counter argue your point, I don't know anything about shaders in their equation form UNLESS people like Vailias are kind enough to break it down in form where dummies like me can understand it but Schlick so far gave me the MOST different results when compared to other Lighting modes. You'll see in the picture what I mean in jiffy or two.
JacqueChoi:
Hmm, that's a new way to look at it, "Spec Reflect, Gloss Absorb". Nice little tune to keep the idea in my head, kinda like for Rigging when you say "Who's your daddy" for the heirachy of bones. Thanks mate!
equil:
Are you talking about my Schlick in the images or the equation Vailias posted?
Also, I know this wasn't referenced to me, but how does Diffuse Roughness work for Oren-Nayar? I only found this link here that explained to me in a dummies way on how it works:
http://download.autodesk.com/us/3dsmax/2012help/index.html?url=files/GUID-EB812FAD-58F4-42F1-AADD-95A1AB76BD2-2038.htm,topicNumber=d28e396411
I mean if I was to break down the formula a la Vailia style, what would it work like and/or look like? I'm having a hard time understanding the exact nature on how the 'detail' acts to the surface to the normal, since it's also somehow creates an extreme falloff if I just plug in a constant.
And yes, Mr. Equil, I just enabled SRGB for my Diffuse, and it darkened it. I don't know if it was the intended outcome mind you, but it looked...interesting...also, am I correct to assume from the articles and this thread here:
http://www.lumonix.biz/yabb/YaBB.pl?num=1268387328
That enabling SRGB for anything else will be a bad idea? Like for example, my RGB map which I'm using to control variables such as my Gloss or my Normal Detail Maps, SRGB is a big no no right?
Oh, by they, the image now is with SRGB ONLY on the Diffuse channel, so any comment in that are most welcome my good Sir.
PS: Why did you call me Mr.? Honestly, I expected you to call me Anderson next (just kidding).
OK, hammertime!
I used the same variables in all the images this time, and the one that enabled extra options were set to default 1.
I boosted certain parts of my model to get a better read on the model and contrasted the lights even more.
I think I'll make two Techniques under the shader tree. One is standard Lambertain Blinn and the other...no idea, but I also want to create a hair shader with Ward Anti just incase I need to call that one and have it use my current network node.
By the way, I took a look at the Shader that is generated from ShaderFX, but it looks real messy, so I don't know how much that can help in people helping me in return. Is there any specific shader formula I need to export such as DSAS, 3DS Max or CgGFX so that you guys can read it?
Also, is there a proper etiquette on what I should name what in both the nodes and UI names to helper the users better understand the shader?
Oh, also, fun fact, this is going to be one of my works I'll need to present in about 10-9 weeks for my portfolio, and one of my challenges was creating an about average-crappy model on which I could create shaders and see what I can get using different techniques (since I'm not good with technical stuff, my challenge was employing different techniques such as control RGB maps, Fresnel sub effect and partial UV animations, essentially translating and getting as much out of my maps as possible, even using the Alphas and RGB channel from ALL maps if possible), but also, can be used a reference shader which I can chop up later and specialize to save time.
So yeah, any more input is valuable for me...
This is correct. My mistake. I always seem to have the idea of a Blinn diffuse stuck in my head even though its Lambert's model.
@Ace-Angel: Schlick's model is related to Blinn's via a simplification of Ward's if I remember right.
And yes you'll get different results for the same values on any of these models. How each named variable is used is different in each model. The point is they all shine, and if you really want to see just how they change you may want to go with a simpler test model, like a sphere, or a teapot, or a torus.
This is all part of why I asked what you 're actually shooting for as an end product, because otherwise you're just mixing a lot of math around with other peoples names on it. If the end point of the exercise is to say "look Ma, I built an oren-nayar shader with some other shiny bits!" then more power to you. Lord knows my first shader was just to have something that would display my stuff in real time so I could quit exporting to see it. I even got the normal mapping wrong because of an error in my understanding of how I was implementing it, but it worked, and it was enough for the time.
The oren-nayar model is a bit more realistic in its implementation as it takes into account the idea of the surface of the object being composed of many tiny facets (like most things in life).
Roughness in the oren-nayar model, if I recall right, is effectivelty how quickly the object's color drops off in regards to the ilumination angle. High roughness makes for more evenly colored objects, as if you were using a lambertian model, low roughness makes for more color near the illumination point, and a rapid dropoff in brightness away from it.
If you are going to export the shader, I personally prefer CGFX, as I know its syntax best.
Also, since you mentioned doing something like this in UDK later.. is that going to be your final environment? If so you may want to start there anyway.
This isn't a BAD idea, but to get something like that you kinda need to actually understand what you're doing. I know you say you're bad with the technical stuff, but you're right in the thick of it, so ya might as well start to learn. I don't think its that hard to get, with the right presentation.
I guess I should have made this clear in the start, gah, shame on me.
I'm trying to create the most flexible shader possible, so that I can do STRICTLY presentation shots and change as many variables on a whims content, but also, to allow me to quickly prototype looks right off the bat. I know the basics on how to go cartoony with my shaders, even the most realistic shaders can be turned cartoony with the right connections and math operators, so in theory, the challenge for me isn't so much the look as flexibility.
I would for example love to use Ward Anti with Oren Nayer, I'll have a total of 3 Roughness Channels to play in, and considering my background is more hipster artist then tanking mathematician, having more is better (yeah yeah, don't ask) but Ward Anti is a totally different ballpark and it used for hair or other such materials, so I wouldn't have any use for it unless I build a shader around it. So don' worry, I'm not crazy enough to cram EVERYTHING, I know when to call quits for certain functions.
To give a more concrete idea of what I mean, imagine the IBLGeneric Shader changed by CrazyButcher or Xiouli's Shader, even 3PointShader by 3Point if you will, I want to create a 'uber' shader for lack of better terms, on steroids from those guys. Reason for this as the same one as yours, I'm tired having to keep on exporting stuff just to see what I have done, and I abhor rendering.
Also, because I believe (this is my personal opinion, please don't kill me) RT shader will eventually become the norm, I would like to at least build up my knowledge in this area when the time comes and I also hate having to render, I already mastered Mental Ray and the basics behind it (in Max) but I just hate twiddling my thumbs and not learning anything from the idea behind it. Hell, even my teacher gets contracted for Arch and Design to create materials in UDK for rendering, not everyone (especially me) has time to twiddle thumbs.
Also, mind telling me what Normal Problem you had?
Hmm, interesting, considering I can either chap in an Alpha Map or Constant, this could prove the most interesting for me. Much appreciated for the info.
I'll play around with it more tomorrow (didn't sleep for 2 days learning shaders...yes, I'm as nerdy as that...).
OK got it, will do after organization.
Actually, I just want to create shader in Max first so I get more fruitful understanding of how it works and my final render scene needs to be in Max, I can personally create a UDK version later, for personal stuff, so whichever one I learn, its gold.
For example, in shaderFX there is already a node created for Fresnel, a packed group of functions ready for me, and I can unpack them to see how it works if I wish (which I do, I unpack all the functions to see what they do and how they work).
But also, at the same time, there are more real limitations when compared to UDK, for example, no Pan function, so I have to create that manually, and by doing so, I need to find ways to bypass the limit of say having my Pan function work alongside my Rotate function.
UDK is much easier in MANY ways, even the Boolean system in UDK is simpler, but I learn more form ShaderFX since certain parts can get abit technical to create.
Oh, I didn't mean to sound like I'll simply copy the shader and use it. Also, I'm not scared of the technical part as long as I'm able to get feedback visually. Don't worry, I hit up documentation often.
What I meant is I can take a chunk out of my Diffuse Setup and go wild knowing full well it worked beforehand and how it worked, and optimize it only in required parts what I need with the nodes.
After that is done, I can setup another material REFERENCING the chop one and build a foundation material for optimization reasons. You can't believe how many ways I found to create Toon shaders from this method alone...I think about 9 different ways today.
Thanks for the feedback, much appreciated.
Blimey this post is getting bloated, I need to start another thread snooish.