|
|
Weed = "leaf" of grass ofcourse ;)
How to make it smooth - I have a 2d infinetely thin surface build from
triangles, reassembling a grass leaf, looking like:
HC*.........*HD
: ...:
: ... :
:... :
C*---------*D
| ...|
| ... | <-- current segment
|... |
A*---------*B
: ...:
: ... :
:... :
HA*.........*HB
So A-B-D-C is a squere (or in general a 4 point 2d polygon).
I draw it by:
triangle { A B D }
triangle { A D C }
in a mesh.
Assume I now previous two points - HA and HB (Hinting-A, Hinting-B), and
next two points HC and HD.
Using this HA HB HC HD - how can I use smooth triangle, so that current
segment will have normal nicely blended with previous and next one?
Some image would be posted in p.b.images soon.
Btw, ofcourse grass leaf is distored, it's not build of nice reular
rectangles as in draft above.
--
http://www.raf256.com/3d/
Rafal Maj 'Raf256', home page - http://www.raf256.com/me/
Computer Graphics
Post a reply to this message
|
|
|
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Rafal 'Raf256' Maj wrote:
| Weed = "leaf" of grass ofcourse ;)
|
| How to make it smooth - I have a 2d infinetely thin surface build from
| triangles, reassembling a grass leaf, looking like:
|
|
| HC*.........*HD
| : ...:
| : ... :
| :... :
| C*---------*D
| | ...|
| | ... | <-- current segment
| |... |
| A*---------*B
| : ...:
| : ... :
| :... :
| HA*.........*HB
|
| So A-B-D-C is a squere (or in general a 4 point 2d polygon).
| I draw it by:
| triangle { A B D }
| triangle { A D C }
| in a mesh.
|
| Assume I now previous two points - HA and HB (Hinting-A,
Hinting-B), and
| next two points HC and HD.
|
| Using this HA HB HC HD - how can I use smooth triangle, so that
current
| segment will have normal nicely blended with previous and next one?
|
Easiest is to simply average the normals of the adjoining triangles.
For example at point A, you'd average the normals of triangles ABD,
ADC and AHAB, giving you the following code:
<code>
#macro TriangleNormal (A, B, C)
~ vnormalize (vcross (B-A, C-A))
#end
...
// Point A normal:
vnormalize (TriangleNormal (A, B, C) + TriangleNormal (A, D, C) +
~ TriangleNormal (A, HA, B))
</code>
Note that the order of points is important: you must follow the same
order for all triangles or you will have normals pointing to both
sides of your grass.
Jerome
- --
******************************
* Jerome M. Berger *
* mailto:jbe### [at] ifrancecom *
* http://jeberger.free.fr/ *
******************************
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFBjIkAqIYJdJhyixIRAk9PAJ4tlAEEOMUX3H1N7JJiFvm+h0WaEwCfV4QQ
qnjHsbdOxwuXHKTUC1s8pZg=
=YhkY
-----END PGP SIGNATURE-----
Post a reply to this message
|
|