POV-Ray : Newsgroups : povray.advanced-users : Fitting a texture to an object.. Server Time
1 Jul 2024 05:34:45 EDT (-0400)
  Fitting a texture to an object.. (Message 1 to 8 of 8)  
From: Patrick Elliott
Subject: Fitting a texture to an object..
Date: 9 Aug 2008 22:58:58
Message: <MPG.230807db1a9dce6498a18b@news.povray.org>
Didn't have much luck with a trick where one can use POVRay to create a 
sculpty, but then it occurred to me that the trick "may" be useful for 
something else...

include "colors.inc"                  
include "stones.inc"

sphere { 0, 1.0
 hollow
 interior_texture {T_Stone18}
 finish { ambient 0 diffuse 0.2 reflection 0.0 }
}

light_source {<0,0,0>,0.5}

camera { spherical location 0 look_at z*-1 }

What do yah know, I can get a spherical map that "should" fit an object 
of that shape in SL...

Now, I am wondering two things:

1. Will this work with other shapes, like cylinders, boxes, etc. I mean, 
and look right, since this is a projection of the "inside" of an object, 
not the outside?

2. How would I use this to do something like like a plasma ball. The 
prior attempt at that borrowed code from someone else, using media. 
Obviously, a reflected image won't work, since its going to also reflect 
parts of the reflection. (Hmm. Wonder though, could one do something 
like: sculpt_obj{... no_image} reflect_sphere{no_reflection}, and thus 
"only" see the reflected version of the object in the center? Going to 
have experiment a bit and see...)

Basically, I need something with the apparent "depth" of media, but 
which the camera maps to the shape of the object it needs to fit, not 
just a 2D plane, like I had before. It worked, but only but layering 
several spheres, with the map, so that the result looked solid. 
Otherwise, flames and other effects all tend to produce flat, 2D planes, 
which have to be placed on more than one prim, to get the intended 
effect, and then, it often looks ugly. If there was some way to map it 
so that you only got the shape you wanted... For example, a camp fire 
might be an open ended cylinder (we don't want the "top" reflecting the 
flames, and maybe not the bottom either), with a camera that "captures" 
the result as a cylindrical pattern. Map that to the shape in SL, 
complete with transparency, and you get a fire with one prim, instead of 
2-3.

Though, that might not work... Still, something that is "supposed to" 
cover the entire prim, like a ball of plasma, or a normal texture, 
should. Right? Am I on the right track here with using no image on the 
thing "producing" the result, like a particle system, and no reflection 
on what it needs to "project" onto? Obviously, solid textures, which are 
not a result of object shape, or of particles, etc., as a lot easier. :p 
lol

-- 
void main () {

    if version = "Vista" {
      call slow_by_half();
      call DRM_everything();
    }
    call functional_code();
  }
  else
    call crash_windows();
}

<A HREF='http://www.daz3d.com/index.php?refid=16130551'>Get 3D Models,
 
3D Content, and 3D Software at DAZ3D!</A>


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Fitting a texture to an object..
Date: 10 Aug 2008 09:06:38
Message: <489ee7de$1@news.povray.org>
Patrick Elliott wrote:

> 1. Will this work with other shapes, like cylinders, boxes, etc. I mean, 
> and look right, since this is a projection of the "inside" of an object, 
> not the outside?

I think you should be ok with all star-shaped objects (i.e. those
which have a direct line of sight from any surface point to the
origin). Of course, you can only apply the texture to the same
object type (with identical proportions and centering).

> 2. How would I use this to do something like like a plasma ball. The 
> prior attempt at that borrowed code from someone else, using media. 

That would probably require to implement a new camera type in
POV-Ray such as "spherical_inverted". It may not be so useful to
"sculpt" objects containing internal 3D structure, though, as all
the environment and light interactions such as reflections and
shadows would be frozen in place.


Post a reply to this message

From: Patrick Elliott
Subject: Re: Fitting a texture to an object..
Date: 10 Aug 2008 21:52:39
Message: <MPG.230949afe1f58a8f98a18c@news.povray.org>
In article <489ee7de$1@news.povray.org>, chr### [at] chrfrde says...
> Patrick Elliott wrote:
> 
> > 1. Will this work with other shapes, like cylinders, boxes, etc. I mean
, 
> > and look right, since this is a projection of the "inside" of an object
, 
> > not the outside?
> 
> I think you should be ok with all star-shaped objects (i.e. those
> which have a direct line of sight from any surface point to the
> origin). Of course, you can only apply the texture to the same
> object type (with identical proportions and centering).
> 
> > 2. How would I use this to do something like like a plasma ball. The 
> > prior attempt at that borrowed code from someone else, using media. 
> 
> That would probably require to implement a new camera type in
> POV-Ray such as "spherical_inverted". It may not be so useful to
> "sculpt" objects containing internal 3D structure, though, as all
> the environment and light interactions such as reflections and
> shadows would be frozen in place.
> 
Well, strictly speaking can you make media "no image", and maybe "no 
shadow"? Basically, the original concept, which was imho seriously 
flawed, used an inverted sphere, which had only 'reflection 1' and no 
other attributes, to make sculpties, not texture maps. Now, my thinking 
is that, for doing a sculpty the "right" way, you need the object to not 
cast shadows on itself at all, it to give off all the light (ambient 1), 
and project not image that the camera might "accidentally" see. You then 
place the camera at the center of the object itself, make its interior 
texture 100% transparent, so you can see through it, then, you get the 
"result" reflected into the sphere. Now, the problem the original 
concept had was that it only worked right with certain parameters. One 
reason was that the sphere itself could "reflect" images of its own 
surface. This meant that, instead of a single projection, you got echos. 
So.. I assume that "no reflection" only effects cases of "its" image 
bouncing off something, else, not if some other object is reflected. In 
other words, I want to "see" the center object in the sphere is going to 
map onto, but I don't want that to echo to the other surfaces.

In theory, if it works how I think it would, the result will be a 
perfect map, no matter what the shape is, so long at there are no 
"overlaps" where some part of the shape gets occluded by its own 
surface. Now, presumably, one could tell the media the same thing, "Do 
not produce a direct image, so only your reflection is seen." A camera 
at the center, I would hope, would see through the now invisible cloud, 
pick up the reflection, and map "that" to the resulting image.

Mind you, that only solves part of the problem. I have no fracking clue 
how to make something like:

density{
  spherical
  turbulence .3 lambda 3
  density_map {
    [.01 rgbt <0,0,0,0.5>]
    [.01 rgbt <0,0.3,1,0.5>]
    [1/4 rgbt <0,.5,.1,0.5>]
    [2/4 rgbt <0,1,1,0.5>]
    [3/4 rgbt <1,1,1,0.5>]
  }
}

animate, so that I can get 16 different frames, never mind if its even 
possible to make it cyclic... :p

In any case, if adding no shadow and no image to the object I am trying 
to "map", then no reflection to the sphere, works like I think...

Well, this was the original example given for how to do this:

#declare t_sculpty = texture {
 pigment {
   average
   pigment_map {
     [1 gradient x color_map {[0 rgb 0][1 rgb <1,0,0>]}]
     [1 gradient y color_map {[0 rgb 0][1 rgb <0,0,1>]}]
     [1 gradient z color_map {[0 rgb 0][1 rgb <0,1,0>]}]
   }
   translate -0.5
 }
 finish { ambient 3 diffuse 0 }
}

lathe { bezier_spline 24,
 <0.000,0.005>, <0.000,0.005>, <0.102,0.005>, <0.102,0.005>,
 <0.102,0.005>, <0.102,0.102>, <0.060,0.154>, <0.214,0.212>,
 <0.214,0.212>, <0.370,0.270>, <0.450,0.307>, <0.450,0.410>,
 <0.450,0.410>, <0.450,0.511>, <0.450,0.957>, <0.450,0.974>,
 <0.450,0.974>, <0.450,0.990>, <0.371,0.997>, <0.352,0.990>,
 <0.352,0.990>, <0.332,0.985>, <0.175,0.975>, <0.000,0.975>
 sturm
 translate y*-0.5
 scale <1,-1,1>
 texture { t_sculpty }
}

sphere { 0, 1.001 inverse
 finish { ambient 0 diffuse 0 reflection 1 }
}

camera { spherical location 0 look_at z*-1 }


So, I am thinking of changing it to something more like, the following, 
which "should" fix the existing problems with the trick, which currently 
doesn't always work. Now, can "media" be told to "no_shadow" and/or 
"no_image" too, or would I have to use a texture to do it? This is kind 
of important, since I think the particle systems from Rune employ media, 
and if you can't make it no_image, you can't use this trick on it.


#declare t_sculpty = texture {
 pigment {
   average
   pigment_map {
     [1 gradient x color_map {[0 rgb 0][1 rgb <1,0,0>]}]
     [1 gradient y color_map {[0 rgb 0][1 rgb <0,0,1>]}]
     [1 gradient z color_map {[0 rgb 0][1 rgb <0,1,0>]}]
   }
   translate -0.5
 }
 finish { ambient 3 diffuse 0 }
}

object {My_Tingy //Some CSG or mesh object, or media container.
 no_image
 no_shadow
 texture { t_sculpty }
 hollow
}

sphere { 0, 1.001 inverse
 finish { ambient 0 diffuse 0 reflection 1 }
 no_reflection
}

camera { spherical location 0 look_at z*-1 }

-- 
void main () {

    if version = "Vista" {
      call slow_by_half();
      call DRM_everything();
    }
    call functional_code();
  }
  else
    call crash_windows();
}

<A HREF='http://www.daz3d.com/index.php?refid=16130551'>Get 3D Models,
 
3D Content, and 3D Software at DAZ3D!</A>


Post a reply to this message

From: Patrick Elliott
Subject: Re: Fitting a texture to an object..
Date: 11 Aug 2008 03:22:11
Message: <MPG.230996f8ffa7103898a190@news.povray.org>
In article <MPG.230949afe1f58a8f98a18c@news.povray.org>, 
sel### [at] rraznet says...
> #declare t_sculpty = texture {
>  pigment {
>    average
>    pigment_map {
>      [1 gradient x color_map {[0 rgb 0][1 rgb <1,0,0>]}]
>      [1 gradient y color_map {[0 rgb 0][1 rgb <0,0,1>]}]
>      [1 gradient z color_map {[0 rgb 0][1 rgb <0,1,0>]}]
>    }
>    translate -0.5
>  }
>  finish { ambient 3 diffuse 0 }
> }
> 
> object {My_Tingy //Some CSG or mesh object, or media container.
>  no_image
>  no_shadow
>  texture { t_sculpty }
>  hollow
> }
> 
> sphere { 0, 1.001 inverse
>  finish { ambient 0 diffuse 0 reflection 1 }
>  no_reflection
> }
> 
> camera { spherical location 0 look_at z*-1 }
> 
Well, this nearly works.. Getting the scale right so I don't get 
overlaps and other glitches that mangle the final result is problematic, 
but using the above, with this object:

object {cylinder{-.4,.4,.1} //Some CSG or mesh object, or media 
container.
 no_image
 no_shadow
 texture { t_sculpty }
 hollow
}

Produces something "similar" to a cylinder. lol Images of the map and 
the result, displayed in a sculpty editor called Tatara are in images as 
SL_Sculpty.

The black and white points shouldn't really be there, which is part of 
the problem, but a more rounded shape shouldn't do that (I would hope). 
However, it "does" require that you "flip" the image, otherwise the 
program, and SL, produces something that is inside out. Can probably fix 
that by adjusting the camera, or something, but I have no idea what 
causes it, or how one does fix it. A "box" produces a similar odd 
result, once adjusted so no radical overlap colors happen (Too big and 
you get echos, even though the reflection is off... No idea why.), the 
corners are messed up.. Still, this can get "close" to the right 
results, which is better than what I was dealing with before. lol Oh, 
and a torus, doesn't work so well...

Still need to test media, but this looks promising, if I can just figure 
out how and why things go wrong. ;)

-- 
void main () {

    if version = "Vista" {
      call slow_by_half();
      call DRM_everything();
    }
    call functional_code();
  }
  else
    call crash_windows();
}

<A HREF='http://www.daz3d.com/index.php?refid=16130551'>Get 3D Models,
 
3D Content, and 3D Software at DAZ3D!</A>


Post a reply to this message

From: Thomas de Groot
Subject: Re: Fitting a texture to an object..
Date: 12 Aug 2008 03:46:31
Message: <48a13fd7@news.povray.org>
Forgive my ignorance in this, but what am I supposed to see? The images in 
p.b.i. are not clear for me. What is a sculpty editor by the way?

Thomas


Post a reply to this message

From: Patrick Elliott
Subject: Re: Fitting a texture to an object..
Date: 12 Aug 2008 15:08:29
Message: <48a1dfad@news.povray.org>
Thomas de Groot wrote:
> Forgive my ignorance in this, but what am I supposed to see? The images in 
> p.b.i. are not clear for me. What is a sculpty editor by the way?
> 
> Thomas 
> 
Sculpty is the name given to the displacement map used in Second Life to 
make.. basically what I suppose would be the equivalent of a POVRay 
isosurface. Mind you, its way more primitive than that. lol

I am experimenting with an alternative method of generating both them 
and textures to be mapped onto them. The reason being that the various 
editors designed for making them are either too damn limited, or have 
annoying problems in them, which make it really hard to produce a good 
result. At least not unless you know smoothing tricks that I don't, you 
don't mind mesh glitches (or can afford to hide them), or you are just 
really damn good at Blender. Needless to say, the answer in my case to 
those four issues is, I don't know the tricks, I do mind glitches, I 
can't afford to hide them (the more objects you use, the closer to the 
limit you get for how many are allowed) and I can't do jack with Blender 
at this point. lol


-- 
void main () {

     if version = "Vista" {
       call slow_by_half();
       call DRM_everything();
     }
     call functional_code();
   }
   else
     call crash_windows();
}

<A HREF='http://www.daz3d.com/index.php?refid=16130551'>Get 3D Models, 
3D Content, and 3D Software at DAZ3D!</A>


Post a reply to this message

From: Patrick Elliott
Subject: Re: Fitting a texture to an object..
Date: 12 Aug 2008 15:18:46
Message: <48a1e216$1@news.povray.org>
Thomas de Groot wrote:
> Forgive my ignorance in this, but what am I supposed to see? The images in 
> p.b.i. are not clear for me. What is a sculpty editor by the way?
> 
> Thomas 
> 
Oh, and, if you look at the editor images, you will note that either the 
way the camera warped the map, or just something about trying to use a 
cylinder to make it, produces ends that are "not" round, but have dents 
and bumps. Since the purpose is to get, as close as possible, a map that 
will produce an identical shape via displacement... This isn't too good. 
It, ironically, makes an interesting crystal, but its worrying when 
trying to make something more complex, since the same "glitches" might 
crop up.


-- 
void main () {

     if version = "Vista" {
       call slow_by_half();
       call DRM_everything();
     }
     call functional_code();
   }
   else
     call crash_windows();
}

<A HREF='http://www.daz3d.com/index.php?refid=16130551'>Get 3D Models, 
3D Content, and 3D Software at DAZ3D!</A>


Post a reply to this message

From: Thomas de Groot
Subject: Re: Fitting a texture to an object..
Date: 13 Aug 2008 03:43:37
Message: <48a290a9$1@news.povray.org>
"Patrick Elliott" <sel### [at] npgcablecom> schreef in bericht 
news:48a1dfad@news.povray.org...
> Sculpty is the name given to the displacement map used in Second Life to 
> make.. basically what I suppose would be the equivalent of a POVRay 
> isosurface. Mind you, its way more primitive than that. lol
>
I see. Thanks for the info, Patrick.

Thomas


Post a reply to this message

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