• Add Review
  • Subscribe
  • Nominate
  • Submit Media
  • RSS
I fixed little problems with my normal map shader.
  • WolfCoder
  • Added: 10/05/2010 03:30 PM
  • Last updated: 04/28/2024 07:17 AM
  • 4209 views

Posts

Pages: 1
As you can see, the normal maps actually contain normals! The maps from before had vectors greater than 1 making the whole thing look harsh. Plus I fixed the ambient color a bit too. Dynamic lights work, but they're not so great compared to the scene lights.
A normal is a vector of length 1. Transforming a vector into a unit vector (length 1) is also known as normalizing a vector. In the context of normal mapping, normals stick out directly from a surface to define the angle of that surface.

When 3D was newer, you could see how surfaces were lit. All normal mapping is these days is having a surface for every pixel on the texture versus just lighting the whole side as one angle. You see normal mapping combined with other things in many modern games.

Normal maps look all weird and blue because the blue channel is the z coordinate and is never less than 128 since 128 is zero. 255 would then be 1 and 0 would be -1. red is x and green is y.



The color in the center is facing you. The color on top is tilted up, bottom tilted down, right tilted right, and so on. The further from the center, the more tilted it is.



So you can see here how I define the surface shape so when this pixel art receives light, it makes the depressions look like actual depressions adding the apparence of depth without just adding much more geometry to the scene.
So a normal is basically what we call a tile in RM?
No. Not even close. There are no analogous things to tiles in a 3D environment since everything is geometric. Even the textures have to be drawn with this assumption and are different from drawing tiles.

http://en.wikipedia.org/wiki/Surface_normal

Each pixel in that blue map is a normal that matches a pixel in the texture. Combined, you get this nice lighting effect that adds lots of depth without actually adding depth.

http://en.wikipedia.org/wiki/File:Normal_map_example.png

Notice how the 500 triangle normal mapped version looks very similar to the real four million triangles version.
I saw the previous images and I think I get it now. A little. Normal maps are maps on top of another map which help define the lighting, right?

Saw the wiki already, but I didn't get it before.

Actually, one of those images in the wiki was pretty helpful--the one with the normal on top of the curved surface. I'm curious as to how you pulled off this "light defining" with every single pixel...
Yeah. They define the angle of the surface per pixel instead of just the whole surface like older games. I set the edges of the bricks in this screenshot so they pop out.
Okay, research has once again prevailed! I totally understand it now, a normal is a definition of the angle of a pixel as it pertains to light hitting it. What I want to know now is how you created and applied this normal map, and where (the texture or the 3D surface itself?) I'm doing 3D graphics right now, that's why I'm so curious. For homework I have to make a UV map onto my object, which is intensely boring work. The prof mentioned something about UV maps helping to normalize a texture, which made no sense to me at the time.

Help?
Funny, I just got done completing a software 3D renderer for homework. Boring stuff actually. Anyway, normalizing is a general term. He's talking about texture coordinates where U and V are floating points between 0 and 1. 0,0 would be the top left, and 1,1, would be the top right.

What I'm doing is different from your assignment. I used a shader to combine the two textures. If you want to see the code, it's all LGPL.

Don't forget to interpolate your w's correctly (from homogeneous coordinates) to get perspective correct textures.
Pages: 1