Archived

This topic is now archived and is closed to further replies.

Impostors + Trees

This topic is 5152 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

Hi everyone I''m tryng to setup impostors in my engine, to be able to render more trees at higher speeds.., i understand how everything works, but there''s one little thing that i''m unable to do. I''m rendering the tree i want to billboard into a pbuffer, and from it to a texture that later will be billboarded at distance, but i cannot set up my pbuffer view in a way that looks good in both viewports. For example, my engine is running at 1024x768, and i''m using a 256x256 pbuffer for rendering the trees. Each tree has a diferent size, so most of the times the trees are either too far away, or too near, or even not in the pbuffer viewport. Can someone help me to setup the viewmatrix on the pbuffer ? thanks a lot, Bruno

Share this post


Link to post
Share on other sites
I know it wont help you, but I also had troubles rendering in a texture... Maybe you should render in a 1024x1024 texture and copy from this one to a 256x256 texture. This could even provides you LOD.
One question, why don''t you render the tree object from the editor to an image you then use as the billboard ?

Share this post


Link to post
Share on other sites
Rendering to a 1024x1024 texture won''t work , and it doensn''t work to get the tree from the editor, i also tought in pre-rendering the trees from several angles, then at run-time find the closest angle between the camera and the tree, and altough this works somehow ok, as VanKurt says, the lighting messes up everything....
Vankurt any clues ? Didn''t you made this in your engine a while ago ?


thanks guys,
Bruno

Share this post


Link to post
Share on other sites
Well, I didn''t use a pbuffer... just the common one... and I had the same problem: Getting the trees / camera to the right position/size. I didn''t really solve the problem (just played with the values until it looked OK).

Sorry, but I can''t help much here...

Share this post


Link to post
Share on other sites
You have to calculate a frustum that will perfectly match your tree''s BBox. So get the max y extent of the bbox and calculate a triangle that will have points like:


/
/
+---------+
/| |
/ | |
/ | |
/ | |
+ | |
\ | |
\ | |
\ | |
\| |
+---------+
\
\


do the same for the x dimension then do smth to give it an aspect ration (should be the same as your resolution width/height). check out the opengl info about projection matrices. then create this perspective matrix, load it and loat an indentity one for modelview and render. then position the billboard at the right distance, rotate it towards the camera and you''re done.


google billboarding and impostors and you''ll find more info.

[ My Site ]
All your source are belong to us
/*ilici*/

Share this post


Link to post
Share on other sites