Jump to content
  • Advertisement
Sign in to follow this  
RobMaddison

An out-of-frustum experience

This topic is 2604 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 all

I want to have a look at what my viewing frustum looks like from a different angle. I don't mean the usual enclosing lines, I mean the actual finished rendered image.

Easy, I thought, I'll just render my objects as normal having the vertex shader output vertices in my camera's view projection and then at the last minute, apply another view projection matrix (the point that I want to look at my frustum from). What I'm doing is applying the 'outer camera's viewproj matrix to a set of what I'm treating as world coordinates.

I'm using DX9 and just assumed that the values returned from the vertex shader would be in homogenous clip space (-1...1,etc) but they're not, they're in screen space (-960...960, for my 1920 wide resolution). That's ok though, I'll just scale them.

Did it work? No... I expected to see a little frustum shaped 'box' with my models in it all small and skewed by the perspective of my first viewproj matrix. What I did see was something I can't even explain. Almost like someone had taken my scene and pinched it in the middle.

Am I missing something simple?

Share this post


Link to post
Share on other sites
Advertisement
Is the other matrix just rotatin and scaling or does it also do stuff to the w coordinate to get perspective *again* ?
edit: Anyways i think it might have something to do with the w coord.

Share this post


Link to post
Share on other sites
Both matrices are view-projection matrices - should I exclude the w-component of the vertices after they've been transformed by the normal eye VP matrix before multiplying them by the second VP matrix? Seems to make sense

Share this post


Link to post
Share on other sites
I've just been playing with manipulating vertices in the vertex shader. Could anyone please explain what the postVS xyz coordinates are when viewing draw calls in pixwin? I see pre-vertex shader, post-vertex shader and viewport. The post-vertex shader mesh view shows the mesh differently to the viewport - the viewport shows it in the position it'll be in on the screen - can you manipulate these values?

Thanks

Share this post


Link to post
Share on other sites
I figured this one out, the xy vals are divided by the w conponent during rasteriserisation so dividing by it in the shader gave me the vals in homogenous clip space, then I just multiplied up by half screen size

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.

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!