Skip to main content
GameDev.net gamedev.net
🔒 Locked 🎮 Unity

understand shaders

Started by giugio Mar 6, 2009 at 8:08 AM 1 replies 500+ views
Original Post
giugio
giugio
Hy. I have read about a vertex shader that apply the wheight of a skinned mesh and smoot in that mode a mesh(with skeleton). I'm not understand at what is applyed a shader: 1)the entire scene 2)a set of vertex with normals , texture ecc... The program update every frame some constant matrix of the shader that get the information of the vertex in that case the bind index bone and the wheights for vertex that have in this case above the x,y,z,normal,texture ecc.. a set of 3 bind index bone and w1,w2,w3 (the weights) and so one... The problem born if i have more than a skinned mesh (that have a different skeleton , bind bone index and weights)or two skinned mesh with different poses(position of bones) , if the shader transform the entire scene how i can update the two different set of shader constants matrix? Thanks
Namethatnobodyelsetook
Namethatnobodyelsetook
A shader affects the current draw call only. Between draws you can adjust constants, and/or change shaders. You would draw one skinned mesh, changes constants, and draw then next. Next you might switch shaders and draw your world.
devronious
devronious
There are a couple ways to change the matrix in between draws. One you can stream in the matrix data with the vertex data and change the matrix using the streamed in data. Hide in in a vertex buffer as a data type.

The other way is DirectX10 allows for changes during the draws.

-Devin

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.