Jump to content
  • Advertisement
Sign in to follow this  
hanhan

How to render quadrilateral

This topic is 5044 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

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!