POV-Ray : Newsgroups : povray.newusers : Using an image file : Re: Using an image file Server Time
19 Apr 2024 18:25:55 EDT (-0400)
  Re: Using an image file  
From: omniverse
Date: 10 Jul 2017 23:10:00
Message: <web.59644174bbe238b19c5d6c810@news.povray.org>
Alain <kua### [at] videotronca> wrote:
> Le 17-07-09 à 20:22, Sublyminal a écrit :
> > Hey everyone, I'm new to povray
>
> I'd start by assigning the image to an identifier:
>
> #declare MyImage = "NameOfTheImage";
> This assume that the image is located in the same folder as the scene,
> or any of the default location where POV-Ray normally look for files.
>
> Then, apply it to some object, typically a box or a 4 sided polygon,
> here again, assign it to an identifier:
> #declare ImageBox =
> box{0, <1,1,0>
>   pigment{image_map{png MyImage}}
>   scale max_extent(MyImage) +z
> // scale the image so that 1 pixel = 1 unit
>   finish{emission 1 diffuse 0 ambient 0}
> //optional so that it's visible without any light_source
> }
>
> Now, you can rotate, scale or move that box however you want.
>
> If you apply an image to a plane, it will get tiled infinitely on the
> plane unless you use the "once" option.

I completely missed before, yeah 'once' can be important. Good thing to have
people giving their different advice.

> The initial size of the image is always a square 1 unit wide and 1 unit
> high. Scaling it often makes things easier for most peoples.
>
> If you want to know the colour of a given point of the image, you need
> to use eval_pigment() witch takes a pigment and a location and return a
> colour.
> If you want to get a given channel, you add .red, .green or .blue.
> If you want to get the brightness, you add .grey or .gray.
> #declare GreyLevel = eval_pigment(MyImage, <XPos, YPos, 0>).grey;

If possible, OP might want to get a look at the Insert menu too, when a scene
file is started or already open, and dig down through Textures and
Materials>Textures>Texture Maps>Image Map among the other things Insert has such
as camera and lights.

Those can be a helpful, like the documentation/help but without the more
detailed descriptions. Better if you already understand the basics, but also
gives you an idea what to search for help on after seeing the many things
available.

Bob


Post a reply to this message

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