POV-Ray : Newsgroups : povray.programming : Primitive BOX, how to wrap a texture? Server Time
29 May 2024 00:24:22 EDT (-0400)
  Primitive BOX, how to wrap a texture? (Message 5 to 14 of 14)  
<<< Previous 4 Messages Goto Initial 10 Messages
From: GioSeregni
Subject: Re: Primitive BOX, how to wrap a texture?
Date: 12 Nov 2023 10:55:00
Message: <web.6550f50179784ca8d0d0a7c459126100@news.povray.org>
"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


Post a reply to this message

From: Bald Eagle
Subject: Re: Primitive BOX, how to wrap a texture?
Date: 12 Nov 2023 11:30:00
Message: <web.6550fcf479784ca81f9dae3025979125@news.povray.org>
"GioSeregni" <gms### [at] hotmailcom> wrote:

> Thanks!
>
> in fact I tried but I didn't understand how to implement UV mapping.

No problem.  I've been at this for 10 years, and just recently got pretty
confused about the specifics.
https://news.povray.org/povray.general/thread/%3Cweb.641d4cf6eebe912c9b4924336e066e29%40news.povray.org%3E/


We would
> need at least one example on a cube, on which the texture is wrapped uniformly.

Right.  So if you look at the diagram on the wiki, it will show you what needs
to be where, and the exact coordinates for all of the faces.  So you could
image-map some squares and render that with an orthographic camera to give you
an image-map suitable for further uv-mapping,

or

you could write some more complex code to just grab the filenames and make the
uv-mapping texture in memory and do everything in a 1-step render.  And I'd
really need to go look up and study the exact details of doing it that way.

> Then everything else, scaling, translating, rotating, re-proportioning on the
> axes, is simple.

Yes.


- BW


Post a reply to this message

From: Mike Miller
Subject: Re: Primitive BOX, how to wrap a texture?
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


 

From: Bald Eagle
Subject: Re: Primitive BOX, how to wrap a texture?
Date: 12 Nov 2023 12:55:00
Message: <web.6551112779784ca81f9dae3025979125@news.povray.org>
Also, I forgot to mention the cubic pattern, which might make things
substantially easier.

https://wiki.povray.org/content/Reference:Cubic_Pattern


Post a reply to this message

From: Mike Miller
Subject: Re: Primitive BOX, how to wrap a texture?
Date: 12 Nov 2023 13:10:00
Message: <web.6551141d79784ca8f22cdb33dabc9342@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> Also, I forgot to mention the cubic pattern, which might make things
> substantially easier.
>
> https://wiki.povray.org/content/Reference:Cubic_Pattern

What! ...cubic pattern.
Does it work with image maps? I'm guessing so, since it references textures.
Must try out. I have an architectural project that could benefit.
Thanks, Mike.


Post a reply to this message

From: Bald Eagle
Subject: Re: Primitive BOX, how to wrap a texture?
Date: 12 Nov 2023 13:55:00
Message: <web.65511f7879784ca81f9dae3025979125@news.povray.org>
"Mike Miller" <mil### [at] gmailcom> wrote:

> What! ...cubic pattern.
> Does it work with image maps? I'm guessing so, since it references textures.
> Must try out. I have an architectural project that could benefit.
> Thanks, Mike.

:D
I know, right?   POV-Ray has SO much stuff that it's difficult to even keep
track of it all, let alone document it, or implement it.

Maybe check out this thread for starters:

https://news.povray.org/povray.binaries.images/thread/%3C5a6748f8%241%40news.povray.org%3E/

- Bill


Post a reply to this message

From: Mike Miller
Subject: Re: Primitive BOX, how to wrap a texture?
Date: 12 Nov 2023 14:25:00
Message: <web.6551257679784ca8f22cdb33dabc9342@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> "Mike Miller" <mil### [at] gmailcom> wrote:
>
> > What! ...cubic pattern.
> > Does it work with image maps? I'm guessing so, since it references textures.
> > Must try out. I have an architectural project that could benefit.
> > Thanks, Mike.
>
> :D
> I know, right?   POV-Ray has SO much stuff that it's difficult to even keep
> track of it all, let alone document it, or implement it.
>
> Maybe check out this thread for starters:
>
>
https://news.povray.org/povray.binaries.images/thread/%3C5a6748f8%241%40news.povray.org%3E/
>
> - Bill

Thanks so much, ...good stuff.
I will investigate further.
Mike


Post a reply to this message

From: GioSeregni
Subject: Re: Primitive BOX, how to wrap a texture?
Date: 12 Nov 2023 15:40:00
Message: <web.6551376d79784ca8d0d0a7c459126100@news.povray.org>
Well thanks to all!
Anyway here is how my parser works and writes on the parametric block that I
manage from AutoCAD in lisp.
Obviously the texture is unique, but as you can see it can also be easily edited
by hand.
I was hoping there was an automatic system, but this works anyway.
Just fix the proportions of the AutoCAD block as it is drawn...

global_settings {max_trace_level 3 assumed_gamma 1.5}
//#include "AI.inc"
camera {location<7.9629,2,0.7854>
//_________________________________________________
 right<1.3333,0,0>direction<0,0,1>look_at<7.1311,1.5000,4.7948>
}
union {
polygon{5,<-.5,0,-.5><-.5,0,.5><.5,0,.5><.5,0,-.5><-.5,0,-.5> scale<2,0,1>
 texture {pigment {image_map {png "120ROMANO"}  scale 1.20 rotate<90,0,0> }}}
polygon{5,<-.5,1,-.5><-.5,1,.5><.5,1,.5><.5,1,-.5><-.5,1,-.5> scale<2,0,1>
 texture {pigment {image_map {png "120ROMANO"}  scale 1.20 rotate<90,0,0> }}}
polygon{5,<-.5,0,.5><-.5,1,.5><.5,1,.5><.5,0,.5><-.5,0,.5> scale<2,0,1>
 texture {pigment {image_map {png "120ROMANO"}  scale 1.20 rotate<0,-0,0> }}}
polygon{5,<-.5,0,-.5><-.5,1,-.5><.5,1,-.5><.5,0,-.5><-.5,0,-.5> scale<2,0,1>
 texture {pigment {image_map {png "120porfido"}  scale 1.20 rotate<0,0,0> }}}
polygon{5,<-.5,0,-.5><-.5,1,-.5><-.5,1,.5><-.5,0,.5><-.5,0,-.5> scale<2,0,1>
 texture {pigment {image_map {png "120ROMANO"}  scale 1.20 rotate<0,-90,0> }}}
polygon{5,<.5,0,-.5><.5,1,-.5><.5,1,.5><.5,0,.5><.5,0,-.5> scale<2,0,1>
 texture {pigment {image_map {png "120ROMANO"}  scale 1.20 rotate<0,-90,0> }}}
finish {ambient(0.7*AmbientFact) diffuse .8 phong .8 phong_size 25}
rotate<0,320.0000,0> translate<7.0860,0.0000,4.7616>
}

light_source{<-10,10,-10> colour rgb 1
}
//sky_sphere {DAYSKY}


Post a reply to this message


Attachments:
Download 'drawing1.png' (185 KB)

Preview of image 'drawing1.png'
drawing1.png


 

From: GioSeregni
Subject: Re: Primitive BOX, how to wrap a texture?
Date: 12 Nov 2023 16:05:00
Message: <web.65513db479784ca8d0d0a7c459126100@news.povray.org>
NOTE
Everything works in the metric system. The block cube is m.1x1x1
In this way if I choose X=1.65 the block will be 1.65 meter wide
The origin MUST be at the center to aid transformations and translations.
Textures are calibrated with the file name. In this case the pictures are large
m.1.20x1.20. In this way the size is transcribed in the pov file, and, since the
file is not "once", the texture is repeated by PovRay as much as necessary.
BR
G.


Post a reply to this message

From: William F Pokorny
Subject: Re: Primitive BOX, how to wrap a texture?
Date: 12 Nov 2023 23:04:13
Message: <6551a03d@news.povray.org>
On 11/12/23 09:49, Mike Miller wrote:
> There is no 'box' mapping in POV.

Not to PILE ON :-)... There are at least five (six in yuqk) and probably 
more, but as Bill W. pointed out many require a special images for the 
inbuilt mapping.

Somewhere, I have a couple of user_defined cameras for creating the 
standard map forms for use with the inbuilt three box mapped methods. 
The second, more complicated camera tries to create images which should 
stand up better where users turn on interpolation.

Today, image interpolation at the edges of the standard box image 
folding cut out often introduces artifacts(a).

See:

https://wiki.povray.org/content/Reference:UV_Mapping

---
(a) You have used other render tooling, yes? If so, do you know how 
those tools handled interpolation of the images at the edges of the cut 
out regions for different parts of a uv mapped mesh?

Do they not use interpolation at all?

Are the images cut out regions created with extra buffer pixels to 
enable clean interpolation (smoothing) on the fly?

Or, do they just use really high resolution images for uv mapping so 
interpolation doesn't much matter and so they don't use it? If yes, I 
might guess by avoiding interpolation while rendering and on every 3D 
reach into the image map, they are gaining some performance this way?

This last I ask because I see POV-Ray folks often using interpolation 
with image maps used with uv mapping and I wonder if we should not be 
creating per-interpolated versions at higher resolutions for repeated 
rendering?

Bill P.


Post a reply to this message

<<< Previous 4 Messages Goto Initial 10 Messages

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