Calculating Normals
Sorry the basic question!!!!
How get the normal value in a x,y,z pixel of a polygon?
Leo
How get the normal value in a x,y,z pixel of a polygon?
Leo
ok.. but they don´t answer this:
Supose:
I have a cube with vertices, faces and normals.
Can i retrieve the normal value for any pixel(x,y,z)?... (supose: i want get the normal value for the pixel (not vertice or face) x=21,y=10,z=1, or other pixel)...
There is a command to get the normal value in certain pixel of a polygon?
Supose:
I have a cube with vertices, faces and normals.
Can i retrieve the normal value for any pixel(x,y,z)?... (supose: i want get the normal value for the pixel (not vertice or face) x=21,y=10,z=1, or other pixel)...
There is a command to get the normal value in certain pixel of a polygon?
Is this for a fragment shader?
There was a long silence...
'I claim them all,' said the Savage at last.
What on earth do you need that for?
It sounds to me like you'll want to unproject the pixel location from which you want to retrieve the normal, project that onto the face, and find the normal by interpolating appropriately between the normals of the face's vertices at that point. There's no way built into OpenGL to do it, unless I'm missing something.
It sounds to me like you'll want to unproject the pixel location from which you want to retrieve the normal, project that onto the face, and find the normal by interpolating appropriately between the normals of the face's vertices at that point. There's no way built into OpenGL to do it, unless I'm missing something.
No...
it is for detecting a polygon face (in all pixels) (in a top and ortographic view) when the view frustum in less than a height of a polygon...
like this : http://labsim.estig.ipb.pt/test.jpg
it is for detecting a polygon face (in all pixels) (in a top and ortographic view) when the view frustum in less than a height of a polygon...
like this : http://labsim.estig.ipb.pt/test.jpg
Well for a face, the normal will be the same over the entire thing.
So you can use OpenGL picking to find out which face was clicked and then get the normal you have precalculated for that face.
So you can use OpenGL picking to find out which face was clicked and then get the normal you have precalculated for that face.
Sir, e^iπ + 1 = 0, hence God exists; reply!
ok... is that..
and now the initial basic question:
how can get the normal value in a some pixel of a face? using opengl... (i defined the normal by 3 points(x,y,z) (face)... and now i want retrieve this normal value pixel by pixel... (to know if some pixel belongs to a face or not)....
Thanks again.
and now the initial basic question:
how can get the normal value in a some pixel of a face? using opengl... (i defined the normal by 3 points(x,y,z) (face)... and now i want retrieve this normal value pixel by pixel... (to know if some pixel belongs to a face or not)....
Thanks again.
I dont understand what you mean,
what is the input and expected output you want,
do you want to calculate the normal of the face that is at some pixel?
There is no OpenGL call that gives you a normal from a pixel, but there is one that can give you a face from a pixel.
what is the input and expected output you want,
do you want to calculate the normal of the face that is at some pixel?
There is no OpenGL call that gives you a normal from a pixel, but there is one that can give you a face from a pixel.
Sir, e^iπ + 1 = 0, hence God exists; reply!
If there is one that give me a face from a pixel better... How?
My input: pixel coordinates
The Output: norlmal value or face (if belongs a face)
My input: pixel coordinates
The Output: norlmal value or face (if belongs a face)
There are a few different ways to do it. OpenGL provides a facility known as selection mode, which allows you to determine whether or not a particular primitive or set of primitives is drawn in a particular pixel location. You can read up on it in chapter 13 (if I'm remembering correctly) in the red book. You can do the math yourself as I suggested in my earlier post. They both have their pros and cons; learn about both and choose the one that works best for you.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Calculating tangent coords for arbitrary poly meshes | TomorrowPlusX | 8 | 4,770 |
Jul 9, 2007 03:10 PM Last Post: Hog |
|
| calculating normals | ghettotek | 10 | 5,252 |
Feb 13, 2003 09:40 AM Last Post: lpetrich |
|

