Это видео недоступно.
Сожалеем об этом.
Deconstructing a Normal Map (CGC Weekly #18)
HTML-код
- Опубликовано: 1 авг 2018
- Sign up for CG Cookie for more Blender Training - bit.ly/2P2HgP1
Everyone knows that normal maps are used to create the illusion of depth or surface distortion, but what do people mean by that? In this video, we'll break apart the components of a normal map to investigate how it works from the bottom up.
Learn more about Normal Maps!
Normal vs Displacement Maps, why games use normals:
b3d.cgcookie.c...
Introduction to Normal Maps for Games:
b3d.cgcookie.c...
I've always told students to think of them as 3D glasses for textures. The stronger the red or green additive, the more depth they give. :)
That’s a really intuative way of thinking about it!
It's really awesome that you explain these technical aspects of blender and 3D-modeling in general.
A lot of artists don't put a lot of time into learning these things. They just learn "how to do it" and stick with it. However, when a problem comes up they are quickly at a loss, because they don't fundamentally understand what they had been doing all this time.
So... this is awesome. More of this, good Sir!
I am in this comment and I don't like it.
Bro, you are really changing the perspective of beginner/intermediate artists with your videos . I know a little about normals, but you have taken it to next level by explaining such difficult concepts with such elegance.
So well explained, visual support, great editing, you're doing the CGI community a great service easily introducing us to concepts like that
@@Qotroz Could you suggest any other video that has better explanation for normal maps? I'd like to know more.
@@RiasatSalminSami Did you visit the link that I send you?
@@Qotroz What link?
@@RiasatSalminSami I send you a link to another video explaining normal mapping.
@@Qotroz i cant see any link.
Difference between normal and bump maps, in a nutshell: Normal maps store the normal of each texel in its RGB values. Bump maps derive the normal of each texel from the difference between its value and those of the surrounding texels.
TLDR:
RGB pixel values are mapped to XYZ components of a normal vector as:
R (0,255) > X (-1,1)
G (0,255) > Y(-1,1)
B (0,255) > Z(-1,1)
THANK YOU!
What *isn't* covered in this video, and it's an important wrinkle, is that the RGB values on a typical normal map are relative to the surface *tangent* space, rather than object space or world space. Which completely changes the color values/which way the vectors are pointing.
@@BaremetalBaron It was pretty self explanatory to me, but the more I think about it, the more I realise someone might get confused by this. I always thought of a normal map in the context of a texture, but I can imagine that a global-camera-view-implementation of a normal map (basically a normal map for the camera view) could be useful for some purposes.
Not sure though how the implementation of a normal map as a texture could be useful as an encoding or global or object space normal direction...
@@bzqp2 object space and world space normal map textures exist, but we typically use tangent space for a reason. World space maps break the second you rotate a model (so are basically useless except for static geometry like terrain), and object space maps I think break when you deform the model, so are useless for animated characters?
In an object space map, rather than being mostly blue, the parts of the object representing the right *side* of the object is red, the top is green, and the front is blue. So there's a roughly even percentage of the map that's each color, as opposed to being 90% blue.
EDIT: Just looked it up, it's not about deformation, but object space maps break down in tons of situations where tangent space normals hold up. You can reuse a tangent-space map for different models, for instance, and you can animate the UVs, etc., whereas an object-space normal map just wouldn't work if you tried that.
Huge part of fully understanding this is understanding this, along with smoothing groups.
Normal maps store normalized vectors, thus in you example it would be impossible for the blue channel to keep the value of one. In your case, if you want to subtract 0.2 to X and considering the remapping from [-1,1] to [0,1] then it means to normalized as such, length(0,0,1) = length(-0.2, 0, Z) => Z = sqrt(1^2 - (-0.2)^2), so Z = 0.9797, thus the "un-remapped" vector is (-0.2, 0 , 0.9797) and the final remapped one is (0.4, 0.5, 0.98985).
This might seem to be nitpicking to you but there's a good reason this is important. When rendering, you can either ignore the Z component of your normal map and reconstruct it yourself (shader code) or you could use the Z directly. In one you spend more instructions doing the calculation but you only need to store the X and Y values (less VRAM) and the other saves some performance but uses more memory. It's a trade-off and usually engines ignore the Z component.
The final remapping should actually be (0.4, 0.5, 0.98985)
Edited the original post, thx Yain for the correction.
No one cares about normalizing those vectors in fact as both the interpolation and mipmapping will denormalize them anyway so you will have to re-normalize them in the shader itself ;) Also how to store a normalized vector in 888 RGB space is beyond my understanding as well (unless it is just a (0,0,1) vector or probably a couple of other ones, I didn't try the number magic here). Of course having your map somewhat close to being normalized helps with the interpolation being more smooth later on, yet it is fully optional.
This was super helpful. Thanks a ton! The best video about normal maps on RUclips 👍
Holy shit! You explained normal map in 10 mim..... And i spent half hour on the documentation and got nothing.. well not nothing but your way is much better
Thank you so much man you cleared all my doubts and now I really understand normal maps
Great explanation, thanks!
Great explanation !
What does the magnitude of the vectors defined by the normal map do? If I'm understanding this right then the magnitude is actually irrelevant and you could probably use it to store an additional map.
So, what is are the three axes of a normal map relative to? Are the red, green and blue channels put on the world X, Y and Z, or the object X, Y and Z?
If I draw a normal map for a circular dome - but then I rotate that normal map by 90 or 180 degrees, will it render differently versus the non-rotated version? How does one reconcile this with a model UV map where all of the components might be oriented in all sorts of different ways in order to fit?
Great ! A Big Thank for this
easier way to show this would be to separate normal map channels in (i.e.) photoshop and show some examples of how light interacts with the surface in the context of tangent space.
YOU ARE AWESOME!
of R, G, and B, which ones determine X, Y, and Z respectively? Relatedly, why does the 'neutral' color of normal maps come out to be that light purplish-blue?
Because he forgot to mention that normal vectors are unit vectors (vector lenght = 1). Thats why 0.5, 0.5, 1 is just a vector pointed straight up perpendicularly to the surface.
And because colors can't be negative (because byte which is representing each part of the color is actually 0...255) the midlle point (0.5) was chosen as zero. Thats why it is purplish but not just blue (as I said 0.5 is actually a zero). So [0.5, 0.5, 1] is the same as [0, 0, 1] and [0.5, 0.5, 0] is the same as [0,0,-1]
BTW colors of the normal maps are corresponded to the engine you're using. For example Unreal using [-1..0..1] space for normal maps. So every texture normal map is natively transformed to this coordinates. Thats why if you want a neutral vector normal represented by a color node you should use [0, 0, 1] in unreal instead of [0.5, 0.5, 1].
9:10 no its not, because then how would you represent -1. -0.2 is represented as 0.4 and -1 is represented as 0
Thanks! That part was not 100% clear to me.
Wonderful explanation
fantastic explanation! it all makes sense
Nice video for a basic introduction, but one crucial point is missing: the vectors you get from a normal map should be normals. The examples given in the video are not normalized.
Well you forgot to mention that normal vectors should be unit vectors. Also in examples you showing the lenght of the vectors should be also one, so [some, random, numbers] are not correct, this vectors should be normalized. Thats why your wathces sometimes frustrating why flat normal is blue, but not gray.
Also you didn't explain the difference between world normals and tangent space normals. Which is also really important in understanding normal maps.
But overall it's ok.
I love watching this because it makes me feel smart, even though I have no fucking clue what he's talking about.
awesome video. Keep up the great work !
So perfectly explained. Thanks a million.
A basic flat normal is facing up (0,0,1). Why a flat normal map purple? Not blue?
Great vid. Thank you!
Thanks for explaining that in such simple terms! TIL
wow , big thanx for sharing
I think the Normal map is stored the XYZ Coordinates, but when presents the uv map, it use color because both are 3 numbers (RGB and XYZ)
Hi, thanks for the explanation. What I'm trying to find out is, wouldn't you just be able to use a bumpmap to determine light directions? Like, if I made a black/white gradient from left to right as a bumpmap, couldn't the renderer then interpret it as "light bounces to the left" because of the surrounding pixels? Then the bumpmap would be able to do the same as a normal map.
what is the difference between 8bit and 16bit normal map?
jeez you're pretty young my friend! thanks for your info
Thanks, a very clear explanation!
I'm assuming that if you take ONLY the Blue Channel of a normal map image and turn it grayscale you could use that grayscale image as a displacement map
is it redundant to use a normal map and bump map, beacuse in some models i see both are being use.
Brilliant thank u
Mr. CG COOKIE,
I have just watched your videos and it was interesting to see the theory and math behind it. Thus, can we classifly as ı do?
1. BUMP MAPS (Shading Normals Alternation - İllusion = BUMP)
a.Normal Maps in Blender - Use Vector Bump [Shading İllusion] (RGB, up down right left) - VECTOR BUMP (SHOULD BE CALLED IN MY OPINION)
b.Bump Maps in Blender - Use regular/scalar Bump [Shading Illusion] (BLACK and White, just up and down (Z ONLY) = SCALAR BUMP (SHOULD BE CALLED FOR ME ALSO)
Question1: Why Normal Maps are not also called a BumpMaps? because they all affect shading normals while one of them affect them vectoraly , the other one affect them scalarly
2. DİSPLACEMENT MAPS (Actual Geometry/ Edge or Vertex Normals Alternation - No Illusion =DİSPLACEMENT))
1. Old Classic Displacement in Blender - Use Normal Displacement (BLACK and White , up down only, (Z ONLY) = SCALAR DİSPLACEMENT (SHOULD BE CALLED?)
2. New Vector Displacement in Blender ( RGB COLORS, up down right left (X,Y,Z) , = VECTOR DİSPLACEMENT
Question2: All maps affect normals even though they are different types of object normals, why only the Normal Bump is called as Normal Map?
Note: I apologize if ı have some wrong information, ı just deduce and reply by these info with my Blender knowlege (1 month) + Math Knowledge + RUclips CGCOOKIE videos on these topics , without additional research
Best Regards,
MCAN
I would like to thank you for this very informative video. I was looking for something else but i've watched the whole video. It's really cool to share this with everybodies because if you want to progress and be able to master everything, you must have strong basis.
In my native language (French), it's not that easy to find good lessons about CGI. I mean you can, but most of the time i feel like there is a huge gap with everything i can found online thanks to CGI community.
During your explanation you keep thing simple, you use lot of visual support (very important because it's easy for people to keep it in mind) and you are very "dynamic" (not sure this is th good word) in the way you explain.
Good work, really i mean it. Sorry about my shitty english ;p
Why you guys love those tangent-space maps so much? Aside of a possible compression by getting rid of the N component, a possible oversampling as you virtually never get every channel sweep through it's full range - and somewhat easier mipmap handling they are so much worse then the model-space ones. With model-space normals you no longer have to worry about matching your TBN vectors between the baking software and the engine (and there is usually some error which will kill your reflections in some areas), no need in extra vertex components as well as extra vertices, no smoothing groups so you can reuse your normal map on every LOD mesh without much trouble. The only place I use TBN normals is when you need any sort of parallax, or if I want to use a normal map as a generic texture (yeah, yeah, I know this also needs some aspect ratio correction in shaders this way - though, surprise, you _always_ need the aspect ratio matching should your geometry be deformable).
Very informative video! Good work!
Do low poly characters need normal maps?
That was great Man..Keep it up.
thank you clearing this op! Great VID!
wait but how does one encode -0.2 as the value of red in the normal map? Like if i was making it using some image editor how do I specify a 'negative' red value?
They're not really colours, they're vectors. Arrows pointing in a certain direction and with a certain magnitude (length). Because 3d has x, y, z vectors, it's convenient to store them as r, g, b colours.
Because your screen can't display negative brightness, Blender displays negative numbers with other colours (adding 1 and halfing). This only serves to display info to the artist and is irrelevant to how is works.
Imagine a sphere, a light source and a camera in a scene. To know how bright to make a pixel you must know where it's pointing. The bits of the sphere facing away are dark. Facing the lightsource from the surface it's light. To calculate this you use the dot product that tests how similar two vectors are. If the light source and normal are pointing in exactly the same direction you get 1 which is how bright you make the pixel. If they are opposite then the dot product is -1, which you clamp to 0 and make black.
If you artificially add normals you can make shading behaviour even though there's no geometry which is computationally cheap.
@@davidmurphy563 Thank you for thr comprehensive explanation! So I'm short negative values of vectors on normal maps are represented by colors of 0 to 0.5 of red green or blue, and positive are from 0.5 to 1?
@@Sh-hg8kf Yeah, you got it.
There's a bit of nuance: blender doesn't store negative z (inwards) normals (but it does on x and y). -z wouldn't contribute to exterior shading so blender doubles the precision on z by going from 0-1 and not -1 to 1. Gpu shaders are only 32 bit so it's a huge gain.
If memory serves, I think it was the game Doom that first opted to do the double precision on z thing.
@@davidmurphy563 I'm confused. Why doesn't - z contribute to shading? Is it because any negative Z value makes the normal pointing inwards.... which is pointless and has no use? (apologies for the pun hehe)
@@Sh-hg8kf Haha. Yup, exactly right.
A lot of engines have the default setting to cull (not render) the back of a mesh and an option of projecting the normal on both sides but tbh I'm not exactly certain how blender handles back faces. Even my interest doesn't extend to reading through the source code. ;)
Great explanation. Now i understood, angle is coded in the RGB? Thx, I´m going to test riht now.
amazing information, thanks!
What situations would it be useful to change the blue channel of a normal map?
I'm curious about this as well. For example, some normals have the blue channel blacked out entirely, leaving the normal with a yellow/red shift. What purpose does this serve?
1:22 woah, slow down egghead!
Confident content bro. Thanks
Thank you very much!!! Great Video
Is there any case when the y channel wouldn't be 1 or 0 all over the map?
So could I use the y channel to store other data when using a custom shader that replaces it with a default value.
I am using unity and try to compress my maps as much as possible.
Great vid dude.
super tutorail thanks
Nice video man! I subscribed! Although I found it enlightening... yet so much complex for my brain...
thank you very much for your great Explanation! :)
Thank you very much
When normals were described as "3d illusions", nothing was making sense like why am I using color to calculate a "normal". Now normals make sense.
i've read some, i've watched some, but this actually "shaded some light" on the matter..
How can i arrive here from a donut?
One thing bugging me... does blender flip the Y and Z axis? Shouldn't Y be up/down and Z be in/out? Maya and every other package i've seen uses Y as up and down, just like in a regular X/Y axis (think 7th grade algebra)
Edit: just read that in later math and physics, z is vertical. Why can't there be just 1 convention?
There you studied on 2d plane without z axix but blender contain z axis
@@mirmohammad753 yes, but x and y are still horizontal and vertical.
Edit: just looked it up, and some applications flip z and y. I use maya, and I guess blender is flipped
@@markiemarkchannel no buddy you did it on plane where x and y happen but in 3 dimension z come out of middle of point 0
@@mirmohammad753 as I stated above, I use maya, and maya uses the conventional 3D axis nomenclature, where y is vertical and z is the rotational axis (in/out).
Some applications, like blender, flip Y and Z.
@@markiemarkchannel blender is correct
I know math
Thanks brother for uploading u knowledge to us great am i new in blender ad learn basic can u tell us how to make some project like 1857 gun model as 3d in blender totally in blender
awesome video, but can you explain, why computing all these numbers in each individual point is easier, than computing geometry itself?
soundsbeard, When you add new geometry you're giving more work to the ray tracer. Every face that's created with geometry affects things like occlusion and the shape of an object. This means that the shape of an object from any direction is determined by its geometry. Now, since normal maps are applied to existing geometry it does not affect any of these calculations. Therefore you cannot change the shape of an object with a normal map. So, you can only change the surface lighting.
Well, to be short, it's a quirk of how rendering works. This just happens to be more efficient.
This is the same reason we use texture maps instead of really small geometry with colour in the geometry itself. - Because of how the rendering process works, adding the texture is just a lot cheaper (aka takes less work for a computer to calculate) than trying to process more geometry.
Normal maps have the additional benefit that you basically already have to calculate surface normals per pixel anyway, because that's how stuff like phong shading works.
Being able to have light that isn't uniform across an entire polygon means having to interpolate the light somehow. - The easiest is linear interpolation of the lighting for each vertex, but this looks really weird, so we quickly moved to a more advanced technique.
But, the downside of this more advanced lighting is you had to calculate lighting per pixel. - which meant having a surface normal per pixel. (even if originally that surface normal was just copied from the polygon, or interpolated across the surface of the polygon).
Once you get to lighting that requires a calculation involving a surface normal for every single pixel in a polygon, it's a very small step to saying, well, why not use a texture to load a unique surface normal for each pixel?
And that's basically normal mapping.
It exists because it was a cheap addition to lighting models that were doing 90% of the work needed to implement normal maps anyway.
Compared to making a lot of surface geometry which requires far more calculations in practice.
(Tough a think to take note of is that some implementations of normal mapping are effectively using it alongside hardware tessellation to create actual geometry anyway. - in this case the benefit is that the normal map takes up less memory than specifying the actual geometry manually, and also saves a lot of coordinate transformation calculations that would have to be done on such geometry.)
Thanks!!!! I love this video!!!
Cool
Now I understand why normal maps are mostly shades of blue.
I've been wondering about that for a while.
It makes sense that the vast majority of a surface would be shaded in the same direction (or at least close to) as the surface itself.
Would that mean that a 100% blue normal map would have no effect on the lighting at all, or would it have to be 50%?
It's not actually blue, because tangent normal maps are remapped from (-1,1) to the (0,1) (0,255) range in the RGB channels. This means that a zero influence normal is set to a common purple with the color (0.5, 0.5, 1) (128, 128, 255). In fact, when you bake a normal map and the raytracer doesn't find any geometry, it uses this normalized color as the background, meaning that there isn't any change at all in the direction of the surface normal. So, of course a 100% normal map with this color will have no effect on the lighting.
In cycles though, you can see 2 types of color associated to normals. When you read a normal map from an image, you typically have a range from 0 to 1, which leads to a more purple color. But when you use the normal map node, the vector result is converted to the range -1 to 1, which leads to a more deeply blueish color. In this last case, the zero influence color is (0, 0, 1)
ah! Thank you for the explanation.
Cool. Who or what company invented normal mapping?
great! thanks this helps with my take home exam :D
took me 20seconds to notice that R and G dont have the same color.
awesome
「あなたの動画はとても良いですし、メッセージがた
Thank you ! :) ;)
how old r u?
Love this
Isn't your xyz axes incorrect?
Coordinate axis can be defined in anyway; he just defined X to be right, Z up and Y forward. It doesn't matter at all.
@@santiagosanchez606 Actually it matters. When he does it dimentions shall be called (XZY) so your normal will not be negative of intended vector.
@@o.429 aka flipped normals, right?
09:42, you should normalize your normals. ;)
You're not wrong!
Why the bloody hell didn't I subscribe to this channel.
comprises
Noice
There are 255 shades of grey.
256* Why? Because 2^8 = 256
@Solid Snake yes, but 0 is black, and since we are talking about how many shades of gray there are, we count from 1 instead.
@Solid Snake I'm not saying computers count from 1, I'm saying humans count from 1. For example: If someone asks you how much of something there is, you start counting from 1 :)
@@aldobernaltvbernal8745 So 254, 00 is black and ff is white.
@@guibnv where did you get that 254 is 00?
254 is FE
How to accumulate wealth.
damn
on a WHITEboard with a Color Marker ? software TOOLS or wow-Beamer Supported ?(
Pretty much standard contemporary guff.
Normals? I call them normies.
FFS, stop saying "right?" all the time!!!!
That's very cumbersome explanation, awful figure drawings. And plus partly wrong. Really bad lesson.
Cool