Jump to content

  • Log In with Google      Sign In   
  • Create Account

Mchart

Member Since 25 Jun 2014
Offline Last Active Oct 16 2014 01:59 PM

Posts I've Made

In Topic: Best learning resource for an OpenGL programmer

25 September 2014 - 09:38 AM

 


I want to learn DX now.

I don't bother buying a book or reading several tuts, but what I'd like is:

1- When I was learning OpenGL many books and tutorials were strongly relying on underlying framework. If possible I would like something that does not "hide" anything.

2- I know that documentation is often a good place where to start, but I tend to enjoy more a guided walk through.

Are the resources provided with the SDK enough to cover my necessities?

 

By  "DX," do you mean Direct2D? Direct3D 11? DirectX 9 or 10?

 

It's not clear what you mean by "framework." The Direct3D 11 API, for instance, relies on several "underlying" frameworks or layers - DXGI, hardware drivers, etc., none of which a starting D3D programmer needs to be intimately familiar with.

 

As it appears you don't want to buy a book or work through tutorials, with regard to a "guided walkthrough" (somehow different than a tutorial? - not clear), the SDK that, for instance, comes with Visual Studio has excellent documentation, but won't provide you with a "walkthrough."

 

However, googling for "guided walkthrough direct3d 11" yields ~6 million hits. Perhaps one of those will provide you a start. Some of them, for instance, discuss porting OpenGL apps to Direct3D, etc.

 

 

 


I want to learn DX now.

I don't bother buying a book or reading several tuts, but what I'd like is:

1- When I was learning OpenGL many books and tutorials were strongly relying on underlying framework. If possible I would like something that does not "hide" anything.

2- I know that documentation is often a good place where to start, but I tend to enjoy more a guided walk through.

Are the resources provided with the SDK enough to cover my necessities?

 

By  "DX," do you mean Direct2D? Direct3D 11? DirectX 9 or 10?

 

It's not clear what you mean by "framework." The Direct3D 11 API, for instance, relies on several "underlying" frameworks or layers - DXGI, hardware drivers, etc., none of which a starting D3D programmer needs to be intimately familiar with.

 

As it appears you don't want to buy a book or work through tutorials, with regard to a "guided walkthrough" (somehow different than a tutorial? - not clear), the SDK that, for instance, comes with Visual Studio has excellent documentation, but won't provide you with a "walkthrough."

 

However, googling for "guided walkthrough direct3d 11" yields ~6 million hits. Perhaps one of those will provide you a start. Some of them, for instance, discuss porting OpenGL apps to Direct3D, etc.

 

 

 

Sorry I clearly explained myself pretty poorly. My English is failing me. 

I mean D3D11, by framework I mean API wrappers for example. 

 

I want to look at tutorials and books, actually I don't care if I have to read many of them I am open to anything! :) 

 

I'd like a tutorial like for example this one I used for opengl: http://www.opengl-tutorial.org/  that goes from zero to something a tad more advanced. 

 

 

Sorry again if I didn't explained myself clearly 


In Topic: VSM without filtering the maps and easiest way to filter them

16 August 2014 - 10:43 AM

 

 

Prefiltering is just an optimization. You could use NxN sampling kernel with gaussian weights in your shadow shader. Try to also use bilinear filtering, You can also generate mipmaps and use trilinear/anistro filtering.

 

I am doing trilinear (GL_MIN and GL_MAG with GL_LINEAR and I generate mipmaps) but the result is somehow disappointing. I have no penumbra at all. 

I am using almost exactly the code here: http://fabiensanglard.net/shadowmappingVSM/  and my result is http://imgur.com/nkVtTYI which is rather blocky and no much better than a basic less than test :\

 

I know I can increase the resolution, but still no better than a simple test. PCF gives much more pleasing results

 

 

Have you tried aniso? How about more samples? Have you played with minimum variance constant? How about fast single pass 3x3 blur before creating mipmaps?

 

 

 

Thank you for your reply.

Yes I've tried aniso and the result is still the above. Regarding the min. variance constant what it change is just what change with the classic epsilon bias (i.e. acne and peter panning) and change the "blackness" of the shadow which however remains uniform. nothing about the penumbra. 

As for the 3x3 pass before the mip maps I wanted to avoid to write another shader for it, also for my application I may have to re-render the shadow maps at each frame so if I have to perform a filtering everytime, what's the advantage over a simple PCF? 

Note that my subject is one and all I'm dealing with is the correct selfshadowing as the in the picture above, don't know if this changes anything. 


In Topic: VSM without filtering the maps and easiest way to filter them

16 August 2014 - 04:29 AM

Prefiltering is just an optimization. You could use NxN sampling kernel with gaussian weights in your shadow shader. Try to also use bilinear filtering, You can also generate mipmaps and use trilinear/anistro filtering.

 

I am doing trilinear (GL_MIN and GL_MAG with GL_LINEAR and I generate mipmaps) but the result is somehow disappointing. I have no penumbra at all. 

I am using almost exactly the code here: http://fabiensanglard.net/shadowmappingVSM/  and my result is http://imgur.com/nkVtTYI which is rather blocky and no much better than a basic less than test :\

 

I know I can increase the resolution, but still no better than a simple test. PCF gives much more pleasing results


In Topic: Problem with FOV that fits a volume

07 July 2014 - 04:43 AM

Depending on the way you calulate you perspective matrix fov/2 is the right value.

As for the distortion:

If the camera allways faces the center of the sphere buf the distance gets very small:

lim_(d->0) (FOV) = lim_(d->0) (2 * atan(r/d)) = PI

 

(or respectivly PI/2 when you re using fov/2) even PI/2 is a pretty large fov and a distortion is to be expected (youll find that an fov of PI/4 looks "normal").

 

On the contrary for d->inf : fov->0

 

Howerver I don't quite got the idea of what you are tying to achieve by this.

 

 

First of all thanks for the reply! I'm using glm::perspective to build the matrix which I believe wants the full angle.

I want to make sure that a certain object is always in the frustum, even if the distance between camera/bounding sphere is very small.

 

(Also I found that for the way I compute the distance it should be asin(r/d), but still same distortion)


In Topic: Linear Depth Buffer

25 June 2014 - 04:37 PM

Typically you'll read the value from your non-linear depth buffer and reconstruct the view-space z position at that point.

// let s and t be two values that satisfy the following two equations:

(s*f + t)/f = 1    // f is the distance from the eye to far plane
(s*n + t)/n = -1   // n is the distance from the eye to near plane

// the above is simply the mapping the occurs when you do a projection transform
// s and t are found in your projection matrix at positions 3,3 and 3,4, respectively

// let d be the value in your depth buffer

// the (xxx + 1) * 0.5 is to map the [-1,1] clip-space coordinates to the [0,1] space in the depth buffer
d = ((s*z + t)/z + 1) * 0.5  
2d = (s*z + t)/z + 1
2d - 1 = (s*z + t)/z
2d*z - z = s*z + t
2d*z - z - s*z = t
z*(2d - 1 - s) = t
z = t / (2d - 1 - s)   // reconstructed z value

That math is just off the top of my head and might not be totally correct, but you should be able to get the picture from that. You basically just want to use your knowledge of the projection matrix you used when transforming the verts to do the inverse of that transformation and reconstruct the view-space z.

 

Thank you Samith, just one question. In which space t and s are distances eye-near/eye-far? If I look in my projection matrix (built via glm::perspective) at position 3,3 and 3,4 what I see is something like -1.03 and -1 where my clipping planes are [0.1, 8] 


PARTNERS