Posted by Marius Oberholster on Wednesday, January 3, 2018 Under: News
Believe it or not, the Blinn and Phong models are not all that different. The goal with Blinn is to have specularity that is similar to Phong, but without it's sensitivity to proximity. This give many advantages within NPR, because it gives yet another thing you can manipulate - the size of the specularity. Source links will be at the end of this post.
Let's look at their formulas (don't worry, this doesn't get very technical) and the variables.
R = Reflected direction to the light source
N = Normals (like surface of the shape)
L = Light source (location)
V = Viewer (location of the eye or camera)
H = Is a required vector to calculate Blinn (yeah, I don't know what in the world the wikipedia article is saying its function is, hahaha)
Ispecular = Iincoming kspecular max(0,R.V)nshininess
R = 2N(N.L)-L
Ispecular = Iincoming kspecular (H.N)nshininess
H = (L+V)/2
Now when you know what you are looking at in the equations (which you will have a fair idea if you read the articles), you will see that they are extremely similar in approach. It is only what goes in the parenthesis that differs - granted this is a very crucial and integral part of the equation (it really defines how the specularity will respond to the light source).
This difference is what gives us a proximity sensitive equation in Phong. That means that the light source will respond very sensitively to the distance of the light source. The closer it is, the smaller and brighter it will be. The further away it is, the larger and dimmer it will be. Very similar to the energy loss provision we find in the Cycles toon shader (imo). This is fine in some instances (like the Esther 6 demo), where all the characters are a fair distance from the same light source - no major changes will occur, but it becomes a serious sensitivity issue with larger scenes and moving lights, like with the space garage demo.
Blinn, on the other hand, is designed to be a lot like Phong in how it's specularity is calculated, but with the exception of scale sensitivity (ie, energy loss). This means that whether the light source is close or far, you won't experience much of a difference and that is phenomenal for big scenes and also fine for smaller scenes. You could say it's a very good all'round solution for specularity.
- Light sources differ - how does it know what to do?
These equations do not define your light source though. The vector information you give the equation will determine how the specularity will show up in relation to the light source you have. For example, the equation simply asks you for a point in space (X,Y,Z). You need to find a way to tell the equation that you want it to respond this or that way to the vectors you give it and then calculate the specularity based on the chosen model.
Let me explain it practically. A point lamp is a single point in space. Ideal for an equation because it don't get simpler than this. It calculates straight up the information it gets. No need to adjust anything, because the equation's default response is exactly what we need (apart from a single issue, but we'll get to that in a later post).
The sun lamp, on the other hand is a light source that has a single angle and doesn't have an origin. It's like a massive omnipresent (in the scene) light source that shines at a specific angle. This means that you have to now tell the equation to respond to it's light vector and other variables to respond as if L is at the exact same angle to the object at all times and in every location.
Mesh and area lamps are a bit of a mystery to me, because they require a whole different method of being calculated, if their forms are to be taken into account and quite frankly, that is just so far beyond me right now and GOD has not given me the grace to understand how to handle that yet.
In short, we have two models that have to be calculated in 2 different ways, because the light sources work differently and need various setups and rigs in order to function correctly - usually these situations are coded for, but since this is not coded and only nodes were used, I don't know how to automatically tell it:
- the amount of lights
- what kind of lights
- where they are in relation to the object
- how to handle each kind
The only way around this is to custom add the calculations for every light source (diffuse and specularity, since both are affected - NPR means this is just a suggestion, haha). It will work to add custom light sources, but you have to always keep in mind that these are not handled automatically, so every light change you make is a change you need to make on the shader - at least until it gets coded.
In the next post, we'll be looking at how these were built - at least somewhat!
Biggest thanx to GOD for helping me with this. Without HIM, none of this would be possible! :D
Know JESUS yet? GOD is reaching out to you through these videos. HE loves you more than you can imagine and wants you to know HIM. Not because HE's lonely, but because HE loves you and paid a heavy price to enable you to go to Heaven, where HE is. See, we all have sinned in some way shape or form. That makes us guilty before GOD. If you have ever said that you hated someone, in GOD's standard, you have committed murder (James 4). If you've ever looked on a person with lustful thinking, you've already committed fornication with them in your heart and you are then guilty of sexual impurity. If you were to face GOD on judgement day, saying: "I was a good person" will be a void argument, just like it would be before a human judge. GOD knew that we would have to pay that penalty and that we could not pay it, even if we tried, but sent JESUS to pay the price for us. Your sins were put on HIM and the forgiveness that is there for you was by no means cheap - the cross was not padded and comfortable, neither was the death.
But, HE was raised up on the third day (after being crucified) and finished the work so that we may enter through HIM paying the penalty we were supposed to pay, but it is only valid for you, if you accept it and live for HIM.
If that is you today, please, follow this prayer:
"JESUS, I believe that YOU are real and I believe YOU died for me and was raised on the third day for me. Please forgive me for my many sins. I make YOU the LORD of my life, full time and to fill me with YOUR HOLY SPIRIT. Teach me how to live for YOU, help me become what YOU have made me to be, in JESUS' Name! Amen!"
To find out more, you can check out this link:
It gives you access to free Bible translations, free teaching videos and more. Remember, this is a decision with eternal consequence, choose life, choose JESUS. :D
Have a great one!!!
In : News
Tags: god jesus holy spirit blender anime toon shaders specularity diffuse eevee progress development 2.8