POV-Ray : Newsgroups : povray.programming : Primitive BOX, how to wrap a texture? : Re: Primitive BOX, how to wrap a texture? Server Time
4 Oct 2024 13:21:08 EDT (-0400)
  Re: Primitive BOX, how to wrap a texture?  
From: Mike Miller
Date: 12 Nov 2023 12:15:00
Message: <web.6551072a79784ca8f22cdb33dabc9342@news.povray.org>
"GioSeregni" <gms### [at] hotmailcom> wrote:
> "Bald Eagle" <cre### [at] netscapenet> wrote:
> > "GioSeregni" <gms### [at] hotmailcom> wrote:
> > > First of all, I apologize for the naivety of the question.
> > > I am not able to get the surfaces of the BOX with the actual texture.
> > >
> > > Example:
> > >
> > > box{<0.5000,1.0000,0.2500>,<-3,-1.0000,-0.2500>
> > >  texture {pigment {image_map
> > >  {png "130PINK" map_type 1
> > >  interpolate 2
> > > }
> > >  scale 1.30
> > > }}
> > >  rotate<0,360.0000,0> translate<46.7000,-0.0900,14.0700>
> > > }
> > >
> > > Well, Map 0 fails on some faces, Map 1 and map 2 deform the texture.
> > > How can I wrap a texture correctly?
> > > I studied the UV Mapping, but I practically understood nothing.
> > > How should I correct my example to get the same texture uniformly on all faces?
> > > A huge thank you if anyone helps me.
> > >
> > > BR
> > > Giovanni
> >
> > Check out:
> > https://wiki.povray.org/content/Reference:UV_Mapping
> >
> > The key lines that you want to pay attention to are:
> >
> > texture {
> >     uv_mapping
> >
> > The uv_mapping statement needs to preceed everything else in the texture
> > definition for it to work.
> >
> > Also, depending on how you want that box mapped, then yes, there is indeed a box
> > mapping, but you need to set up the texture specifically to do that, which might
> > not be a simple task.
> >
> > - Bill
>
> Thanks!
>
> in fact I tried but I didn't understand how to implement UV mapping. We would
> need at least one example on a cube, on which the texture is wrapped uniformly.
> Then everything else, scaling, translating, rotating, re-proportioning on the
> axes, is simple.
> G

This is one simple way I've mapped boxes or flat surfaces at different angles.
Create the surface slightly larger than what's needed. Difference the surface
with plane or planes that match the angles needed. The planes would carry the
material and transferred the image_map or material to the differenced shape.
Each rotated plane can have its own material, so a 6-sided cube could have 6
materials.
Hope this help,
Mike.


Post a reply to this message


Attachments:
Download 'box_differenced_planes.png' (482 KB)

Preview of image 'box_differenced_planes.png'
box_differenced_planes.png


 

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