POV-Ray : Newsgroups : povray.binaries.images : uv mapping uv-mappable objects from scratch Server Time
31 Oct 2024 19:38:40 EDT (-0400)
  uv mapping uv-mappable objects from scratch (Message 1 to 3 of 3)  
From: Bald Eagle
Subject: uv mapping uv-mappable objects from scratch
Date: 16 Aug 2019 21:30:00
Message: <web.5d5757a84c72a7284eec112d0@news.povray.org>
So, I managed to get the first step of the wholly SDL-based uv mapping worked
out.

Had to get my head back into "function space" and "pigment space" first, and
then things proceeded with only a few hiccups.

Shown is the image map on a unit square, followed by a unit sphere uv-mapped
with a function pigment, rotated around y by 0, 90, 180, and 270 degrees.

Maybe tomorrow I can make some more progress toward non-spherical parametric
objects and see how that goes.


Post a reply to this message


Attachments:
Download 'uvmappingtest.png' (449 KB)

Preview of image 'uvmappingtest.png'
uvmappingtest.png


 

From: Mr
Subject: Re: uv mapping uv-mappable objects from scratch
Date: 21 Aug 2019 02:30:00
Message: <web.5d5ce485236c7e68884ec9560@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> So, I managed to get the first step of the wholly SDL-based uv mapping worked
> out.
>
> Had to get my head back into "function space" and "pigment space" first, and
> then things proceeded with only a few hiccups.
>
> Shown is the image map on a unit square, followed by a unit sphere uv-mapped
> with a function pigment, rotated around y by 0, 90, 180, and 270 degrees.
>
> Maybe tomorrow I can make some more progress toward non-spherical parametric
> objects and see how that goes.

Hi, to make sure I understand correctly, this is pov code only, no bitmap? did
you post the scene somewhere?


Post a reply to this message

From: Bald Eagle
Subject: Re: uv mapping uv-mappable objects from scratch
Date: 21 Aug 2019 06:35:00
Message: <web.5d5d1d64236c7e684eec112d0@news.povray.org>
"Mr" <mauriceraybaud [at] hotmail dot fr>> wrote:


> Hi, to make sure I understand correctly, this is pov code only, no bitmap? did
> you post the scene somewhere?

Hi Maurice,

The image data comes from png that I made in POV-Ray a while back (I believe I
was trying to recreate TOK's NURBS object....)

IIRC, that's not really relevant - you can create the same png "in memory"
without saving it to a render, and use that as you would any other.

But the code to _uv_map_ the image data onto the sphere is all SDL, not a
mechanism in the source code.   It's just a simple sphere - I haven't had a
chance to elaborate on this any.


It's dirt simple, but it of course took me WAY too long to see the path to
success.  But that IS the path to success, now, isn't it - persistence.




#version 3.8;
global_settings {assumed_gamma 1.0 }
#include "colors.inc"
#include "functions.inc"
#include "math.inc"


camera {
 //location <0, 40, 2.5>
 location <1.0, 0, -3.5>
 right x*image_width/image_height
 up y
 look_at <1.0, 0, 0>
 //look_at <0, 0, 0.01>
}

light_source {<1, 0, -10> rgb 1}
background {Gray10}

#declare U = function (X, Y, Z) {(0.5 + atan2 (N(Z, X,Y,Z), N(X, X,Y,Z))/(2*pi)
)}
#declare V = function (X, Y, Z) {(0.5 + asin(N(Y, X,Y,Z))/pi)}

#declare USphere = function (X, Y, Z) { U (X, Y, Z)}
#declare VSphere = function (X, Y, Z) { V (X, Y, Z)}

#declare Image = pigment {image_map {png "Grid.png" once}}
#declare ImageMap = function {pigment {Image}}

#declare RGBPigment =

   pigment {
          average
          pigment_map {
              [
                  function { ImageMap (USphere (x,y,z), VSphere (x,y,z), 0).red
}
                  color_map {
                      [ 0 red 0 ]
                      [ 1 red 3 ]
                  }
              ]
              [
                  function { ImageMap (USphere (x,y,z), VSphere (x,y,z),
0).green }
                  color_map {
                      [ 0 green 0 ]
                      [ 1 green 3 ]
                  }
              ]
              [
                  function { ImageMap (USphere (x,y,z), VSphere (x,y,z), 0).blue
}
                  color_map {
                      [ 0 blue 0 ]
                      [ 1 blue 3 ]
                  }
              ]

    } // end pigment map
   } // end pigment

union {
sphere {0, 0.5 texture {pigment {RGBPigment} finish {specular 0.4}} rotate y*0
translate -x*0.5}
sphere {0, 0.5 texture {pigment {RGBPigment} finish {specular 0.4}} rotate y*90
translate x*0.5}
sphere {0, 0.5 texture {pigment {RGBPigment} finish {specular 0.4}} rotate y*180
translate x*1.5}
sphere {0, 0.5 texture {pigment {RGBPigment} finish {specular 0.4}} rotate y*270
translate x*2.5}
translate -y*0.5
}
box {0, 1 scale <1, 1, 0.01> texture {pigment {Image} finish {specular 0.4}}
translate <0.5, 0.25, 0>}


Post a reply to this message

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