I tried to turn all the quad of a font oriented front to the camera
but i just found billboard using point sprite
It’s possible to make it with quad ?
it’s little bit to far for me
billboardShader.begin();
myFont.getFontTexture().bind();
txt_mesh.draw();
myFont.getFontTexture().unbind();
billboardShader.begin();
vertex shader
void main() {
gl_TexCoord[0] = gl_MultiTexCoord0;
vec4 eyeCoord = gl_ModelViewMatrix * gl_Vertex;
gl_Position = gl_ProjectionMatrix * eyeCoord;
float dist = sqrt(eyeCoord.xeyeCoord.x + eyeCoord.y eyeCoord.y + eyeCoord.z*eyeCoord.z);
float att = 600.0 / dist;
gl_PointSize = gl_Normal.x * att;
gl_FrontColor = gl_Color;
}
Jordi
May 6, 2014, 9:14pm
#2
did you see this?
I don’t know if this is the ideal way to do this, but I recently had to do billboarding (always facing the camera) of objects inside an ofCamera rotation and found that ofNode::lookAt is pretty helpful here if you want to figure out how to rotate things to always face the camera – thought it might be helpful to post this gist up
some billboarded 3d objects, rotated slightly so you can see they are cubes. (if you comment out the ofRotate(30, 1,1,0); line, they look like squares since they a…
It is processing on the cpu but it might work for you.
Yes i manage to make each quad look front of the camera thanks to this method
i also use a other method lighter using ofTranslate and of ofRotate
ofPushMatrix();
float angle = atan2(boids[i]->position.z,boids[i]->position.x);
angle = 90 - ofRadToDeg(angle);
ofRotate(angle, 0, 1, 0);
ofTranslate(0,boids[i]->position.y,sqrt(pow(boids[i]->position.x,2)+pow(boids[i]->position.z,2)));
ofRotate(180,0,1,0);
But i have to render around 10000 typoFace on a 4000 pix width screen
and the translate rotate method is not efficient
that why i look for a vertex shader method which oriente each quad to front of camera
Jordi
May 6, 2014, 10:16pm
#4
sorry i can’t help then… I’m not quite fluent in shaders… it would take me some time to get it. But please post the result. I would love to see it!
You might find these tutorials helpful in constructing a billboard shader: