Normal?? :/

Blitz3D Forums/Blitz3D Programming/Normal?? :/

Yue(Posted 2011) [#1]
Hello someone could tell me that is normal is that when translating into Spanish remains the same and do not understand the concept.


ardee(Posted 2011) [#2]
Think you're talking about this, but it's hard to tell, due to your interest in 3D modelling. Hopefully the pictures will give you an idea.

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


Yue(Posted 2011) [#3]
=) Thanks Man.

Last edited 2011


Yue(Posted 2011) [#4]
Hey is that normal is the angle where I point to a polygon in 3D space?


Kryzon(Posted 2011) [#5]
A 'face' or 'polygon' normal is a way of knowing where a polygon is facing in 3D space. What direction it's aiming.
It's a vector, not an angle. The angle to the point in the polygon where the normal was drawn from is always 90 degrees.

Its vector-length never (or at least, shouldn't) surpass 1.0. This also brings the name to the operation of converting a value to a 0.0 ~ 1.0 range: you normalize it.

Under the hood, Blitz3D uses the triangle's normals to calculate lighting, cubemapping etc.
But you can do tons of special effects with normals like cartoon\cel shading, reflections, velvet shading, etc. These using programmable shaders, of course.

Since each polygon only has one normal, the lighting calculation is really simple, you get what is called vertex-lighting - that's why people use a 'normal map' texture to simulate additional normals so the polygon appears to be incredibly detailed; that's why normal maps have that weird color, since each channel is being used to represent a vector displacement in each axis (RGB -> XYZ).
The normals coded in the normal map are used when lighting the polygon (instead of the triangle's own single normal).

Last edited 2011


Yue(Posted 2011) [#6]
Hi, not sure if I understand correctly, or at the point is where the true face?, it is difficult to understand when the google translator does not help matters if not that complicated.



For example, if I understand correctly, the last picture is a box seen from above, one can say that the vectors are pointing the way to where the face looks right??.



greetings and thanks for your explanation.


Yue(Posted 2011) [#7]
Ok, no problem i see here =).

http://msdn.microsoft.com/en-us/library/bb324491(VS.85).aspx


Adam Novagen(Posted 2011) [#8]
Waitaminute toon shading is done using normals?? Explain this, I must know! :O


Kryzon(Posted 2011) [#9]
I might have implied that normals are used in a special way with Toon shading, but they are used the same way when doing regular lighting.
It's the way you consider the normal information - you consider less of it, in effect "quantizing" the light into hard-edge sections instead of a smooth flow like with Gouraud shading (the default render mode for Blitz3D).

The [very pseudo] code goes like this:
lightVector = lightPosition - vertexPosition;

lighting = max(dot(lightVector,vertexNormal), 0); //Calculate incidence of light over this vertex\pixel.

If (lighting < 0.5)
	lighting = 0.5; //Quantize lighting so that any pixel lit below 0.5 is set to 0.5.
Else
	lighting = 1.0; //Quantize lighting so that any pixel lit above 0.5 is set to 1.0.

pixelColor = vertexColor * lighting; //Multiply the vertex color by this quantized lighting factor we handled, and use this as pixel color.

Which would give something like this.
If you took out that If expression then you would get a smooth lighting.

Last edited 2011


Charrua(Posted 2011) [#10]
hi
@kryzon: very clear
i simply say that: dot(vector1, vector2) calculates de angle between them, actually cos(angle between them)

@yue: normal's are used in may situations, other than lighting for example in collisions to know the direction wich a ball should take after collided with a wall. The idea is the same, calculate the angle of incidence: dot(ball vector, normal to the wall).

Juan