Jump to content
  • Advertisement
Sign in to follow this  
uno111

Transformed buffer?

This topic is 2265 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, d3d newbie here

So lets say I have a simple array of vertices to make a couple of triangles to be rendered as a triangle list.

I also want to say there is an imaginary plane at y = -3

now I want these triangles to simply move up and down along the y, but never cross the imaginary plane. if any y point of the triangle goes beyond -3 then I want the vertex to remain at -3 which would give me a 'squishy' type effect.

Q: are transformed vertices copied in to a buffer? I'm guessing not, but how can I modify the positions?

my thoughts are to have 2 copies of the vertices array, each frame the original array is copied over the top of the modified array and then the changes can be made. But then I don't know which way up the triangles are when they have been transformed..

I'm not sure if I explained myself very well, am I making this more complicated that it is?

tips?

Thanks tons!

Share this post


Link to post
Share on other sites
Advertisement
A vertex shader would be the optimal way of doing this and would avoid the need to do any copying of vertexes between buffers.

Share this post


Link to post
Share on other sites
It depends greatly what you are trying to accomplish here, but if it is just a question of graphics effect, why not implement it in a vertex shader?

You can easily define a 3d-plane and project / clamp the vertices to this plane in a shader


Of course, nobody forbids you to make an array of vertices, and process the vertices in any way you desire. There are functions to draw triangles without having to manage vertex buffers. Of course it isn't the optimal solution.

Cheers!

Share this post


Link to post
Share on other sites
Thank you both for replying, and you were both spot on it seems I did indeed require a vertex shader.

I was initially confused with the responses because not knowing what a vertex shader was I thought it was something in reference just to lighting. It took me a while using guides to get something working.

So from what I have read there is no software support for vertex shaders, so if your hardware doesn't support this then the effect wont happen? Out of curiosity how would I do the same thing without the use of a VS ?

Sorry for the late response!

Share this post


Link to post
Share on other sites
Assuming that you're using D3D9 here (the fact that you were using the fixed pipeline suggests it) you actually do have software support for vertex shaders - just create your device with D3DCREATE_SOFTWARE_VERTEXPROCESSING and you'll have full software emulation of vertex shaders up to SM3 (and this is actually a very fast software emulation). At the same time, you most likely don't even need to worry about this - it's 2012 and hardware support is absolutely ubiquitous (we're not talking about a radical new feature here).

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!