Rendering brush strokes

Started by
4 comments, last by Hellsp4wn 19 years, 7 months ago
Hello, I'm working on a brush stroke renderer. I have a number of particles in world space and I want to render a brush stroke at each particle location. A brush stroke is just a simple rectangular RGBA image. My first idea was to use a billboard for each brushstroke. But this leads to different brush stroke sizes for different depth values (because of perspective projection). I could solve this by scaling each brush stroke to ensure a constant size in screenspace, but I don't know how to derive the correct scaling factors. But maybe this is not the way to do it. My question is: how can I render an image at a certain position in worldspace with an fixed screen-space size?
Advertisement
An idea would be to use the gluProject and gluUnproject functions.
You can then convert a 3d coordinate into screen coordinate, and then render the quad in orthographic view.

Don't ask me how to use them thought, I never remember...
--- Hellsp4wn ---AstralShadow | ScreamTech

VG Cats

you should use the orthographic mode which effectively makes the openGL viewport a 2D area. then you don't have to worry about scaling or any of that stuff.

there's a tutorial on this page about using ortho mode:
http://www.gametutorials.com/Tutorials/OpenGL/OpenGL_Pg2.htm

-me
Quote:Original post by Palidine
you should use the orthographic mode which effectively makes the openGL viewport a 2D area. then you don't have to worry about scaling or any of that stuff.

there's a tutorial on this page about using ortho mode:
http://www.gametutorials.com/Tutorials/OpenGL/OpenGL_Pg2.htm

-me


I'm quite new to OpenGL so I could be mistaken, but I think this doesn't solve my problem because the locations of the brush strokes should be perspective projected. For example: I have two equal sized spheres (in world space). Each sphere is rendered by a number of brush strokes. The two spheres should be perspective projected: the sphere furthest away should be smaller (in screen-space), but the brush strokes that make up the spheres should all be the same size.

[Edited by - crocomire on September 23, 2004 1:23:58 PM]
Quote:Original post by Hellsp4wn
An idea would be to use the gluProject and gluUnproject functions.
You can then convert a 3d coordinate into screen coordinate, and then render the quad in orthographic view.

Don't ask me how to use them thought, I never remember...


Is this the idea?:
1) gluProject using a perspective projection matrix
2) gluUnProject using a orthographics projection matrix
3) render the resulting coordinates using a orthographic projection matrix
Quote:Original post by crocomire
Is this the idea?:
1) gluProject using a perspective projection matrix
2) gluUnProject using a orthographics projection matrix
3) render the resulting coordinates using a orthographic projection matrix


I suppose that could work.
I'd just gluProject the 3d coordinates into screenspace and use those to position the billboard in orthographic mode.
The orthographic matrix would've been the same size as the window (one pixel equals one unit).
--- Hellsp4wn ---AstralShadow | ScreamTech

VG Cats

This topic is closed to new replies.

Advertisement