POV-Ray : Newsgroups : povray.newusers : bitmap to polygons? Server Time
23 Nov 2024 17:35:34 EST (-0500)
  bitmap to polygons? (Message 1 to 5 of 5)  
From: blooflame
Subject: bitmap to polygons?
Date: 7 Apr 2012 13:55:01
Message: <web.4f807f2ed59fb813381b14980@news.povray.org>
I think I understand a little of the image map thing used to provide textures
for surfaces, and why a bitmap becomes a square polygon (0,0) to (1,1).  What I
want is to bring a bitmap in as a "billboard" more or less, with its aspect
ratio retained (and I guess, assuming square pixels in the original.  To be able
to do that, it seems I would need to read the bitmap and have each area of color
become a polygon filled with that color - I think.

1) If I load the bitmapped image as an image map and stretch it to match its
original aspect ratio (for example, if it was 320 x 240) will it look like it
originally did and therefore I can ignore the problem?  (when I last tried this
about 3 years ago, I knew the SDL statements to do this, but I've forgotten
them).

2) if not, then are there any utilities or graphics programs out there which
will create POV-Ray polygons from bitmapped images?

3) Am I even barking up the right tree?


Post a reply to this message

From: Le Forgeron
Subject: Re: bitmap to polygons?
Date: 7 Apr 2012 14:21:06
Message: <4f808592$1@news.povray.org>
Le 07/04/2012 19:53, blooflame nous fit lire :
> I think I understand a little of the image map thing used to provide textures
> for surfaces, and why a bitmap becomes a square polygon (0,0) to (1,1).  What I
> want is to bring a bitmap in as a "billboard" more or less, with its aspect
> ratio retained (and I guess, assuming square pixels in the original.  To be able
> to do that, it seems I would need to read the bitmap and have each area of color
> become a polygon filled with that color - I think.
> 

The reason for square (0,0 to 1,1) for mapping image is that povray
works in a continuous world and there is no notion of pixel.
And no, each pixel of a bitmap is not turned into a polygon.
How would you use polygon to project an image on a sphere or curvier
surface ? (just rhetorical question)

> 1) If I load the bitmapped image as an image map and stretch it to match its
> original aspect ratio (for example, if it was 320 x 240) will it look like it
> originally did and therefore I can ignore the problem?  (when I last tried this
> about 3 years ago, I knew the SDL statements to do this, but I've forgotten
> them).

Well, you might have issue with sampling when rendering, but basically,
yes, once stretched, and view at a big enough size, it will be like the
original.

SDL to change the ratio is "scale <x_stretch, y_stretch, z_stretch> "
It should be applied inside the texture or pigment, so as to not affect
the object.

> 
> 2) if not, then are there any utilities or graphics programs out there which
> will create POV-Ray polygons from bitmapped images?

From old koan: Mu.

> 
> 3) Am I even barking up the right tree?

Povray is not a mesh renderer: there is more in its world than flat
triangle & polygon.


Post a reply to this message

From: Stephen
Subject: Re: bitmap to polygons?
Date: 7 Apr 2012 14:23:41
Message: <4f80862d@news.povray.org>
On 07/04/2012 6:53 PM, blooflame wrote:
> I think I understand a little of the image map thing used to provide textures
> for surfaces, and why a bitmap becomes a square polygon (0,0) to (1,1).  What I
> want is to bring a bitmap in as a "billboard" more or less, with its aspect
> ratio retained (and I guess, assuming square pixels in the original.  To be able
> to do that, it seems I would need to read the bitmap and have each area of color
> become a polygon filled with that color - I think.
>
> 1) If I load the bitmapped image as an image map and stretch it to match its
> original aspect ratio (for example, if it was 320 x 240) will it look like it
> originally did and therefore I can ignore the problem?  (when I last tried this
> about 3 years ago, I knew the SDL statements to do this, but I've forgotten
> them).
>
> 2) if not, then are there any utilities or graphics programs out there which
> will create POV-Ray polygons from bitmapped images?
>
> 3) Am I even barking up the right tree?
>
>

Have you tried to use a height field?

#declare HeightField0 =
height_field {
    png "F:\Graphics\B3D Data\Maps\D Dell02N.png"
    water_level 0.010
    smooth
    hierarchy
    texture{ Gold_Texture0 }
    scale     <80.000000,2.000000,25.000000>
    rotate    <-90.000000,0.000000,0.000000>
    translate <-40.000000,0.000000,81.370000>
}  // end HeightField0


-- 
Regards
     Stephen


Post a reply to this message

From: Roman Reiner
Subject: Re: bitmap to polygons?
Date: 7 Apr 2012 14:45:01
Message: <web.4f808b009aa7305d2c0228160@news.povray.org>
Check the docs for uv-mapping.


Post a reply to this message

From: Alain
Subject: Re: bitmap to polygons?
Date: 8 Apr 2012 13:21:52
Message: <4f81c930@news.povray.org>

> I think I understand a little of the image map thing used to provide textures
> for surfaces, and why a bitmap becomes a square polygon (0,0) to (1,1).  What I
> want is to bring a bitmap in as a "billboard" more or less, with its aspect
> ratio retained (and I guess, assuming square pixels in the original.  To be able
> to do that, it seems I would need to read the bitmap and have each area of color
> become a polygon filled with that color - I think.

You can evaluate a pigment at a given location.
Use eval_pigment(x, y, z) for that.
It will NOT create any polygon, it will only return an rgb vector.

You can use a gray scale version of your image to generate a hight_field 
and use the original image to give it a colour. You'll need to rotate 


>
> 1) If I load the bitmapped image as an image map and stretch it to match its
> original aspect ratio (for example, if it was 320 x 240) will it look like it
> originally did and therefore I can ignore the problem?  (when I last tried this
> about 3 years ago, I knew the SDL statements to do this, but I've forgotten
> them).

Use the scale transformation. scale<320, 240, 1> will make your image 
320 by 240 units large. It will always stretch to infinity along the z axis.

>
> 2) if not, then are there any utilities or graphics programs out there which
> will create POV-Ray polygons from bitmapped images?

For that, you can use a height_field that will translate the image into 
a ground like object. It's made to work with a gray scale image, but you 
can use a colour image if you are ready to get some unexpected results.


>
> 3) Am I even barking up the right tree?

Wouf!

>
>

Alain


Post a reply to this message

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