i want to know how can i shade a complex 3D figure using DirectX 9 . i have a .X file which has the details of a complex figure in it..... i wish to shade the figure ... the figure is an alphabet 'R' and it is red in colour.. i want to shade it so that the red colour fades as we move from the left side of 'R' to the right side.... i have the .X file which has mesh coordinates but i dont know how to add shading to this particular figure .. and also i want shading on all the faces of the shape ..... i have seen some tutorials but they all shade a 2D figure by giving the coordinates and the colour value for each vertex... but in my case the figure is complex and hence finding the vertex coordinates is not possible.. so is there an alternate way ??
I will be thankful if any help in this direction is provided..
Thanks
Pooja
Shading a 3D non geometric figure
Started by Pooja Agarwal, May 01 2006 11:59 AM
4 replies to this topic
#1
Posted 01 May 2006 - 11:59 AM
#2
Posted 01 May 2006 - 04:58 PM
Two:
Create a texture that has the gradient you want, and apply it to the shape (you will probably want to do this in your 3d modelling program). Then load up the texture in dx and apply it using the texturing coordinates you added to the mesh earlier
OR
Create a fragment shader to do this. This is a hackish way imho and making a texture is the easier and more durable option.
Create a texture that has the gradient you want, and apply it to the shape (you will probably want to do this in your 3d modelling program). Then load up the texture in dx and apply it using the texturing coordinates you added to the mesh earlier
OR
Create a fragment shader to do this. This is a hackish way imho and making a texture is the easier and more durable option.
#3
Posted 02 May 2006 - 03:13 AM
Another option would be to sort you model coordinates from left to right to top to bottom (whichever way you want, as long as they're sorted) and then assign color values to each vertex based on it's position within the sorted array.
Why isn't it possible? Each model stores its vertices in some way or the other. You need to have the vertex coordinates in order to even be able to render the model, so it's there. You may be thinking about texture coordinates, in which case yes, that's difficult to generate procedurally. But having the position coordinates is enough for the method I mentioned above.
This is just another option, Ed Mack has mentioned 2 others...
Quote
but in my case the figure is complex and hence finding the vertex coordinates is not possible
Why isn't it possible? Each model stores its vertices in some way or the other. You need to have the vertex coordinates in order to even be able to render the model, so it's there. You may be thinking about texture coordinates, in which case yes, that's difficult to generate procedurally. But having the position coordinates is enough for the method I mentioned above.
This is just another option, Ed Mack has mentioned 2 others...
- TripleBuffer
- Me blog
- Me blog
#4
Posted 03 May 2006 - 08:49 AM
ok i have a .X file which has Mesh coordinates .... but there are some 294 coordinates .. in one of the tutorials i had seen that a vertex structure containing the x,y,z and color values of each vertex is created and with this the vertex buffer was created and then the vertex declaration was done.. also thay had used a shader which was a .vsh file.... so
1) is it that mesh coordinates in .X file are the vertices of the image ???
2)even if they are then do i need to add all the 294 vertices to the vertex buffer ??
3) also if you could tell me how to make the .vsh file ??
i had a tutorial in which shading was done for a 2d triangle and it was drawn using DrawPrimitive..... i used the same code and identified 4 extreme coordinates of one of the faces of my 3D figure from mesh cordinates in the .X file.... i then used Drawsubset API to draw the figure but nothing appeared on the screen .. not even the figure without shading ...
is it that shading on 2D is different from 3D ... and Drawsubset cannot be used when shading is done ??? Please help me
Thanks a lot for helping me
Pooja
1) is it that mesh coordinates in .X file are the vertices of the image ???
2)even if they are then do i need to add all the 294 vertices to the vertex buffer ??
3) also if you could tell me how to make the .vsh file ??
i had a tutorial in which shading was done for a 2d triangle and it was drawn using DrawPrimitive..... i used the same code and identified 4 extreme coordinates of one of the faces of my 3D figure from mesh cordinates in the .X file.... i then used Drawsubset API to draw the figure but nothing appeared on the screen .. not even the figure without shading ...
is it that shading on 2D is different from 3D ... and Drawsubset cannot be used when shading is done ??? Please help me
Thanks a lot for helping me
Pooja
#5
Posted 16 May 2006 - 05:50 AM
I really need help .. can somebody please provide me with a solution
Pooja
Pooja
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












