# [Bf-funboard] subdivide based on face size

Campbell Barton cbarton at metavr.com
Sun Oct 10 04:13:15 CEST 2004

```I have done this in python, but I think this would be realy nice for a
SubSurf Method-

Even better- It could be used as a subsery=render method, that
subdivides based on its area divided by the distance from teh camera-

This would make faces that are close subdivide a lot and ones that are
far away- less or not at all, it would improve the quality and speed of
displacement mapping renders a lot.

- Cam

> Tom Musgrove wrote:
>
>> It might be nice to have a subdivide that subdivided faces based on
>> relative face size.
>>
>> Perhaps loop through the mesh and calculate each faces area, find the
>> average face area, and then subdivide faces that are larger than the
>> average area by a certain percentage.
>>
>> Perhaps something along the following lines
>>
>> # face_area based on code from
>> # http://astronomy.swin.edu.au/~pbourke/geometry/polyarea/source1.c
>>
>> face_area(f):
>> area = 0.0
>> num_verts = len(f.verts)
>> for i in range(0, num_verts):
>> j = (i+1) % num_verts
>> i_th_vert = f.verts[i]
>> j_th_vert = f.verts[j]
>> area += i_th_vert[0]*j_th_vert[1]
>> area += i_th_vert[1]*j_th_vert[0]
>> area *= .5
>> if area < 0:
>> return (-1*area)
>> else
>> return area
>>
>> face_area_dict = {}
>> average_area = 0.0
>> for f in faceList:
>> this_area = face_area(f)
>> face_area_dict[f] = this_area
>> average_area+=this_area
>> average_area /= len(faceList)
>>
>> double_average_area = 2.0*average_area
>> for f in faceList:
>> temp_area = face_area_dict[f]
>> if temp_area >= double_average_area:
>> f.subdivide()
>>
>> Tom M.
>> LetterRip
>>
>> _________________________________________________________________
>> Don’t just search. Find. Check out the new MSN Search!
>> http://search.msn.click-url.com/go/onm00200636ave/direct/01/
>>
>> _______________________________________________
>> Bf-funboard mailing list
>> Bf-funboard at projects.blender.org
>> http://projects.blender.org/mailman/listinfo/bf-funboard
>>
> Mhm, sounds very promising.
> _______________________________________________
> Bf-funboard mailing list
> Bf-funboard at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-funboard
>
>

--
Campbell J Barton

133 Hope Street
Geelong West, Victoria 3218 Australia

URL:    http://www.metavr.com
e-mail: cbarton at metavr.com
phone: AU (03) 5229 0241

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4851 bytes
Desc: S/MIME Cryptographic Signature
Url : http://projects.blender.org/pipermail/bf-funboard/attachments/20041010/c03bfffc/smime.bin
```