POV-Ray : Newsgroups : povray.binaries.images : Applying textures to a spherical heightfield section afterwards? : Re: Applying textures to a spherical heightfield section afterwards? Server Time
4 May 2024 18:37:23 EDT (-0400)
  Re: Applying textures to a spherical heightfield section afterwards?  
From: Jörg "Yadgar" Bleimann
Date: 15 Sep 2020 20:17:46
Message: <5f6159aa$1@news.povray.org>
Hi(gh)!

On 15.09.20 19:33, Tor Olav Kristensen wrote:
> "Bald Eagle" <cre### [at] netscapenet> wrote:

> I have a suspicion that Yadgar does not read my replies, 

Why shouldn't I? Of course I read any reply!

> Yadgar's problem is likely, like Jerome Grimbert explained, the unnecessary (?)
> texture indices in his face_indices block. (I believe that Jerome Grimbert meant
> to write "uv_vectors" when he wrote "uv_indices".)
> 
> POV-Ray complains, rightfully but not very comprehensible, when it reaches the
> index to the first texture; because there is no texture_list block before the
> face_indices block (as shown on the documentation page Jerome Grimbert linked
> to).
> 
> What I find interesting though, is that it IS possible to combine UV-mapping and
> a texture list: One can place several UV-mappable textures in the texture list
> and then refer to each of them in the face_indices block thereafter.
> 
> I suspcet that this may be useful if one has several image map tiles that are to
> be UV-mapped to different regions of the mesh.
> 
> Here's a complete scene that renders without problems if one provides an image
> for the UV-mapping:
> 
> // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =======
> 
> #include "colors.inc"
> 
> global_settings { assumed_gamma 1.0 }
> 
> default {
>      texture {
>          finish {
>              diffuse 0
>              ambient color Black
>              emission color White
>          }
>      }
> }
> 
> // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =======
> 
> #declare Earth_Slice_n42e044 =
>      mesh2 {
>          vertex_vectors {
>              25
>              <  2884.8178, -40532.7525,  56082.6582>,
>              < -9171.5619, -40308.4150,  44746.1601>,
>              <-21188.6401, -40084.4363,  33366.7545>,
>              <-32877.9350, -40230.5532,  21652.1961>,
>              <-44580.6796, -40306.6256,   9952.5033>,
>              < 13057.8787, -23755.4346,  45548.1452>,
>              <  1330.1334, -23909.1988,  33947.0299>,
>              <-10630.4449, -23708.0951,  22585.0805>,
>              <-22695.4630, -23321.5223,  11326.5482>,
>              <-34370.6821, -23387.2495,   -329.0233>,
>              < 23221.9340,  -6962.3006,  35022.9578>,
>              < 11316.8721,  -6836.8635,  23677.4411>,
>              <  -399.8051,  -6905.9531,  12137.8952>,
>              <-12333.4551,  -6640.1561,    818.8397>,
>              <-24333.2326,  -6238.3055, -10436.7932>,
>              < 33304.7484,   9943.2953,  24581.8979>,
>              < 21837.6885,   9539.8892,  12858.6481>,
>              <  9658.4610,  10127.7787,   1866.7320>,
>              < -1845.2730,   9879.2958,  -9816.8170>,
>              <-13884.9949,  10384.4651, -20958.2292>,
>              < 43363.8318,  26887.7446,  14165.4121>,
>              < 31606.8161,  26914.8515,   2812.8338>,
>              < 19694.9660,  27199.3287,  -8382.2095>,
>              <  9001.1538,  25928.0627, -20815.7556>,
>              < -2940.1603,  26357.8266, -31979.7411>
>          }
>          normal_vectors {
>              25
>              < 0.5096, -0.6575, -0.5550>,
>              < 0.5112, -0.6702, -0.5381>,
>              < 0.4969, -0.6771, -0.5429>,
>              < 0.5235, -0.6600, -0.5389>,
>              < 0.5386, -0.6507, -0.5352>,
>              < 0.5223, -0.6637, -0.5354>,
>              < 0.5175, -0.6623, -0.5418>,
>              < 0.5150, -0.6604, -0.5465>,
>              < 0.5212, -0.6557, -0.5463>,
>              < 0.5283, -0.6507, -0.5454>,
>              < 0.5265, -0.6504, -0.5475>,
>              < 0.5258, -0.6582, -0.5388>,
>              < 0.5125, -0.6571, -0.5527>,
>              < 0.5174, -0.6584, -0.5466>,
>              < 0.5010, -0.6580, -0.5621>,
>              < 0.5376, -0.6595, -0.5254>,
>              < 0.5256, -0.6511, -0.5475>,
>              < 0.5208, -0.6458, -0.5582>,
>              < 0.5231, -0.6730, -0.5229>,
>              < 0.4809, -0.6849, -0.5474>,
>              < 0.5475, -0.6387, -0.5406>,
>              < 0.5205, -0.6327, -0.5733>,
>              < 0.5518, -0.6599, -0.5099>,
>              < 0.5125, -0.6946, -0.5048>,
>              <-0.5136, -0.6801,  0.5232>
>          }
>          uv_vectors {
>              25
>              <0.000000, 0.000000>,
>              <0.250000, 0.000000>,
>              <0.500000, 0.000000>,
>              <0.750000, 0.000000>,
>              <1.000000, 0.000000>,
>              <0.000000, 0.250000>,
>              <0.250000, 0.250000>,
>              <0.500000, 0.250000>,
>              <0.750000, 0.250000>,
>              <1.000000, 0.250000>,
>              <0.000000, 0.500000>,
>              <0.250000, 0.500000>,
>              <0.500000, 0.500000>,
>              <0.750000, 0.500000>,
>              <1.000000, 0.500000>,
>              <0.000000, 0.750000>,
>              <0.250000, 0.750000>,
>              <0.500000, 0.750000>,
>              <0.750000, 0.750000>,
>              <1.000000, 0.750000>,
>              <0.000000, 1.000000>,
>              <0.250000, 1.000000>,
>              <0.500000, 1.000000>,
>              <0.750000, 1.000000>,
>              <1.000000, 1.000000>
>          }
>          face_indices {
>              32
>              < 0,  1,  5>,
>              < 1,  6,  5>,
>              < 1,  2,  6>,
>              < 2,  7,  6>,
>              < 2,  3,  7>,> so I'll reply to you
> instead.
> 

>              < 3,  8,  7>,
>              < 3,  4,  8>,
>              < 4,  9,  8>,
>              < 5,  6, 10>,
>              < 6, 11, 10>,
>              < 6,  7, 11>,
>              < 7, 12, 11>,
>              < 7,  8, 12>,
>              < 8, 13, 12>,
>              < 8,  9, 13>,
>              < 9, 14, 13>,
>              <10, 11, 15>,
>              <11, 16, 15>,
>              <11, 12, 16>,
>              <12, 17, 16>,
>              <12, 13, 17>,
>              <13, 18, 17>,
>              <13, 14, 18>,
>              <14, 19, 18>,
>              <15, 16, 20>,
>              <16, 21, 20>,
>              <16, 17, 21>,
>              <17, 22, 21>,
>              <17, 18, 22>,
>              <18, 23, 22>,
>              <18, 19, 23>,
>              <19, 24, 23>
>          }
>      }
> 
> #declare pApproxLook = <-3295778.3537, 4308723.8277, 3353808.4183>;
> 
> object {
>      Earth_Slice_n42e044
>      texture {
>          uv_mapping
>          pigment {
>              image_map {
>                  png "AnImage.png"
>                  gamma srgb
>                  map_type 0
>                  interpolate 2
>                  once
>              }
>          }
>      }
>      double_illuminate
>      translate pApproxLook
> }
> 
> // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =======
> 
> #declare pMin = min_extent(Earth_Slice_n42e044);
> #declare pMax = max_extent(Ear> so I'll reply to you
> instead.
> 
th_Slice_n42e044);
> #declare pCtr = (pMin + pMax)/2;
> 
> camera {
>      location 10000*<0, 10, 8>
>      look_at <0, 0, 0>
>      translate pCtr + pApproxLook
> }
> 
> background { color Gray30 }
> 
> // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =======
> 
> --
> Tor Olav
> http://subcube.com
> https://github.com/t-o-k
> 
> 

Yep, that's the ticket! I left out texture index in the face_indices 
block, and, whoopeee!, the whole thing runs perfectly! Thank you, Tor! 
I'll include you in my credits list!

See you in Khyberspace!

Yadgar


Post a reply to this message

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