POV-Ray : Newsgroups : povray.newusers : Hey - new here, with a simple image map question Server Time
25 Nov 2024 17:53:39 EST (-0500)
  Hey - new here, with a simple image map question (Message 1 to 4 of 4)  
From: Electrode
Subject: Hey - new here, with a simple image map question
Date: 27 May 2005 18:20:00
Message: <web.42979be92728c309f52ef2a80@news.povray.org>
Apologies if this question has been resolved before. I haven't seen anything
pertaining to my specific situation while searching.

I have an image map which I am trying to apply to a cube. It is 512 x 512 x
24 bit colour. The problem is that when I try and apply the image map to
the cube, it comes out either stretched beyond recognition, or only showing
part of the image instead of the full image. It also doesn't tile, while
I'd like it to. I have tried with both TGA and JPG formats, both giving the
same results.

The code I'm using is the following:

box
{
    < HalfRoomLength, RoomFloor, -HalfRoomDepth >
    < HalfRoomLength + RoomWallThickness, RoomHeight, HalfRoomDepth >

    texture
    {
        pigment
        {
            image_map
            {
                jpeg "Textures/StainedDirtyBricks.jpg"
            }
        }

        scale TextureScale
    }

    finish
    {
        ambient AmbientValue
    }

    finish
    {
        ambient AmbientValue
    }

}

All variables have been properly declared, and TextureScale is set to 1 - so
that the image map is meant to come out in its original form.

The image in question is a brick texture, with eight rows of bricks, four
bricks in each row. The image when used in POV-Ray either comes out
stretched into a load of horizontal lines, or showing only two rows of
bricks with two bricks in each row (this is depending on camera angle, or
the value I've used for TextureScale, in some vain attempt to get the image
map to display correctly). Is there something I'm not doing right? Is there
something I may be completely missing here?

I wish I could post up pictures to show you - I'm not sure whether pictures
can be posted up here. In any case, I hope I have explained myself
adequately.

Thanks in advance for trying to help.
Electrode


Post a reply to this message

From: Tim Nikias
Subject: Re: Hey - new here, with a simple image map question
Date: 27 May 2005 19:44:59
Message: <4297b0fb@news.povray.org>
You can imagine it this way: the image-map will be placed onto the xy-plane,
occupying the space from <0,0,0> to <1,1,0>. It is projected along the
z-Axis. The size of the bitmap doesn't matter, it will always be placed in
the mentioned region. You can of course apply transformation to it, like you
do with scale TextureScale. Nontheless, it won't wrap around a box or such.
As such, it will probably map correctly to one side and the side opposite to
that, but result in horizontal lines on the other sides. Three cubes with
their own image-maps (right/left, top/bottom, front/back) should do the
trick, if you make the appropriate side slightly overlap the others. Or use
a mesh/triangles with uv-mapping to build an entire cube directly, though
this might be a little too difficult if you're a complete newbie to POV-Ray
and CG in general.

Regards,
Tim

-- 
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>


Post a reply to this message

From: gonzo
Subject: Re: Hey - new here, with a simple image map question
Date: 27 May 2005 23:36:00
Message: <4297e720@news.povray.org>
Electrode wrote:

> All variables have been properly declared, and TextureScale is set to 1 - so
> that the image map is meant to come out in its original form.
> 
> The image in question is a brick texture, with eight rows of bricks, four
> bricks in each row. The image when used in POV-Ray either comes out
> stretched into a load of horizontal lines, or showing only two rows of
> bricks with two bricks in each row (this is depending on camera angle, or
> the value I've used for TextureScale, in some vain attempt to get the image
> map to display correctly). Is there something I'm not doing right? Is there
> something I may be completely missing here?
> 
Like Tim said, you can use multiple cubes, or UV mapping, or if you 
don't need the top & bottom, you could try a radial pattern on a cube 
centered at the origin. Something like:

#declare  Bricks = texture {
	pigment {
		image_map { png "brickwall_image.png" }
	}
	finish { ambient 0 diffuse 1 phong .35 phong_size 120 }
}
#declare BrickWall = texture {
	radial
	texture_map {
		[.5 Bricks ] } // might need to scale x slightly
	frequency 4  //  gives you four sides
	rotate y*45  //  moves edge of image to corners of cube
	#local Size = whatever_scale_suits_the_size_of_your_cube
	scale Size
}


And if you make a copy of your image in a paint program, convert to 
grayscale, then invert the colors (negative in PSP) and use that as a 
normal in the Bricks texture like:

normal { bump_map { png "brickwall_bump.png" } bump_size 6 }

You'll get a pretty good brick wall.

RG


Post a reply to this message

From: Chris B
Subject: Re: Hey - new here, with a simple image map question
Date: 29 May 2005 06:17:38
Message: <429996c2@news.povray.org>
"Electrode" <nomail@nomail> wrote in message
news:web.42979be92728c309f52ef2a80@news.povray.org...
> ...
> I have an image map which I am trying to apply to a cube.
> ...

From your code snippet it looks like you're trying to apply it to a single
wall  using a box of thickness 'RoomWallThickness' in x.
So as Tim explained the image will be applied to the end surface in the xy
plane and the main surface of the wall (which lies in the yz plane) will
just show strands of colour as the image passes through the length of the
wall. To fix this bit of the problem you can rotate the texture by 90
degrees around the y axis with 'rotate 90*y'.

> The problem is that when I try and apply the image map to
> the cube, it comes out either stretched beyond recognition, or only
showing
> part of the image instead of the full image.

Once you've rotated the image you can scale it as required. You can add a
'scale' to the pigment or to the texture. By default the original image will
take up 1 POV-Ray unit in height and 1 POV-Ray unit in width. with the
bottom left of the image positioned at the origin.

> It also doesn't tile, while I'd like it to.

Odd. According to section 6.7.12.7 'Bitmap Modifiers' in the docs it should
tile by default unless you specify the 'once' option (and it does when I do
it).

>
> I wish I could post up pictures to show you - I'm not sure whether
pictures
> can be posted up here.
>

You can post images on povray.binaries.images

>
> Thanks in advance for trying to help.
> Electrode
>

Hope this helps.

Chris B.


Post a reply to this message

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