POV-Ray : Newsgroups : povray.newusers : "Floor" plane with tiled/checkered image Server Time
23 Nov 2024 07:13:13 EST (-0500)
  "Floor" plane with tiled/checkered image (Message 1 to 6 of 6)  
From: neri-engineering
Subject: "Floor" plane with tiled/checkered image
Date: 25 Oct 2022 00:25:00
Message: <web.6357642a1bb86b5b5b7d57295087cf4f@news.povray.org>
I'm just trying to create an infinite "floor" (plane) which uses a JPEG image,
attached for reference, and named "wood.jpg".

For example I can create a floor of two difference colors in a checkered pattern
like this:

plane {
  y, 0
  pigment {
    checker color Brown, color Violet
    scale 13
  }
}

I've been banging my head against the wall trying to use the image "wood.jpg"
for each of the checker boxes.  Tried using "checker" keyword, tried various
other things, I can create mesh2 objects with UV-mappings and apply a custom
texture like so:

mesh2 {
  mesh_name
  uv_mapping
  pigment {
    image_map {
      png "cut-chapstick-label.png"
      map_type 0
    }
  }
}

But the moment I try to apply a similar strategy to my floor, I get stretched
image in one of the directions.

Normally I would find the answer by experimentation and/or research but in this
case I feel like I'm on the brink of insanity trying to do this.

Thanks for the help.


Post a reply to this message


Attachments:
Download 'wood.jpg' (31 KB)

Preview of image 'wood.jpg'
wood.jpg


 

From: William F Pokorny
Subject: Re: "Floor" plane with tiled/checkered image
Date: 25 Oct 2022 05:35:53
Message: <6357adf9$1@news.povray.org>
On 10/25/22 00:20, neri-engineering wrote:
> I've been banging my head against the wall trying to use the image "wood.jpg"
> for each of the checker boxes.

Perhaps something like:

..
#declare Plane00 = plane { y, 0 }
#macro ImageMap00(_HF) // Macro due my tcl command wrapper of SDL...
   #if (_HF=0)
     image_map { "wood.jpg"
   #else
      "wood.jpg"
   #end
   #if (_HF=0)
      map_type 0
      interpolate 2
     }
   #end
#end
#declare Pigment00 = pigment { ImageMap00(0) rotate x*90 }
#declare Pigment01 = pigment { Pigment00 rotate y*90 }
#declare Pigment02 = pigment {
     checker
     pigment { Pigment00 }
     pigment { Pigment01 }
}
#declare Texture02 = texture {
     pigment { Pigment02 }
     normal { granite 0.2 scale 0.3 }
     finish { phong 0.6}
//  scale 0.5
}
#declare Obj02 = object { Plane00 texture { Texture02 } }

//--- scene ---
//  camera... light...
     object { Obj02 }
..

Bill P.


Post a reply to this message

From: Alain Martel
Subject: Re: "Floor" plane with tiled/checkered image
Date: 25 Oct 2022 11:46:06
Message: <635804be$1@news.povray.org>
Le 2022-10-25 à 00:20, neri-engineering a écrit :
> I'm just trying to create an infinite "floor" (plane) which uses a JPEG image,
> attached for reference, and named "wood.jpg".
> 
> For example I can create a floor of two difference colors in a checkered pattern
> like this:
> 
> plane {
>    y, 0
>    pigment {
>      checker color Brown, color Violet
>      scale 13
>    }
> }
> 
> I've been banging my head against the wall trying to use the image "wood.jpg"
> for each of the checker boxes.  Tried using "checker" keyword, tried various
> other things, I can create mesh2 objects with UV-mappings and apply a custom
> texture like so:
> 
> mesh2 {
>    mesh_name
>    uv_mapping
>    pigment {
>      image_map {
>        png "cut-chapstick-label.png"
>        map_type 0
>      }
>    }
> }
> 
> But the moment I try to apply a similar strategy to my floor, I get stretched
> image in one of the directions.
> 
> Normally I would find the answer by experimentation and/or research but in this
> case I feel like I'm on the brink of insanity trying to do this.
> 
> Thanks for the help.

Initially, image_map are applied in the X-Y plane.
To apply them to your floor, you need to rotate it.

Just add : rotate 90*x

plane{y,0
	pigment{image_map {jpeg "wood.jpg" scale Something} rotate 90*x}
}
The image will repeat infinitely to cover all of the plane.
scale Something is used to adjust the size of the image if it's not 
square or need to be larger than a 1x1 repeating tile.


Post a reply to this message

From: neri-engineering
Subject: Re: "Floor" plane with tiled/checkered image
Date: 25 Oct 2022 17:50:00
Message: <web.635859e5ba2938175b7d57295087cf4f@news.povray.org>
> Initially, image_map are applied in the X-Y plane.
> To apply them to your floor, you need to rotate it.
>
> Just add : rotate 90*x
>
> plane{y,0
>  pigment{image_map {jpeg "wood.jpg" scale Something} rotate 90*x}
> }
> The image will repeat infinitely to cover all of the plane.
> scale Something is used to adjust the size of the image if it's not
> square or need to be larger than a 1x1 repeating tile.

Ah, this makes sense.  I will try that.  The strange behavior I'm seeing is
consistent with your explanation.

Thank you also to the other user who suggested using macros.  I'm not that far
into my studies yet.  I will get there - to using macros that is.


Post a reply to this message

From: neri-engineering
Subject: Re: "Floor" plane with tiled/checkered image
Date: 25 Oct 2022 19:50:00
Message: <web.63587604ba2938175b7d57295087cf4f@news.povray.org>
> Ah, this makes sense.  I will try that.  The strange behavior I'm seeing is
> consistent with your explanation.

I got it.  The snippet below works as expected.  The 'emission' is because I'm
using radiosity and want the shadow cast onto the floor to be a tad less dark,
'diffuse' limits how bright the floor is.  Thanks for the help.
========================================================

plane {
  y, -4
  pigment {
    image_map {
      jpeg "wood.jpg"
      map_type 0
    }
    rotate 90 * x
  }
  finish {
    specular 0.0
    diffuse 0.45
    emission 0.06
  }
  scale <53, 1, 53>
  rotate <0, 65, 0>
}


Post a reply to this message

From: Alain Martel
Subject: Re: "Floor" plane with tiled/checkered image
Date: 26 Oct 2022 10:50:25
Message: <63594931$1@news.povray.org>
Le 2022-10-25 à 19:49, neri-engineering a écrit :
>> Ah, this makes sense.  I will try that.  The strange behavior I'm seeing is
>> consistent with your explanation.
> 
> I got it.  The snippet below works as expected.  The 'emission' is because I'm
> using radiosity and want the shadow cast onto the floor to be a tad less dark,
> 'diffuse' limits how bright the floor is.  Thanks for the help

You should not use emission for that purpose. What you do actually mean 
that the floor is a source of illumination. Don't take bad habits.
The purpose of emission is to have some object actually emit light. It 
allow the creation of scenes where there are no light_source to get 
illuminated.
With radiosity, you need an environment outside the visible part of the 
scene.

For a room, that normally mean having all the walls and ceiling present. 
That way, the light bouncing off the other walls and ceiling will 
illuminate the areas that are in the shadow from regular lights.
Make the ceiling white or light grey as most of the ceilings are. Use 
recursion_limit 2 or 3.
For outdoor scenes, that's done with a sky_sphere or a huge sphere 
surrounding the scene.


Post a reply to this message

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