|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
while trying to render something hairy, i stumbeld over the problem how
to place objects evenly distributed on a mesh object. First I thought
about using some of the includes and/or macros out there. But the
methods I found included always a preliminary step of converting the
mesh data to the compressed mesh format (C. Colfax AFAIK). I didn't like
that approach, 'cause then I will have the same mesh as original
modeller file (eg. blender, wings3d etc.) an temporary Wavefront obj
file, the compressed mesh file and the include file with the mesh in
mesh2 format. Also I found that using SDL to place lots of objects takes
too long (in my opinion).
So I wrote a small PERL script, which directly reads the include file
with the mesh2 and creates an include with two arrays; one for the
positions on the mesh surface and on with the corresponding normals.
This include can be used to place whatever I want ontop of the mesh
according to the stored positions and normals.
The script needed ca. 40 sec. to create a file with over 1.7 million
positions and normals.
I included image shows the first test render of a snuggle pet
(Kuscheltier???) and 1.7 million small cylinders on top of it.
Where you can see the underlying mesh, you are looking directly on top
of these small cylinders.
By the way, ..., memory consumtpion was 1,4 G for this render
... dave
Post a reply to this message
Attachments:
Download 'test.png' (160 KB)
Preview of image 'test.png'
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> I included image shows the first test render of a snuggle pet
> (Kuscheltier???) and 1.7 million small cylinders on top of it.
> Where you can see the underlying mesh, you are looking directly on top
> of these small cylinders.
Yes, it would look nicer if the underlying mesh were the same colour as
the fur, or if it were only a slightly different colour.
I'd also recommend varying the length of your hair-strands randomly
within two ranges. Real furry animals (and good-quality fake fur) have a
brush-like coat of short strands, and a much less dense coat of longer
'guard' strands. Reproducing this effect is quite important for realism.
> By the way, ..., memory consumtpion was 1,4 G for this render
Well, I won't be rendering it before I upgrade my box to have more
memory. I was going to offer a useful tip to use less memory by
dynamically creating the cylinders where you are looking, but I can't
think of how you'd do it without patching POV-Ray.
--
There was a young man from Japan, . o O ( http://surreal.istic.org/ )
Who wrote verse that just wouldn't scan; ( It's like a DEATH CIRCUS! )
When they said, "But the thing Has to go with a swing," GPG 885b170d
He said, "Yes, but I like to make the final line last as long as I can."
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> > By the way, ..., memory consumtpion was 1,4 G for this render
> Well, I won't be rendering it before I upgrade my box to have more
> memory. I was going to offer a useful tip to use less memory by
> dynamically creating the cylinders where you are looking, but I can't
> think of how you'd do it without patching POV-Ray.
A quick solution might be obtainable with my Surcoat2Hair-Macros. The
approach I took with the hair was to generate a few mesh-hairs at various
lengths and oriented around a sphere. When placing a hair, I then "clip" to
a hair based on the hairs available. Uses little memory (due to the
mesh-reuse optimization). Might want to look into it, though you'd have to
adjust the macros to your needs (but I guess you're capable of that if you
can write your own Perl-Scripts).
You can find the macros in my Downloads section, the link to my homepage is
in my sig.
Regards,
Tim
--
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
David El Tom wrote:
> while trying to render something hairy, i stumbeld over the problem how
> to place objects evenly distributed on a mesh object. First I thought
> about using some of the includes and/or macros out there. But the
> methods I found included always a preliminary step of converting the
> mesh data to the compressed mesh format (C. Colfax AFAIK). I didn't like
> that approach, 'cause then I will have the same mesh as original
> modeller file (eg. blender, wings3d etc.) an temporary Wavefront obj
> file, the compressed mesh file and the include file with the mesh in
> mesh2 format. Also I found that using SDL to place lots of objects takes
> too long (in my opinion).
>
> So I wrote a small PERL script, which directly reads the include file
> with the mesh2 and creates an include with two arrays; one for the
> positions on the mesh surface and on with the corresponding normals.
>
> This include can be used to place whatever I want ontop of the mesh
> according to the stored positions and normals.
>
> The script needed ca. 40 sec. to create a file with over 1.7 million
> positions and normals.
>
> I included image shows the first test render of a snuggle pet
> (Kuscheltier???) and 1.7 million small cylinders on top of it.
> Where you can see the underlying mesh, you are looking directly on top
> of these small cylinders.
>
> By the way, ..., memory consumtpion was 1,4 G for this render
>
> ... dave
>
>
>
> ------------------------------------------------------------------------
>
I would be very interested in a conceptual description of how you did
this. I know there were some "maya fur" macros written which do an even
distribution but I could not understand what was happening from the
code. I could not use your particular script directly because I am
doing other things to manually control the direction and fall of hair or
fur. But right now I am controlling the density and distribution
manually and could use a poly-based method on occasion.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Tim Nikias wrote:
>>>By the way, ..., memory consumtpion was 1,4 G for this render
>>Well, I won't be rendering it before I upgrade my box to have more
>>memory. I was going to offer a useful tip to use less memory by
>>dynamically creating the cylinders where you are looking, but I can't
>>think of how you'd do it without patching POV-Ray.
>
> A quick solution might be obtainable with my Surcoat2Hair-Macros. The
> approach I took with the hair was to generate a few mesh-hairs at various
> lengths and oriented around a sphere. When placing a hair, I then "clip" to
> a hair based on the hairs available. Uses little memory (due to the
> mesh-reuse optimization). Might want to look into it, though you'd have to
> adjust the macros to your needs (but I guess you're capable of that if you
> can write your own Perl-Scripts).
>
> You can find the macros in my Downloads section, the link to my homepage is
> in my sig.
>
> Regards,
> Tim
>
Thanks for the comments and suggestions,
Iknow cylinders are a bad choice to create lots of hair but I've choosen
cylinders just as a test if my script got the normals right and the
number of placed objects to see the limits of my machine (P4@3GHz-1GB,
you can imagine that even my swap of 1GB was nearly exhausted with X/KDE
running). The color was just choosen by convinience and was intended to
be different from the orignal mesh texture to see things better. Take it
as very early WIP. But I was so amazed that it worked, that I posted it
even if I know that right now the picture is far from beeing eye-pleasant.
The roadmap towards a final version is to write a macro to create a
small patch of hairs (and I will for sure take a deep look into your
Surcoat2Hair-Macro, if you allow) which then will be placed. Maybe I
modify the PERL script and store also the uv's for the positions. This
would make it possible to use an uv map and eval_pigment to fine tune
normals at specific regions of the mesh, or just color adjust the hairs
patches.
There is also a quite vivid thread how to only place objects where they
are visible, which I follow with interest.
And if all works as had planned it, I will clean up the PERL sript
enrich it with comments and make it aviable (probably in p.b.utilities).
... dave
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Jim Charter wrote:
> I would be very interested in a conceptual description of how you did
> this. I know there were some "maya fur" macros written which do an even
> distribution but I could not understand what was happening from the
> code. I could not use your particular script directly because I am
> doing other things to manually control the direction and fall of hair or
> fur. But right now I am controlling the density and distribution
> manually and could use a poly-based method on occasion.
I didn't looked into the part where the "maya fur"-macro process the
mesh, but I will give a short inside look what the PERL script does.
First it parses the mesh file and stores the vertex- and normal-data as
well the face indices for both. Then it calculates the area of each
triangle and the total sum of these areas. With a given density of
objects to place on the mesh it then calculates the probability how many
objects would be on each facette of the mesh. The integer part is placed
for sure and the broken part is placed by random (adjusted to the
probability). In this way I make sure that the total number of placed
objects differes only a little bit from whished value.
The placing on the facettes is done in the following manner:
For each facette find two linear independent vectors which are lying on
the surface. You have the 3 corners of the triangle, so I just build the
two difference vectors P2->P1 and P2->P3:
P1
^\
| \
| \
| \
P2-->P3
For each object to be placed find 2 values, u and v, so that
((u+v) <= 1)
to make sure that any possible linear combination of the form
P2 + (u* P2->P1) + (v* P2->P3)
is located inside the triangle.
The normal at this point can then be calculated by:
(u*N1 + (1-u)*N2) + (v*N3 + (1-v)*N2)
and normalise the resulting vector.
The calculation for the texture-coordinates would look the same.
hope I wrote it not too confusing ...
... dave
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> (and I will for sure take a deep look into your
> Surcoat2Hair-Macro, if you allow)
Of course I do! I wouldn't make my scripts available to the public if I
wouldn't allow people taking a peek at what I'm doing. Just stick to the
general guideline I mention on my website: give credit where you feel credit
is due. So if you blatantly copy my code, please do credit me. ;-)
Regards,
Tim
--
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I forced myself to clean up the script and implement UV support.
some in the mesh2), it could be a versatile tool as it gives you the
freedom of placing anything you want and finetune the placed object on
base of the corresponding uv`s.
You can find the script in p.b.utilities.
(http://news.povray.org/povray.binaries.utilities/thread/%3C4331fa28%40news.povray.org%3E/)
just give it a try ... ;-)
feedback is as always welcome.
...dave
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
David El Tom wrote:
> I forced myself to clean up the script and implement UV support.
>
> some in the mesh2), it could be a versatile tool as it gives you the
> freedom of placing anything you want and finetune the placed object on
> base of the corresponding uv`s.
>
> You can find the script in p.b.utilities.
>
(http://news.povray.org/povray.binaries.utilities/thread/%3C4331fa28%40news.povray.org%3E/)
>
>
> just give it a try ... ;-)
>
> feedback is as always welcome.
>
> ...dave
Thanks Dave. Will definitely take a look.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|