Jump to content
  • Advertisement
Sign in to follow this  
aravind

High Quality (Poster Quality) Screenshots.. hi i did coding for HD screenshots in Perspective view but how to do it in orthogonal view.?

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

I need to take High Definition Screen shots in my directx(C#) application. and i found out the solution in Game Programming gems2 book, and i implemented it in my application and it is working fine, but the problem is they gave the algorithm for Perspective view , now i need to take same HD screen shots in Orthogonal View...

 

 

The idea behind tis is we are splitting the screen into 9 quadrants and set the projection matrix then take screen shots and we get 9 pictures then we are stitching it to one picture, and the below alogorithm values works well for perspective view but it doesnt work for orthogonal view, i need to know the left,right,top,botom values for orthogonal view..!!

 

 

void GpgPerspective (double fovy, double aspect, double Near, double
Far, int subrect)
{
double fov2, left, right, bottom, top;
fov2 = GpgDegToRad(fovy) * 0.5;
top = Near/(cos(fov2)/sin(fov2));
bottom = -top;
right = top*aspect;
left = -right;
if (subrect == -1) //Regular full screen
GpgFrustum (left, right, bottom, top, Near, Far);
else if (subrect == 0) //UL
GpgFrustum(left, left/3.0, top/3.0, top, Near, Far);
else if (subrect == 1) //UC
GpgFrustum(left/3.0, right/3.0, top/3.0, top, Near, Far);
else if (subrect == 2) //UR
GpgFrustum(right/3.0, right, top/3.0, top, Near, Far);
else if (subrect == 3) //ML
GpgFrustum(left, left/3.0, bottom/3.0, top/3.0, Near, Far);
else if (subrect == 4) //MC
GpgFrustum(left/3.0, right/3.0, bottom/3.0, top/3.0, Near, Far);
else if (subrect == 5) //MR
GpgFrustum(right/3.0, right, bottom/3.0, top/3.0, Near, Far);
else if (subrect == 6) //BL
GpgFrustum(left, left/3.0, bottom, bottom/3.0, Near, Far);
else if (subrect == 7) //BC
GpgFrustum(left/3.0, right/3.0, bottom, bottom/3.0, Near, Far);
else if (subrect == 8) //BR
GpgFrustum(right/3.0, right, bottom, bottom/3.0, Near, Far);
}
 
 
 
void GpgFrustum (double left, double right, double bottom, double
top, double zNear, double zFar)
{
float matrix[16] = { 1.0f, O.Of, O.Of, O.Of,
0.Of, 1.Of, 0.Of, 0. Of,
O.Of, O.Of, 1.0f, O.Of,
0. Of, 0. Of, 0. Of, 1 . Of } ;
matrix[0] = (float) (2. 0*zNear/ (right-left j) ;
matrix[5] = (float) (2. 0*zNear/ (top-bottom) );
matrix[8] = (float) ((right+left)/(right-left)) ;
matrix[9] = (float) ((top+bottom) /(top-bottom) );
matrix[10] = (float) (-(zFar)/(zFar-zNear)) ;
matrix[11] = (float) (-1 .0) ;
matrix[14] = (float32) (-(zFar*zNear)/(zFar-zNear)) ;
#endif
//Now set this matrix as the current projection matrix
}
Edited by aravind

Share this post


Link to post
Share on other sites
Advertisement

You could try rendering to texture - any modern card will support 16384x16384 for stupidly high quality output in a single pass. Note that a 16384x16384 RGBA texture requires 1GB of video memory.

Edited by mark ds

Share this post


Link to post
Share on other sites

Yes you are probably correct, modern cards will support very large render textures.

 

However I have to use this same technique myself on some platforms.

 

The OP should have an equivalent to glOrtho in his code base, from his post I'll take a guess at GpgOrtho.

 

Use that instead of the perspective matrix and he should be okay

Share this post


Link to post
Share on other sites

You could try rendering to texture - any modern card will support 16384x16384 for stupidly high quality output in a single pass. Note that a 16384x16384 RGBA texture requires 1GB of video memory.

This can, by the way, even be done even with considerably smaller render targets, and at virtually any resolution (not limited to anything in particular, except the space on your harddisk) if you don't mind doing the final composition by hand.

 

Instead of one @163842 render, you can do 16 @40962 renders of the same scene, with a sub-pixel jitter (i.e. you are effectively supersampling the scene). Or you could do 256 renders @40962 which gives you the information necessary to create a 655362 image. Of course that would be a 16 GiB image, so doing the final composition is a bit of a challenge, you'd either have to do it in smaller tiles, or on the CPU  (maybe even out of core, if your machine doesn't have that much RAM).

 

Doing several identically-sized shots and compositing them may have benefits in terms of mipmaps and differentials, too. If you render something at a different resolution, you won't be using the same mipmap levels, and your procedural content that uses dFdx() or the like will not be the same either.

 

Lastly, the supersampling technique allows you to cheat on your posters. You can for example trivially add a high quality motion blur (simply render a very, very slowly animated scene instead of a single static one, and crank up the numbers of screens by another few dozen).

Edited by samoth

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!