Advertisement

Translation, in the shader?

Started by August 30, 2018 12:41 AM
2 comments, last by JWColeman 6 years, 5 months ago

Hello all, silly question. I've made an assumption that translation calculations should be performed inside the vertex, shader. I realize there might be ways to do it outside of the shader, but it made more sense to me that since I'm already using a shader, I should continue on that way.

 

With all that being said, are there any good tutorials around for simple translation inside the shader? I'm most interested in how I pass offset values by way of translation matrix to my shader. I know how I can perform the calculations, that part I've done before. My lack of understanding falls in the logistics portion. 

How to communicate the translation matrix (or identity matrix) to the shader in a dynamic way. 

I'm also making an assumption, could be wrong, that the constant buffer is not the place to do this?

 

School me, meanwhile, I'll keep up the google fight.

 

Edit: Found this gem of a quote from google... "Constant buffers are optimized for constant-variable usage, which is characterized by lower-latency access and more frequent update from the CPU."

I may be wrong about my initial assumption as to what constant buffers are for.. Now to ponder how to change the values and push the new values to the shader.. 

 

Another Edit: Maybe I need to use UpdateSubResource to change the values in my cbuffer… Hmmmmm

I'm not sure what version of DirectX you are using, but here is an example in DX11
http://www.rastertek.com/dx11tut04.html

My current game project Platform RPG
Advertisement

Hey man, maybe its because my terminology is all wrong...

 

I've been looking at this tutorial for days, but his triangle does not move. Maybe translation was the wrong word?

 

I just want to move my vertices based on an offset. That's translation right? 

 

Anyways, I just realized I had this post here, I made a new post with much more detail about my question, I realize my intial question may have been vague and generally aweful.

This topic is closed to new replies.

Advertisement