POV-Ray : Newsgroups : povray.general : Mapping Textures on irregular shapes Server Time
20 May 2024 16:10:05 EDT (-0400)
  Mapping Textures on irregular shapes (Message 18 to 27 of 47)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Bald Eagle
Subject: Re: Mapping Textures on irregular shapes
Date: 26 Apr 2020 21:25:01
Message: <web.5ea6343372e01857fb0b41570@news.povray.org>
"Josh" <nomail@nomail> wrote:

> 1) I would love to use the example from Inigo Quilez about rounding. Say I have
> a simple function for a box used in an isosurface. How would I implement his
> idea in povray to make the corners round? I tried changing the threshold of the
> isosurface, but that doesn't do it. A simple example would be super helpful.

http://www.iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm

float sdBox( in vec2 p, in vec2 b )
{
    vec2 d = abs(p)-b;
    return length(max(d,0.0)) + min(max(d.x,d.y),0.0);
}

It may take some fiddling to get the vectors that ShaderToy allows you to use in
its functions into a POV-Ray function.
#declare PX = VecP.x;
And then you can use PX in the function.

> 2) I also like how you can create df3 files and use them as a function from the
> warp example. Is there any 3d modelers that can export df3? Are there other
> programs/ways to create simple df3 files of simple shapes?

There should be a function to make a df3 from POV-Ray.
http://wiki.povray.org/content/Reference:Arrays.inc

Arrays.incReference
This file contains macros for manipulating arrays.

ARRAYS_WriteDF3(Array, FileName, BitDepth): Write an array to a df3 file.

Parameters:

Array = The array that contains the data.
FileName = The name of the file to be written.
BitDepth = The size of the binary word.
Note: See the #write directive for more information.



I would have gotten to this sooner, and maybe wrote out some more detailed help,
but I spent all day writing and developing Arduino code in cpp proper.
I still have one or two things to do that I don't quite understand.   ;)


But this should get you going if you play with it a bit.


https://www.desmos.com/calculator


Post a reply to this message

From: jr
Subject: Re: Mapping Textures on irregular shapes
Date: 27 Apr 2020 11:05:01
Message: <web.5ea6f46272e01857898043f30@news.povray.org>
hi,

"Josh" <nomail@nomail> wrote:
> ...
> 2) I also like how you can create df3 files and use them as a function from the
> warp example. Is there any 3d modelers that can export df3? Are there other
> programs/ways to create simple df3 files of simple shapes?

if you're using some Linux, there's the 'df3 tools':

<http://news.povray.org/web.5b43d8aa43fdfea9635cc5ad0%40news.povray.org>


regards, jr.


Post a reply to this message

From: Thomas de Groot
Subject: Re: Mapping Textures on irregular shapes
Date: 28 Apr 2020 03:11:03
Message: <5ea7d707@news.povray.org>
Op 26/04/2020 om 23:45 schreef Josh:
> 2) I also like how you can create df3 files and use them as a function from the
> warp example. Is there any 3d modelers that can export df3? Are there other
> programs/ways to create simple df3 files of simple shapes?
> 

You may be interesting in: 
https://www.oyonale.com/modeles.php?lang=en&page=36

-- 
Thomas


Post a reply to this message

From: Josh
Subject: Re: Mapping Textures on irregular shapes
Date: 29 Apr 2020 02:50:00
Message: <web.5ea9230a72e01857dc1270cd0@news.povray.org>
Thomas de Groot <tho### [at] degrootorg> wrote:
> Op 26/04/2020 om 23:45 schreef Josh:
> > 2) I also like how you can create df3 files and use them as a function from the
> > warp example. Is there any 3d modelers that can export df3? Are there other
> > programs/ways to create simple df3 files of simple shapes?
> >
>
> You may be interesting in:
> https://www.oyonale.com/modeles.php?lang=en&page=36
>
> --
> Thomas

Yes, that is beautiful and probably can be modified to do what I am looking for.
Thanks!


Post a reply to this message

From: Josh
Subject: Re: Mapping Textures on irregular shapes
Date: 29 Apr 2020 03:10:01
Message: <web.5ea9274e72e01857dc1270cd0@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:
> hi,
>
> "Josh" <nomail@nomail> wrote:
> > ...
> > 2) I also like how you can create df3 files and use them as a function from the
> > warp example. Is there any 3d modelers that can export df3? Are there other
> > programs/ways to create simple df3 files of simple shapes?
>
> if you're using some Linux, there's the 'df3 tools':
>
> <http://news.povray.org/web.5b43d8aa43fdfea9635cc5ad0%40news.povray.org>
>
>
> regards, jr.

Thanks! Definitely worth playing with.

I'm not sure if proper etiquette here would be to start a new post, but since
it's still on the same basic subject, I'll just continue...

How do I align a pigment with a normal? Say I have an isosurface that I want to
apply an agate normal to, but also an agate pigment_map that matches perfectly,
so that I can color just the 'valleys' of the normal map? Does that make sense?
It almost looks like it matches, but when I render one time with just the
pigment_map and one time with just the normal, I don't think they are the same
pattern.

Josh

isosurface
{
....

  texture
  {
    pigment
    {
      agate
      pigment_map
      {
        [0.00 rgb <0,1,.7>]
        [0.02 rgb <0,.3,.1>]
 [0.15 rgb <0,0,0>]
      }
      scale 0.2
    }

    normal
    {
      agate .5
      scale .2
    }
  }
}


Post a reply to this message

From: Thomas de Groot
Subject: Re: Mapping Textures on irregular shapes
Date: 29 Apr 2020 03:12:05
Message: <5ea928c5$1@news.povray.org>
Op 29/04/2020 om 08:47 schreef Josh:
> Thomas de Groot <tho### [at] degrootorg> wrote:
>> Op 26/04/2020 om 23:45 schreef Josh:
>>> 2) I also like how you can create df3 files and use them as a function from the
>>> warp example. Is there any 3d modelers that can export df3? Are there other
>>> programs/ways to create simple df3 files of simple shapes?
>>>
>>
>> You may be interesting in:
>> https://www.oyonale.com/modeles.php?lang=en&page=36
>>
>> --
>> Thomas
> 
> Yes, that is beautiful and probably can be modified to do what I am looking for.
> Thanks!
> 
> 
You certainly can! I did some exploration along that line back in 2013. 
In the newsgroups, look for my name and 'df3'. There are different 
discussions.

-- 
Thomas


Post a reply to this message

From: Bald Eagle
Subject: Re: Mapping Textures on irregular shapes
Date: 29 Apr 2020 07:05:00
Message: <web.5ea95e8672e01857fb0b41570@news.povray.org>
"Josh" <nomail@nomail> wrote:

> How do I align a pigment with a normal? Say I have an isosurface that I want to
> apply an agate normal to, but also an agate pigment_map that matches perfectly,
> so that I can color just the 'valleys' of the normal map? Does that make sense?
> It almost looks like it matches, but when I render one time with just the
> pigment_map and one time with just the normal, I don't think they are the same
> pattern.

Looks like you're doing it right.
Might just be the the way the light strikes it, or the way the eyes are more
sensitive to the finer changes in colors of the pigment map vs the effect of the
normal.

Notice I did pigment and normal and THEN scaled (easier to keep track of, and
ensures they're exactly the same)

Maybe play around with the bump_size.

http://www.povray.org/documentation/view/3.6.1/339/
The PATTERN_TYPE may optionally be followed by a float value that controls the
apparent depth of the bumps. Typical values range from 0.0 to 1.0 but any value
may be used. Negative values invert the pattern. The default value if none is
specified is 0.5.

#version 3.8;

global_settings {
 assumed_gamma 1.0
}

#include "colors.inc"

#declare Aspect = image_width/image_height;
#declare Zoom = 120;
camera {
 orthographic
 right     x*image_width/Zoom
 up   y*image_height/Zoom
 location <0, 0, -10>
 look_at  <0, 0, 0>
}


light_source {<0, 0.2, -20> color White } //shadowless}
sky_sphere {pigment {rgb 1}}

#declare B = 0.4;

box {<-1, -1, -0.1>, <0, 1, 0>
 texture {
      pigment {
   agate
   pigment_map {
    [0.00 rgb <0,1,.7>]
    [0.02 rgb <0,.3,.1>]
    [0.15 rgb <0,0,0>]
   } // end pigment map
  } // end pigment

  normal {
   agate B
  } // end pigment
 } // end texture
}

box {<0, -1, -0.1>, <1, 1, 0>
 texture {
/*  pigment {
   agate
   pigment_map {
    [0.00 rgb <0,1,.7>]
    [0.02 rgb <0,.3,.1>]
    [0.15 rgb <0,0,0>]
   } // end pigment map
  } */ //end pigment

  normal {
   agate B
  } // end pigment
 } // end texture
}


Post a reply to this message

From: Josh
Subject: Re: Mapping Textures on irregular shapes
Date: 29 Apr 2020 13:55:00
Message: <web.5ea9bf2d72e01857dc1270cd0@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> "Josh" <nomail@nomail> wrote:
>
> > How do I align a pigment with a normal? Say I have an isosurface that I want to
> > apply an agate normal to, but also an agate pigment_map that matches perfectly,
> > so that I can color just the 'valleys' of the normal map? Does that make sense?
> > It almost looks like it matches, but when I render one time with just the
> > pigment_map and one time with just the normal, I don't think they are the same
> > pattern.
>
> Looks like you're doing it right.
> Might just be the the way the light strikes it, or the way the eyes are more
> sensitive to the finer changes in colors of the pigment map vs the effect of the
> normal.

I see now that you are right. They look a bit mis-aligned but it has more to do
with the pigment map changing more quickly than the normal...

Thanks!

Josh


Post a reply to this message

From: Josh
Subject: Re: Mapping Textures on irregular shapes
Date: 30 Apr 2020 19:50:01
Message: <web.5eab640472e01857dc1270cd0@news.povray.org>
I've found a way to create and use a df3 file as an isosurface. Works well. I'm
trying now to add noise to it and it makes the shape disappear. Any ideas? The
shape shows up fine without the +f_noise3d(x,y,z)*2 statement... Does anyone
know what is happening?

#include "functions.inc"
#declare Fnct00 = function {
    pattern { density_file df3 "aster1.df3" interpolate 0
    }
}
#declare Fnct01 = function (x,y,z) {
    0.025-Fnct00(x,y,z)
}
#declare BaryteGreen = srgb <0.6157,0.7686,0.3725>;
#declare Iso00 = isosurface {
    function { Fnct01(x,y,z) + f_noise3d(x,y,z)*2}
    contained_by { box { -5,5 } }
    threshold 0
    accuracy 0.0005
    max_gradient 6
    all_intersections
    texture {
      pigment { color BaryteGreen }
      finish { ambient <0.03,0.02,0.0> diffuse 0.8,0.4 phong 0.7 }
    }
}

Josh


Post a reply to this message

From: Josh
Subject: Re: Mapping Textures on irregular shapes
Date: 30 Apr 2020 20:15:00
Message: <web.5eab68e472e01857dc1270cd0@news.povray.org>
"Josh" <nomail@nomail> wrote:
> I've found a way to create and use a df3 file as an isosurface. Works well. I'm
> trying now to add noise to it and it makes the shape disappear. Any ideas? The
> shape shows up fine without the +f_noise3d(x,y,z)*2 statement... Does anyone
> know what is happening?
>
> #include "functions.inc"
> #declare Fnct00 = function {
>     pattern { density_file df3 "aster1.df3" interpolate 0
>     }
> }
> #declare Fnct01 = function (x,y,z) {
>     0.025-Fnct00(x,y,z)
> }
> #declare BaryteGreen = srgb <0.6157,0.7686,0.3725>;
> #declare Iso00 = isosurface {
>     function { Fnct01(x,y,z) + f_noise3d(x,y,z)*2}
>     contained_by { box { -5,5 } }
>     threshold 0
>     accuracy 0.0005
>     max_gradient 6
>     all_intersections
>     texture {
>       pigment { color BaryteGreen }
>       finish { ambient <0.03,0.02,0.0> diffuse 0.8,0.4 phong 0.7 }
>     }
> }
>
> Josh

Just to clarify, I've tried adding f_noise3d, subtracting it, nothing seems to
allow me to perturb the surface of my df3 shape like I can if my function is
just a simple sphere...

Josh


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.