Jump to content
• Advertisement

# Rendering brush strokes

This topic is 5474 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

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?

#### Share this post

##### Share on other sites
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...

#### Share this post

##### Share on other sites
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

#### Share this post

##### Share on other sites
Quote:
 Original post by Palidineyou 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]

#### Share this post

##### Share on other sites
Quote:
 Original post by Hellsp4wnAn 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

#### Share this post

##### Share on other sites
Quote:
 Original post by crocomireIs this the idea?:1) gluProject using a perspective projection matrix2) gluUnProject using a orthographics projection matrix3) 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).

#### Share this post

##### Share on other sites

• Advertisement
• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• Advertisement

• ### Popular Now

• 15
• 22
• 17
• 46
• Advertisement
×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!