POV-Ray : Newsgroups : povray.newusers : image_map > solid object Server Time
28 Mar 2024 13:28:06 EDT (-0400)
  image_map > solid object (Message 1 to 10 of 16)  
Goto Latest 10 Messages Next 6 Messages >>>
From: Paul
Subject: image_map > solid object
Date: 3 May 2016 07:55:00
Message: <web.5728916fbf15e33d7b8901bc0@news.povray.org>
I have a simple box with image_map pigment, transparent PNG.

#include "colors.inc"

light_source { <0,0,-200> White*1.5 shadowless }

camera { location <0,0,-35> look_at <0,0,0>  }

box {   <0, 0, 0>  < 50,  50,  10 >
    texture {pigment {
image_map
{
  png "logo2.png"
  once } } }

scale <30, 20, 1>
translate <-15,-10,0>
rotate <0,45,0>  }


The result image looks like 2 very thin sheets, just surfaces (left side, see
attachment below).
I need a solid object, the 2 surfaces joined - the transparent yellow things on
the right side.
Of course, the "joining" part should be same color (green, red) and not
transparent - that is just for demonstration purposes.

Transparent PNG: https://www.dropbox.com/s/mbsuv2ti1x9g6f6/logo2.png?dl=0
Images: https://www.dropbox.com/s/jysf8dtzcfwnqul/Image2.jpg?dl=0


Post a reply to this message

From: clipka
Subject: Re: image_map > solid object
Date: 3 May 2016 08:56:54
Message: <5728a016$1@news.povray.org>
Am 03.05.2016 um 13:54 schrieb Paul:

> The result image looks like 2 very thin sheets, just surfaces (left side, see
> attachment below).
> I need a solid object, the 2 surfaces joined - the transparent yellow things on
> the right side.
> Of course, the "joining" part should be same color (green, red) and not
> transparent - that is just for demonstration purposes.

That's not an easy thing to do. You might be able to transform the image
into a function (using a so-called "function pattern"), and from that
generate an isosurface object, but that's tricky and might suffer from
artifacts.

You might be better off trying to approximate the shape with a spline
curve (bezier splines are the easiest to tame), and use three "prism"
objects.

Alternatively you can use CSG, but that'll require a bit of puzzling how
to best achieve the desired shape with intersections, differences and
unions, and it may also render slower. On the other hand, if the curved
sections are supposed to be circular arcs, it'll be more exact than what
you can achieve with splines (they can't give you exact circles).


Post a reply to this message

From: Paul
Subject: Re: image_map > solid object
Date: 3 May 2016 09:10:01
Message: <web.5728a2db2da27c237b8901bc0@news.povray.org>
Re-creating the image from scratch, using standard Pov-Ray objects, yes, that is
an option.
And the example image is pretty easy, simple shapes.
But I have lots of other different images, more "artistic", not simple geometric
shapes.
So I'm looking for a universal solution, for any input image.
I also used a simple 'for' to duplicate the object 10-15 times, but the quality
is not that good (there are still empty spaces between objects) and the
rendering time is too big (I'm rendring lots of frames, for animations).
But, why aren't the resulting shapes solid, as far as I understoond from Pov-Ray
help > all object are solid by default.
If I do a simple 'difference' between 2 boxes > the result is indeed solid.


Post a reply to this message

From: Stephen
Subject: Re: image_map > solid object
Date: 3 May 2016 09:41:14
Message: <5728aa7a@news.povray.org>
On 5/3/2016 1:57 PM, clipka wrote:
> Am 03.05.2016 um 13:54 schrieb Paul:
>
>> The result image looks like 2 very thin sheets, just surfaces (left side, see
>> attachment below).
>> I need a solid object, the 2 surfaces joined - the transparent yellow things on
>> the right side.
>> Of course, the "joining" part should be same color (green, red) and not
>> transparent - that is just for demonstration purposes.
>
> That's not an easy thing to do.

This is true.


>
> Alternatively you can use CSG, but that'll require a bit of puzzling how
> to best achieve the desired shape with intersections, differences and
> unions, and it may also render slower. On the other hand, if the curved
> sections are supposed to be circular arcs, it'll be more exact than what
> you can achieve with splines (they can't give you exact circles).
>


I would use CSG. The way I would try it is to use heightfields.
Fortunately you have only two colours. So separate your image into green 
and red images. Change the white to black and get rid of the 
transparency. Then reduce the colour depth to two colours, black and white.

Create a merge of a heightfield and one of the images. That should give 
you one of the shapes. Do the same with the other image.
You can use the water level in the heightfield to remove the base.
You will end up with two objects that are open. To close them place a 
scaled copy (very small in one dimension to make it thin) of the merge 
as an end cap.

It may sound complicated but once you have got the idea. It is quite simple.


-- 

Regards
     Stephen


Post a reply to this message

From: Stephen
Subject: Re: image_map > solid object
Date: 3 May 2016 09:47:08
Message: <5728abdc$1@news.povray.org>
On 5/3/2016 2:08 PM, Paul wrote:
> But, why aren't the resulting shapes solid, as far as I understood from Pov-Ray
> help > all object are solid by default.

That is because you are using transparency. If your design was to the 
edge of the image. Then you would see it projected along the sides that 
are invisible.
What you are seeing (if you scaled the visible faces close together) can 
be used as a billboard. A 2D image that looks 3D from one particular 
angle. Before Poser it was a simple way to make human figures.

-- 

Regards
     Stephen


Post a reply to this message

From: Paul
Subject: Re: image_map > solid object
Date: 3 May 2016 09:50:00
Message: <web.5728ac632da27c237b8901bc0@news.povray.org>
> I would use CSG. The way I would try it is to use heightfields.
> Fortunately you have only two colours. So separate your image into green
> and red images. Change the white to black and get rid of the
> transparency. Then reduce the colour depth to two colours, black and white.
>
> Create a merge of a heightfield and one of the images. That should give
> you one of the shapes. Do the same with the other image.
> You can use the water level in the heightfield to remove the base.
> You will end up with two objects that are open. To close them place a
> scaled copy (very small in one dimension to make it thin) of the merge
> as an end cap.
>
> It may sound complicated but once you have got the idea. It is quite simple.
>
>
> --
>
> Regards
>      Stephen

Like I said, this example PNG is very simple, 2 colors indeed.
But I have others with many colors, more complicated shapes, not so easy to
separate colors/shapes.
Also, heightfield does not produce the quality I need, I used them a long time
ago and they are not very smooth and sharp.


Post a reply to this message

From: Bill Pragnell
Subject: Re: image_map > solid object
Date: 3 May 2016 10:15:00
Message: <web.5728b1a22da27c235b7d07940@news.povray.org>
"Paul" <nomail@nomail> wrote:
> I need a solid object, the 2 surfaces joined - the transparent yellow things > on
the right side.

Where do your images come from? If they were generated by a vector drawing
program you may be able to do it another way. Inkscape (https://inkscape.org/)
can export paths as POV-Ray prism objects, which would do exactly what you want.

If you only have the images, it may still be possible to use Inkscape to trace
over the images, creating equivalent paths that could then be exported.

Bill


Post a reply to this message

From: Alain
Subject: Re: image_map > solid object
Date: 3 May 2016 10:27:45
Message: <5728b561$1@news.povray.org>

> Re-creating the image from scratch, using standard Pov-Ray objects, yes, that is
> an option.
> And the example image is pretty easy, simple shapes.
> But I have lots of other different images, more "artistic", not simple geometric
> shapes.
> So I'm looking for a universal solution, for any input image.
> I also used a simple 'for' to duplicate the object 10-15 times, but the quality
> is not that good (there are still empty spaces between objects) and the
> rendering time is too big (I'm rendring lots of frames, for animations).
> But, why aren't the resulting shapes solid, as far as I understoond from Pov-Ray
> help > all object are solid by default.
> If I do a simple 'difference' between 2 boxes > the result is indeed solid.
>
>
>
Solid don't mean opaque. A fully transparent object is solid, but you 
see through it.

In your case, I'd use a height_field using a black & white version of 
your image using water_level to clip the bottom part.
Next, use that height_field in an intersection with a box and apply your 
image to that. You'll need to rotate the image by 90*x or the 
intersection by -90*x so that they are oriented the same way.

It's probably the easiest and fastest way to proceed.



Alain


Post a reply to this message

From: clipka
Subject: Re: image_map > solid object
Date: 3 May 2016 10:29:31
Message: <5728b5cb$1@news.povray.org>
Am 03.05.2016 um 15:08 schrieb Paul:
> Re-creating the image from scratch, using standard Pov-Ray objects, yes, that is
> an option.
> And the example image is pretty easy, simple shapes.
> But I have lots of other different images, more "artistic", not simple geometric
> shapes.
> So I'm looking for a universal solution, for any input image.
> I also used a simple 'for' to duplicate the object 10-15 times, but the quality
> is not that good (there are still empty spaces between objects) and the
> rendering time is too big (I'm rendring lots of frames, for animations).
> But, why aren't the resulting shapes solid, as far as I understoond from Pov-Ray
> help > all object are solid by default.
> If I do a simple 'difference' between 2 boxes > the result is indeed solid.

There is probably a conceptual misunderstanding here.

In POV-Ray, you have to distinguish three different concepts:

- The *surface* of a geometric primitive: This set of points is defined
*exclusively* by what type of primitive it is, what the
primitive-specific parameters are set to, and how it is transformed
(translated, scaled or rotated).

- The *volume* of an geometric primitive: This set of points is also
defined *exclusively* by what type of primitive it is, what the
primitive-specific parameters are set to, and how it is transformed
(translated, scaled or rotated). (Usually this is the set of points
enveloped by the surface, although there are exceptions.)

- The *texture* of an object: This function of space is defined
*exclusively* by what pigment and finish you choose, and how you
transform them.

What POV-Ray actually displays is the *texture* at any *surface* that
meets certain constraints about being inside or outside other objects'
*volume* (as determined by CSG composition).

Your texture doesn't show up as 3-dimensional because there are no
surfaces in the bulk of the object. If you do a "difference" with
another object, you introduce another surface for the texture to be
displayed at.


(This is oversimplifying the situation a bit: There is also the concept
of media, which is somewhat like texture but can show up even between
surfaces; but that's always "foggy" in nature, and doesn't introduce new
surfaces.)


There is one way to turn functions of space into actual surfaces, and
that's the isosurface primitive: It takes a scalar function of space
(i.e. a function taking three coordinates and evaluating to a single
value) and defines surface and a volume based on where the function
evaluates to a given threshold.

In order to make use of this primitive type for your purpose, you need
to know that you can turn a pigment into a scalar function suitable for
an isosurface; for that you'll need a "pigment function". You'll also
need to know that a function used in an isosurface must not have any
discontinuities, so you need to activate interpolation on it.


Post a reply to this message

From: Paul
Subject: Re: image_map > solid object
Date: 3 May 2016 10:30:00
Message: <web.5728b4e32da27c23a09e82530@news.povray.org>
"Bill Pragnell" <bil### [at] hotmailcom> wrote:
> "Paul" <nomail@nomail> wrote:
> > I need a solid object, the 2 surfaces joined - the transparent yellow things > on
the right side.
>
> Where do your images come from? If they were generated by a vector drawing
> program you may be able to do it another way. Inkscape (https://inkscape.org/)
> can export paths as POV-Ray prism objects, which would do exactly what you want.
>
> If you only have the images, it may still be possible to use Inkscape to trace
> over the images, creating equivalent paths that could then be exported.
>
> Bill

Images are coming from clients.
No other formats are available, only PNG (if I'm lucky) or JPG.
I don't think tracing will work, probably not that good definition of resulting
objects.
Well, looks like this is one tricky operation, thank you for all your help.


Post a reply to this message

Goto Latest 10 Messages Next 6 Messages >>>

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