- Me: hey one doubt? free??
- Vector: sure
- ME: http://wiki.activeworlds.com/index.php?title=Z-buffer_fighting
- Wht can be the resons for this issue??? even if the depths are equal why can't the graphics card decide?
- Vector: z-fighting occurs because the z buffer values are no linear
- Me: if i set two primitvies at same depth...does the depth buffer will be filled at the end or when ever we draw each primitve base (done depth func)?
- Vector: I did not understand the question
- Me: ok…if i'm drawing two quads at depth 50 ... whts the reason for having this issue? is it only because of the placement of nearplane?
- Vector: When you specify z value. YOu are specifying the z value in world space. The "Depth" refers to distance from eye. This value is stored inthe depth buffer only after mult [Proj] * [View] [ Model] * [vertex]
- owing to float point preceision values... there will be a difeerence in z depth even if you specify same z value for each primitive
- Me: ok so based on the size of the depth buffer... we will have more values if the depth buffer size is more .... and at the same time ...if we place Near plane at 0.1 the depth values will be some exact values so that when calculating depths, 'precision' will not effect the calculated depths ... is this right?
- Vector: No.. The value in the z buffer is not the z value at all... it is more similar to 1/z ... this is because when we convert to homogenous coordinates after mult by proj matrix... and dividing by w.
- 1/z has a graph that is non linear
- so z values can be differentiated or distinguished to aa higher 'precision' near at certain ranges of the graph. Putting near plane of 0.001 causes very high precision right near the camera... but precision drops a little farther out... This is undesirable... you want high precision from eye to say the mid of the scene.. as the primitives are farther away...you don't mind having less z precision..
- Im lookking for the graph i found long time ago...it will be clear then
- Me: ok seems i understood :) send me the graph if u find it... tilll now i thought the values specified at the end of the glFrustum call will be taken directly as depth limits :( ...thanks for clarifying...
- Vector: Cool hope this helped... ill try finding the graph ..it will really clear things up
- Me: ok :)
Until now I didn’t find a reason why a vector is normalized to make it a Unit vector.
Basically a vector is a Geometric object which has a Magnitude and a Direction. It doesnt need to have a fixed position.
Ex: I’am moving towards east at 50kmph. Here the velocity vector tells us the direction and magnitude.There is no start point for a vector.It can be any where!
So for a particular any magnitude and unique direction, we can have lots of different placed vectors. ex: (2,2) , (3,3) ,(4,4)… actually all these are having same directions with different magnitudes.
So how to represent them in a unique fashion??? Here comes the use of Unit Vector.
A Unit Vector is a vector which will have 1 unit of magnitude and wil have a direction .From this unit vector we can derive any vector oriented in this direction! From the above example (1/sqrt(2),1/sqrt(2)) is the unit vector .From it we can create (2,2) , (3,3) etc…simply any vector oriented in that direction ;)
DotProduct: Dot product is exactly equal to cos(angleBetweenTheVectors)*|U|*|V| where U,V are two different vectors.
If we plot this dot product at different angles between the vectors we can find the result as a cosine graph! (think the two vectors are of unit length).
So ok! But why we need this unique representation?? what this is for???
Assume you have a ball which is moving with some velocity vector.For now think that we are not calculating the unit vector.Assume the velocity vector is changing on each collision with the walls or with other balls. Now if we want to calculate angle between two balls, we need to calculate its dot product and divide the value with each of its magnitude every time! In the same case if we have Unit vector of velocity and the maginitude is seperated from it, then we can directly have dot product as cosine of the angle between them! Easy right! And this is efficient too!This simply saves lot of calculations.
And more over For lot of operations magnitude is not the main criteria.Usually we will consider mostly the direction.And this can be easily achieved by a unit vector.And with this vector we can create any kind of vector in the SAME direction with different Magnitude.
Thats All for today! Will organize this post better if i find some time! Bye!
Yesterday when discussing with Vivek about filters,We(I & Sid) Came across lot of new stuff :) . Vivek explained us clearly how filters on images will be done. Let me have a brief synopsis on what exactly it is and how it will be done.
Basically we will have a matrix called ‘Kernel’ and it will be applied on each and every pixel of the image on which filter need to be applied. The process of converting an image pixels with a Kernel is called ’Convolution’.
so a simple blur filter to my knowledge can be as simple as this.
1 1 1
1 1 1
1 1 1
This means we are just taking the consideration of surrounding pixels equally.This makes the image look blurry.IF the kernel matrix is in big size obviously we can have smoother effects and will need high processing as well!
Got some more new stuff from him as well….’Sobel filter’,’Sobel operator’ (when explaining about Edge Detection filters)…. Need to find a day where I can work on it as its really interesting!
Today I came across a problem while displaying two separate quad’s with GL_TRIANGLE_STRIP. The problem was, when using strip it will take previous given two indices and attach with the new vertex and make a triangle strip.Actually this is NOT what I wanted.
Suppose there are (1,2,3,4) (5,6,7,8) Quads which can be made by a GL_TRIANGLE_STRIP call. Now if i give this data as a batch,I will have 3,4,’5’ and ‘4’,’5’,6 connected Triangle Strips as well! :O
So to solve this issue, I came to know we need to use “Zero Area Sized Triangle strips” which will be usually ignored/discarded by Graphic cards as they mean they are EMPTY areas which are not necessary to draw. These ”Zero Area Sized Triangle strips” are called “Degenerate Triangles“.These can be created by duplicating the vertex data.
So, 1,2,3,4,4,5,5,6,7,8 vertex data will yield the intended!
Here the Degenerate Triangles are (3,4,4) , (4,4,5) ,(4,5,5) , (5,5,6)
Even though we are duplicating the data a bit …it will be flushed in one single call with Triangle Strips! Nice right (^_^)
For further Reference: