I tried to use just one function for the light calculation:
void generalLight(in int i, in vec3 normal, in vec3 eye, in vec3 ecPosition3)
{
float nDotVP; // normal . light direction...
Type: Posts; User: Pody
I tried to use just one function for the light calculation:
void generalLight(in int i, in vec3 normal, in vec3 eye, in vec3 ecPosition3)
{
float nDotVP; // normal . light direction...
Thanks,
I made it work with the suggestion by Humus to use an array of booleans to store the lights status.
I don't understand why, though.
I also would like to understand what help could bring...
Hi, I'm trying to do a shader to replicate the OpenGL fixed functionality as a starting point to add new effects, but the compiler gives an error during linking about too many instructions.
I have a...
My matrix may contain scaling factors... that is why I whant to know if there's a way to preprocess the matrix so that the normals don't have to be re-normalized after the transformation
According to all the sources I searched on the internet and on books, when transforming an object with a matrix, to correctly transform the normals you have to multiply them by the matrix t(inv(M)),...
Thanks a lot!
Using glPolygonOffset() solves the problem :)
Ciao
Hi,
I'm drawing an object twice with alpha blending enabled (on the second draw pass) in order to have a transparent environment mapping on it.
I noticed that with hardware acceleration disabled...
Thanks a lot, that solved my problem!
http://www.opengl.org/discussion_boards/ubb/smile.gif
Bye
I tried to adjust my cameras and now the environment looks fine.
Now there's a new problem: when I switch the scene to orthographic mode, the object (i.e. teapot) is strangely clipped.
The...
Is spherical environment mapping supposed to work well with orthographic projection? With a perspective camera all works fine, but when I change to an orthographic camera, the mapping is all messed...
Hi, is there anybody who knows how to calculate the approximation of harmonic map by solving the sparse linear least square problem to minimize the energy E_harm?
I'm following the article...
I use glShadeModel(GL_SMOOTH),
and i calculate the average normals (in the lines
v[0]+=x;
v[1]+=y;
v[2]+=z;
and
v[0]/=count;
v[1]/=count;
v[2]/=count;
they don't overlap
the line which doesn't make sense was the continuation of
"centroid[j]=(el->vertTab[v[0]+j]+el->vertTab
"
i made a mistake while cut-and-pasting.
Well, I actually delete the old faces.
in...
ehm the line
"centroid[j]=(el->vertTab[v[0]+j]+el->vertTab[v[1]+j]+el->vertTab[v[2]+j])/3.0;"
is also inside the "for" statement.
and
pos[0] holds the index of the vertex mid0
pos[1] of mid1...
I tried flipping the normals, but everything goes black.
Here's how i calculate the centroid and the midpoint of the edges for each triangle
centroid[j]=(el->vertTab[v[0]+j]+el->vertTab
for...
I did some step by step tests, and the normals should be calculated well.
The polygons are also in the same order.
http://www.opengl.org/discussion_boards/ubb/frown.gif
In my program I first render a sphere made of triangles, then I subdivide all the triangles using their centroids, and mid points of the edges.
Then I recalculate the normals and render it.
When I...
In fact, for example, i exported in DXF a face from 3ds Max, and my program renders it very well! http://www.opengl.org/discussion_boards/ubb/smile.gif
Ok, so it's not my fault if some polygons are reversed!
http://www.opengl.org/discussion_boards/ubb/smile.gif
thanks for the explanation!
Bye
Luca
YESSSSSS!!!!
THANK YOU SO MUCH!!!!!
I'M SOOOO DUMB!!!!
I tried doing a thousand changes except that fourth parameter which i left to 0.0!
I didn't understand well the difference between a spot...
It doesn't work. http://www.opengl.org/discussion_boards/ubb/frown.gif
it seems to me that openGL applies the lighting to the object centered in the origin, and then places it in the real position.
The problem is when i move the object: the light is not moved, but the object is lit as if it was still in the origin.
I tried with some glPushMAtrix and glPopMatrix, but it didn't help ...
mmm, I have the same problem if I move the object and not the light: the illumination doesn't change
In my program i load a DXF model, create a directional light and a camera, and move/rotate/translate/scale each of them.
My problem is that the objects are positioned well, but are lit as if they...