Jump to content

  • Log In with Google      Sign In   
  • Create Account


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

  • You cannot reply to this topic
3 replies to this topic

#1 aravind   Members   -  Reputation: 111

Like
0Likes
Like

Posted 16 July 2014 - 03:31 AM

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, 16 July 2014 - 03:34 AM.


Sponsor:

#2 mark ds   Members   -  Reputation: 1074

Like
0Likes
Like

Posted 16 July 2014 - 05:24 AM

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, 16 July 2014 - 05:25 AM.


#3 Stainless   Members   -  Reputation: 677

Like
0Likes
Like

Posted 16 July 2014 - 06:22 AM

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



#4 samoth   Crossbones+   -  Reputation: 4516

Like
0Likes
Like

Posted 16 July 2014 - 08:16 AM

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, 16 July 2014 - 08:17 AM.






PARTNERS