Jump to content
• Advertisement

# How to render quadrilateral

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

##### 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

##### Share on other sites
Quote:
 Original post by MushuWell, 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-------4into more triangles, so that you can kind of manually interpolate the colors:1-------6-------3|\ / \ /| \ / \ /| \ / \ /| 5 ------7| / \ /| / \ /|/ \ /2-------4And 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

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5
• Advertisement

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633736
• Total Posts
3013600
×

## Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!