Sign in to follow this  
hanhan

How to render quadrilateral

Recommended Posts

As we know , we can render quadrilateral using two triangles. When we give the color of each vertices, D3D can rasterize and interpolate between the colors of the vertices. But when the quadrilateral is very long,like this : 1---------3 ... ... ... ... 0--2 (i don't know how to draw image,^_^) the color of vertices 0 and 1 is RGB(0,0,0) the color of vertices 2 and 3 is RGB(255,255,255) When i use two angles (012 and 213), the color is not be changed smoothly from 0 to 255. the color in the larger part is near 255 beacuse the size of 213 is very larger than 012. Need i calculate the color by myself? I hope i explain my question clearly. Thanks!

Share this post


Link to post
Share on other sites
Well, that's a problem that I don't know how you could fix easily, however, you may be able to get around it by breaking down your quad:


1---------------3
|\ /
| \ /
| \ /
| \ /
| \ /
| \ /
| \ /
2-------4

into more triangles, so that you can kind of manually interpolate the colors:

1-------6-------3
|\ / \ /
| \ / \ /
| \ / \ /
| 5 ------7
| / \ /
| / \ /
|/ \ /
2-------4

And calculate the between colors yourself. This may not give the exact results you want, but it should help make the difference less noticeable... more polygons = better in this case! [wink]

Share this post


Link to post
Share on other sites
Quote:
Original post by Mushu
Well, that's a problem that I don't know how you could fix easily, however, you may be able to get around it by breaking down your quad:


1---------------3
|\ /
| \ /
| \ /
| \ /
| \ /
| \ /
| \ /
2-------4

into more triangles, so that you can kind of manually interpolate the colors:

1-------6-------3
|\ / \ /
| \ / \ /
| \ / \ /
| 5 ------7
| / \ /
| / \ /
|/ \ /
2-------4

And calculate the between colors yourself. This may not give the exact results you want, but it should help make the difference less noticeable... more polygons = better in this case! [wink]


Thanks!
The method seems to be able to sovle this problem a bit.
The following divide maybe better.
I can't draw it clearly. Let's get the middle point of the top side and the one of the bottom side.diveding the quadrilateral into four triangles.
Thanks very much!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this