POV-Ray : Newsgroups : povray.general : Mapping Textures on irregular shapes Server Time: 28 May 2020 21:51:39 GMT
  Mapping Textures on irregular shapes (Message 1 to 10 of 47)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Josh
Subject: Mapping Textures on irregular shapes
Date: 22 Apr 2020 05:55:00
Message: <web.5e9fdb9c556fd9dfdc1270cd0@news.povray.org>
I am trying to figure out how to map a texture onto 3D shapes that don't
resemble spheres, cylinders, etc., described by the map_type. Say for example I
have an asteroid shape that resembles a big baby rattle, where one end bulges
much more than the other. When I apply an image's texture to the shape, the
image is very stretched on the parts that bulge and looks shrunk elsewhere. Is
there a way to map a texture onto an irregular shape where the surface area of
the texture map is evenly applied to the surface area of the shape?

I'm a beginner at pov-ray, and I don't know if I'm explaining this well. Does
that make sense?

Maybe another way to say it is that for a given surface area of the shape, I
want the same surface area of the texture to be used, regardless of the shape
the texture is being applied to.

I'm using a texture map like this and have tried all the different map_type
options.

texture {
  pigment{ image_map { png "texture.png"  map_type 1 interpolate 2} }
}

Thanks for any hints.

Josh


Post a reply to this message

From: Thomas de Groot
Subject: Re: Mapping Textures on irregular shapes
Date: 22 Apr 2020 07:06:22
Message: <5e9fecee@news.povray.org>
Welcome indeed to the club!

What you want is uv_mapping; see: 
http://wiki.povray.org/content/Reference:UV_Mapping . For complex 
objects though, you will need to "uv_map" them in another program like 
Wings3D or Blender (possibly the program where you built the complex 
object in the first place) and export, for instance an OBJ file to 
POV-Ray (mesh2 file) using Poseray as bridge for example; see: 
https://sites.google.com/view/poseray .

Thomas



Op 22/04/2020 om 07:52 schreef Josh:
> I am trying to figure out how to map a texture onto 3D shapes that don't
> resemble spheres, cylinders, etc., described by the map_type. Say for example I
> have an asteroid shape that resembles a big baby rattle, where one end bulges
> much more than the other. When I apply an image's texture to the shape, the
> image is very stretched on the parts that bulge and looks shrunk elsewhere. Is
> there a way to map a texture onto an irregular shape where the surface area of
> the texture map is evenly applied to the surface area of the shape?
> 
> I'm a beginner at pov-ray, and I don't know if I'm explaining this well. Does
> that make sense?
> 
> Maybe another way to say it is that for a given surface area of the shape, I
> want the same surface area of the texture to be used, regardless of the shape
> the texture is being applied to.
> 
> I'm using a texture map like this and have tried all the different map_type
> options.
> 
> texture {
>    pigment{ image_map { png "texture.png"  map_type 1 interpolate 2} }
> }
> 
> Thanks for any hints.
> 
> Josh
> 
> 
> 


-- 
Thomas


Post a reply to this message

From: Bald Eagle
Subject: Re: Mapping Textures on irregular shapes
Date: 22 Apr 2020 11:05:01
Message: <web.5ea0245d72e01857fb0b41570@news.povray.org>
"Josh" <nomail@nomail> wrote:
> I am trying to figure out how to map a texture onto 3D shapes that don't
> resemble spheres, cylinders, etc., described by the map_type. Say for example I
> have an asteroid shape that resembles a big baby rattle, where one end bulges
> much more than the other. When I apply an image's texture to the shape, the
> image is very stretched on the parts that bulge and looks shrunk elsewhere. Is
> there a way to map a texture onto an irregular shape where the surface area of
> the texture map is evenly applied to the surface area of the shape?
>
> I'm a beginner at pov-ray, and I don't know if I'm explaining this well. Does
> that make sense?
>
> Maybe another way to say it is that for a given surface area of the shape, I
> want the same surface area of the texture to be used, regardless of the shape
> the texture is being applied to.

Hi Josh -

The short answer is "maybe" and "it depends", and the long answer will probably
constitute the remainder of this thread.  :)

A typical planar pigment pattern is likened to projecting a slide of that
pattern across a room - the 3D space that you're working in.   You can place
your "transparent", unpigmented object into that space, and - voila! - your
shape adopts and reflects the colors and patterns of the projection in the
places where it intersects with it.

If you put a long taper on the side of an object, the pattern will "stretch"
along that just like the projection, because the pattern indeed stretches to
infinity.

You can "map" that planar pigment to a different geometry in 3D space just like
you can map x, y, and z into equations for circles, spheres, tori, etc.

AFAIK (I'm no expert), you can do that implicitly, or parametrically.

What Thomas suggests is using uv-mapping, which is a sort of parametric mapping,
and will likely give you what will work.
It will be a loose parametric mapping, sorta like shrink-wrapping your shape
with a plastic film that was designed for a sphere, and shrinks and stretches to
fit around any deviation from the sphere.
But it usually looks good enough for most purposes.

If your shape (or a new version of it) can be described with a parametric
equation of u and v, then you should be able to get an exact fit: a 1 to 1
mapping of the pigment pattern in rectangular coordinates to the surface of your
object in 3D space.

Optionally, you could use a pigment pattern that is defined in 3D space instead
of just a 2D plane (like crackle solid) and that might look a lot better with no
"stretching".

Hope that helps and isn't too confusing.  :)


- Bill


Post a reply to this message

From: Josh
Subject: Re: Mapping Textures on irregular shapes
Date: 22 Apr 2020 23:50:01
Message: <web.5ea0d80a72e01857dc1270cd0@news.povray.org>
Thanks, this is helpful! If I have a shape in Wings3D for example and export it
as an OBJ, will it automatically have a "uv_map"? Or do I have to 'create' one
by hand?

Josh


Thomas de Groot <tho### [at] degrootorg> wrote:
> Welcome indeed to the club!
>
> What you want is uv_mapping; see:
> http://wiki.povray.org/content/Reference:UV_Mapping . For complex
> objects though, you will need to "uv_map" them in another program like
> Wings3D or Blender (possibly the program where you built the complex
> object in the first place) and export, for instance an OBJ file to
> POV-Ray (mesh2 file) using Poseray as bridge for example; see:
> https://sites.google.com/view/poseray .
>
> Thomas
>
>
>
> Op 22/04/2020 om 07:52 schreef Josh:
> > I am trying to figure out how to map a texture onto 3D shapes that don't
> > resemble spheres, cylinders, etc., described by the map_type. Say for example I
> > have an asteroid shape that resembles a big baby rattle, where one end bulges
> > much more than the other. When I apply an image's texture to the shape, the
> > image is very stretched on the parts that bulge and looks shrunk elsewhere. Is
> > there a way to map a texture onto an irregular shape where the surface area of
> > the texture map is evenly applied to the surface area of the shape?
> >
> > I'm a beginner at pov-ray, and I don't know if I'm explaining this well. Does
> > that make sense?
> >
> > Maybe another way to say it is that for a given surface area of the shape, I
> > want the same surface area of the texture to be used, regardless of the shape
> > the texture is being applied to.
> >
> > I'm using a texture map like this and have tried all the different map_type
> > options.
> >
> > texture {
> >    pigment{ image_map { png "texture.png"  map_type 1 interpolate 2} }
> > }
> >
> > Thanks for any hints.
> >
> > Josh
> >
> >
> >
>
>
> --
> Thomas


Post a reply to this message

From: Alain Martel
Subject: Re: Mapping Textures on irregular shapes
Date: 23 Apr 2020 00:15:20
Message: <5ea0de18$1@news.povray.org>
Le 2020-04-22 à 19:49, Josh a écrit :
> Thanks, this is helpful! If I have a shape in Wings3D for example and export it
> as an OBJ, will it automatically have a "uv_map"? Or do I have to 'create' one
> by hand?
> 
> Josh
> 
> 

It will have an uv_map if you gave it a texture in Wings3D.
I think that you can «paint» your model in Wings3D as it seems to be a 
relatively common feature of most modellers.


Post a reply to this message

From: Bald Eagle
Subject: Re: Mapping Textures on irregular shapes
Date: 23 Apr 2020 00:25:01
Message: <web.5ea0dffb72e01857fb0b41570@news.povray.org>
"Josh" <nomail@nomail> wrote:
> Thanks, this is helpful! If I have a shape in Wings3D for example and export it
> as an OBJ, will it automatically have a "uv_map"? Or do I have to 'create' one
> by hand?

I don't think it will automatically do it - but others may have more experience.

I have seen some videos about "unwrapping" shapes in other software packages
like Grasshopper, Blender, Maya, etc ---

The idea there, as far as I can tell, is that you start with a blank "skin" and
"peel" your shape, and then arrange that onto a rectangular uv mapping texture,
and so "physically" move the coordinates from the skin to the texture and create
the 1-to-1 mapping.  You wind up with something that looks like the pieces in a
fabric pattern for sewing.

Kinda like you might slice up a globe and try to flatten it to get a transverse
Mercator projection:

https://www.wolfram.com/mathematica/new-in-10/geographic-visualization/make-a-map-that-wraps-a-globe.html

Once you wrap your head around that (pun intended) you'll begin to appreciate
why it would be so hard to try and do this automatically, and _well_.


Depending on the effect you're going for, it may be best to try a procedural
texture with some surface-dependent texture modifiers like AOI, slope, slope or
normal maps (not like the one you used for the game engine), etc.


Now, maybe Jerome Grimbert might have a good idea about whether or not NURBS
allows you to model a shape from scratch AND get a uv-mapping function-of-sorts
as an incidental byproduct...

Maybe post a sample asteroid shape and a sample or link(s) to the kind of thing
you're shooting for?  Folks may have some practical ideas.


Post a reply to this message

From: Josh
Subject: Re: Mapping Textures on irregular shapes
Date: 23 Apr 2020 06:10:01
Message: <web.5ea1305f72e01857dc1270cd0@news.povray.org>
Ya, the more I look at it, the more I think just going for procedural textures
with surface-dependent modifiers is a good idea. Any ideas of where I can go to
look for examples of good looking rock / asteroid / metal / alien type textures
or procedures for asteroids?

Josh

"Bald Eagle" <cre### [at] netscapenet> wrote:

> Depending on the effect you're going for, it may be best to try a procedural
> texture with some surface-dependent texture modifiers like AOI, slope, slope or
> normal maps (not like the one you used for the game engine), etc.
>
>
> Now, maybe Jerome Grimbert might have a good idea about whether or not NURBS
> allows you to model a shape from scratch AND get a uv-mapping function-of-sorts
> as an incidental byproduct...
>
> Maybe post a sample asteroid shape and a sample or link(s) to the kind of thing
> you're shooting for?  Folks may have some practical ideas.


Post a reply to this message

From: Josh
Subject: Re: Mapping Textures on irregular shapes
Date: 23 Apr 2020 06:15:00
Message: <web.5ea1320b72e01857dc1270cd0@news.povray.org>
As a starting point, any advice to create a variety of textures something like
these?

https://opengameart.org/content/24-bigger-asteroids
https://opengameart.org/content/432-isometrics-rocks-and-asteroids

Josh

"Josh" <nomail@nomail> wrote:
> Ya, the more I look at it, the more I think just going for procedural textures
> with surface-dependent modifiers is a good idea. Any ideas of where I can go to
> look for examples of good looking rock / asteroid / metal / alien type textures
> or procedures for asteroids?
>
> Josh
>
> "Bald Eagle" <cre### [at] netscapenet> wrote:
>
> > Depending on the effect you're going for, it may be best to try a procedural
> > texture with some surface-dependent texture modifiers like AOI, slope, slope or
> > normal maps (not like the one you used for the game engine), etc.
> >
> >
> > Now, maybe Jerome Grimbert might have a good idea about whether or not NURBS
> > allows you to model a shape from scratch AND get a uv-mapping function-of-sorts
> > as an incidental byproduct...
> >
> > Maybe post a sample asteroid shape and a sample or link(s) to the kind of thing
> > you're shooting for?  Folks may have some practical ideas.


Post a reply to this message

From: Bald Eagle
Subject: Re: Mapping Textures on irregular shapes
Date: 23 Apr 2020 11:05:01
Message: <web.5ea1757a72e01857fb0b41570@news.povray.org>
"Josh" <nomail@nomail> wrote:
> As a starting point, any advice to create a variety of textures something like
> these?
>
> https://opengameart.org/content/24-bigger-asteroids
> https://opengameart.org/content/432-isometrics-rocks-and-asteroids

Those look pretty simple.
Glossy, so use something like specular and/or phong highlighting in the finish
{} block of the texture.

My personal standard reference for rocks is of course:

http://hof.povray.org/pebbles.html
http://xlcus.com/povray/pebbles/pebbles.pov

Which if you look at the actual texturing, is just using pretty stock POV-Ray
patterns properly paired with normals based on the same pigment pattern in the
right scale and orientation.

Which is why I shamelessly (and lazily) ripped off all that code to do this:
http://news.povray.org/povray.binaries.images/thread/%3Cweb.5d3c5fe27be432e04eec112d0%40news.povray.org%3E/

:D

Once you get the idea, then you can look into setting up a basic marble pigment,
adding the turbulence, the modifiers that go with that, making an easily
adjustable color/pigment/texture/material map etc.

I'd say for rapid development, make a grid of asteroids like you've shown with a
nested loop and have each one be a little different, so you can look at a lot of
different variations with a single render.

http://f-lohmueller.de/pov_tut/loop/povlup1e.htm


Post a reply to this message

From: Alain Martel
Subject: Re: Mapping Textures on irregular shapes
Date: 23 Apr 2020 17:07:11
Message: <5ea1cb3f$1@news.povray.org>
Le 2020-04-23 à 02:13, Josh a écrit :
> As a starting point, any advice to create a variety of textures something like
> these?
> 
> https://opengameart.org/content/24-bigger-asteroids
> https://opengameart.org/content/432-isometrics-rocks-and-asteroids
> 
> Josh
> 

Looking at those and I can tell that most of the effect come from the 
geometry itself. The textures themselves looks pretty simple.

You should experiment with plain pigments as well as with the textures 
from stones.inc, stones1.inc and stone2.inc as well as those from 
textures.inc

When using those, imagine that you are carving your object from a 
massive block made from those textures 3D.


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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