|
![](/i/fill.gif) |
"here_I_am" <nomail@nomail> wrote in message
news:web.47b1270192437aab3e2740f70@news.povray.org...
> "Tim Nikias" <JUSTTHELOWERCASE:timISNOTnikias(at)gmx.netWARE> wrote:
>> Like Slime said. Take the vertices and look which triangles share that
>> vertex. Add the normals from those triangles together, and use
>> vnormalize()
>> to normalize it. Then use that normal for the vertex. Repeat for all
>> vertices.
>>
>> Regards,
>> Tim
>>
>> --
>> "Tim Nikias v2.0"
>> Homepage: <http://www.nolights.de>
>
> hey I am in the middle of a project.
>
> The problem is that I have a scene file with 15000 triangle which gives me
> flat
> shading and to have smooth shading i have to implement smooth_triangle
> instead
> of triangle at each traingle...which is not possible manually.
>
> I am not sure how to implement that in a funtion or something.
> I would appreciate if any one of you could help me out here.
>
> Thanks
>
For some reason I don't see your original post or the responses from Slime
or Tim, either through Outlook or on the povray.general page on the web
server, so I'm not sure exactly what's been covered so far. I'll plow into
the discussion anyway with appologies if I'm covering anything that's
already been covered.
I think you would need to use the sort of technique above from within a
macro or from a scripting language or a programming language. I see you've
posted on both the newusers and the advanced-users newsgroups on the same
day so it's difficult to judge whether you have any programming skills or
POV-Ray Macro experience, but you're likely to need at least some such
skills to be able to achieve this.
This processing is certainly possible using POV-Ray and, although it may not
be your first choice of language for this sort of thing, it does have some
very useful vector handling functions (such as the 'vnormalize' function
mentioned above). If I was doing this in POV-Ray I'd probably approach it in
the following way:
1. Use an editor to chop the top and bottom of the file away, saving just
the triangles' corner vectors into a separate file.
2. Write a POV-Ray macro to process the file and generate a smooth triangle
mesh. The macro would need to:
a) Use the POV-Ray 'read' function to read the data into an array of
vectors.
b) Process the array, one triangle at a time, using nested loops to search
through all of the other triangles to find triangles with edges that join
onto the current triangle.
c) Calculate the normals for each corner of the current triangle (as
mentioned above) and use the results to generate the smooth mesh.
Of course I assume you're unable to go back to the modeller source files and
generate a smooth triangle mesh from the modeller or from your conversion
utility.
Hope this helps
Regards,
Chris B.
Post a reply to this message
|
![](/i/fill.gif) |