POV-Ray : Newsgroups : povray.newusers : Having trouble with textures Server Time
28 Jun 2024 23:32:09 EDT (-0400)
  Having trouble with textures (Message 1 to 6 of 6)  
From: John Ratcliff
Subject: Having trouble with textures
Date: 7 Jun 2011 18:30:01
Message: <web.4deea56a8c68d15190ae49fd0@news.povray.org>
I'm having trouble getting textures to show up in my sample POV script.

Attached is a 'hello world' style example.  It's just a single quad (two
triangles) which is supposed to project a texture.

To run it, you will need file called 'test.jpg' in the same directory as the
script.

Any help debugging this would be much appreciated because I can't tell what's
wrong with this.

------------------------------------



#version 3.5;

light_source {
 <1.5, 1, 0.5>*10000
  color rgb <1.0, 1.0, 1.0>
}

   camera {
    location    <150.000000000 50.000000000 150.000000000>
     direction   x
     sky         y
     up          y
     right       (4/3)*x
     look_at     <150.000000000,0.000000000,150.000000000>
     angle       45
   }

// ------- Mesh test.obj SubMesh test.jpg

#declare test_00_00=
   mesh2{
    vertex_vectors{
     4
      <300.000000000, 0.000000000, 300.000000000>,
      <300.000000000, 0.000000000, 0.000000000>,
      <0.000000000, 0.000000000, 0.000000000>,
      <0.000000000, 0.000000000, 300.000000000>,
    }
    normal_vectors{
     1
      <0.000000000, 1.000000000, 0.000000000>,
    }
    uv_vectors{
     4
      <1.000000000, 1.000000000>,
      <1.000000000, 0.000000000>,
      <0.000000000, 0.000000000>,
      <0.000000000, 1.000000000>,
    }
    face_indices{
     2,
      <0,1,2>,
      <3,0,2>,
    }
    normal_indices{
     2,
      <0,0,0>,
      <0,0,0>,
    }
    uv_indices{
     2,
      <0,1,2>,
      <3,0,2>,
    }

   }


   object {
    test_00_00
texture {
 material_map {
  jpeg "test.jpg"
   texture {  //used with index 0
    finish  {specular 1}
    scale 1
  }
 }
}
   }


Post a reply to this message

From: StephenS
Subject: Re: Having trouble with textures
Date: 7 Jun 2011 20:10:01
Message: <web.4deebcad7f64c427599cb6e00@news.povray.org>
"John Ratcliff" <jra### [at] gmailcom> wrote:
....
> #declare test_00_00=
>    mesh2{
>     vertex_vectors{
>      4
>       <300.000000000, 0.000000000, 300.000000000>,
>       <300.000000000, 0.000000000, 0.000000000>,
>       <0.000000000, 0.000000000, 0.000000000>,
>       <0.000000000, 0.000000000, 300.000000000>,
....
> texture {
>  material_map {
>   jpeg "test.jpg"
>    texture {  //used with index 0
>     finish  {specular 1}
>     scale 1
>   }
>  }
> }
>    }

My first guess would be the axis.
Your quad is on the x-z, and material_map is on the x-y by default. You may also
want some more scale, by default your jeg will be from <0,0> to <1,1>.

Stephen S


Post a reply to this message

From: StephenS
Subject: Re: Having trouble with textures
Date: 7 Jun 2011 20:50:00
Message: <web.4deec6407f64c427599cb6e00@news.povray.org>
"StephenS" <nomail@nomail> wrote:
> "John Ratcliff" <jra### [at] gmailcom> wrote:
> ....
> > #declare test_00_00=
> >    mesh2{
> >     vertex_vectors{
> >      4
> >       <300.000000000, 0.000000000, 300.000000000>,
> >       <300.000000000, 0.000000000, 0.000000000>,
> >       <0.000000000, 0.000000000, 0.000000000>,
> >       <0.000000000, 0.000000000, 300.000000000>,
> ....
> > texture {
> >  material_map {
> >   jpeg "test.jpg"
> >    texture {  //used with index 0
> >     finish  {specular 1}
> >     scale 1
> >   }
> >  }
> > }
> >    }
>
> My first guess would be the axis.
> Your quad is on the x-z, and material_map is on the x-y by default. You may also
> want some more scale, by default your jeg will be from <0,0> to <1,1>.
>
> Stephen S

Ok I give up.
You also have a parse warning about sky vector and camera location/look_at.

Stephen S


Post a reply to this message

From: Jaime Vives Piqueres
Subject: Re: Having trouble with textures
Date: 8 Jun 2011 02:23:55
Message: <4def157b@news.povray.org>

> I'm having trouble getting textures to show up in my sample POV
> script.


   I didn't try the code, but at first glance I think you forgot to use
"uv_mapping" on the texture (so your uv vectors are being ignored).

   Additionally, your usage of "material_map" seems strange... are you
sure that is what you wanted, instead a regular "image_map"?

   Regards,

-- 
Jaime Vives Piqueres
		
La Persistencia de la Ignorancia
http://www.ignorancia.org


Post a reply to this message

From: John Ratcliff
Subject: Re: Having trouble with textures
Date: 8 Jun 2011 12:15:00
Message: <web.4def9f037f64c42790ae49fd0@news.povray.org>
Jaime Vives Piqueres <jai### [at] ignoranciaorg> wrote:

> > I'm having trouble getting textures to show up in my sample POV
> > script.
>
>
>    I didn't try the code, but at first glance I think you forgot to use
> "uv_mapping" on the texture (so your uv vectors are being ignored).
>
>    Additionally, your usage of "material_map" seems strange... are you
> sure that is what you wanted, instead a regular "image_map"?
>
>    Regards,
>
> --
> Jaime Vives Piqueres
>
> La Persistencia de la Ignorancia
> http://www.ignorancia.org

Let me turn the question around.

Can someone write a script which draws two triangles with a single texture
projected on it; using provided UV co-ordinates?

My attempt is clearly incorrect.  I tried copying line for line what I have seen
in tutorials and it still doesn't work, so clearly I'm doing something wrong.

I can get it work if I load my Wavefront OBJ file into PoseRay and then export
it.  However, PoseRay exports a whole lot of stuff; hundreds of lines of script.
 I still kind of wanted to know what I was doing wrong in my sample.

Also, as long as I have people's attention.  Is there a good link to find set up
scripts to texture and light terrains?  Scripts which do the marbling effect
based on slope, and synthesize really rich looking ground textures?

Much thanks for the help.

Oh yeah, one more thing.  I'm working on a game and I'm using POV to precompute
the radiosity solution and burn them into lightmaps.  One thing I'm going to
need is for someone to place and adjust interior lights in the scene.  Someone
with a strong aesthetic sense for dramatic lighting and color.

I could probably pay this person a modest amount for their time.

If interested contact me at: jra### [at] gmailcom and include links to some
POV scenes you have made with really good interior lighting.

Thanks,

John


Post a reply to this message

From: Jaime Vives Piqueres
Subject: Re: Having trouble with textures
Date: 8 Jun 2011 12:56:12
Message: <4defa9ac$1@news.povray.org>

> Let me turn the question around.
>
> Can someone write a script which draws two triangles with a single
> texture projected on it; using provided UV co-ordinates?

   Just change the texture on your example by this one:

     texture{
       uv_mapping // <---- tells the texture to use UV coords
       pigment{
         image_map{
           jpeg "test.jpg"
         }
       }
       finish  {specular 1}
     }


> My attempt is clearly incorrect.  I tried copying line for line what
> I have seen in tutorials and it still doesn't work, so clearly I'm
> doing something wrong.

   Better have a look first at this page of the docs:

   http://www.povray.org/documentation/view/3.6.1/68/


> I can get it work if I load my Wavefront OBJ file into PoseRay and
> then export it.  However, PoseRay exports a whole lot of stuff;
> hundreds of lines of script.

   Try it first with a *small* mesh to see how it creates the POV-Ray mesh.

> Also, as long as I have people's attention.  Is there a good link to
> find set up scripts to texture and light terrains?  Scripts which do
> the marbling effect based on slope, and synthesize really rich
> looking ground textures?

   Look at the textures on my Tierra project (i_land.inc):

   http://www.ignorancia.org/en/index.php?page=Project_Tierra

   It uses isosurfaces, but the textures there should work the same on a
heightfield or a mesh.

   Regards,

-- 
Jaime Vives Piqueres
		
La Persistencia de la Ignorancia
http://www.ignorancia.org


Post a reply to this message

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