POV-Ray : Newsgroups : povray.programming : change all textures : Re: change all textures Server Time
20 Sep 2024 18:55:15 EDT (-0400)
  Re: change all textures  
From: Przemek Loesch
Date: 10 Jan 2005 15:50:00
Message: <web.41e2ea184279187bb0aac12c0@news.povray.org>
"Rafal 'Raf256' Maj" <spa### [at] raf256com> wrote:
> Hi,
> I would like to write small patch - that will change all materials in a
> given object (see also my question in newusers
> Message-ID: <Xns95D941FDFD3F8raf256com@203.29.75.35>)

Hi Rafal,

Great idea. I understand very well the need of such a mechanism because
recently I had problems with changing textures of object translated with
Poseray. It would be great if we could overwrite textures after object is
defined.
However I think there are some difficulties which may appear with this task.
When we look close to file exported by Poseray it is only one mesh
containing all objects/layers/meshes from imported 3ds or dxf file. It is
textured internally per triangle with usage of texture indexes. It looks
like this:

....
//Materials
#include "P406_pov_mat.inc"

//Geometry
#declare P406=mesh2{
vertex_vectors{
9934,
<-76.68591,72.47195,-205.5871>,
<-77.89292,74.35229,-201.6031>,
<-71.15259,72.03568,-209.5126>,
....
texture_list{
20,
texture{P406_light_material},
texture{P406_logo__material},
texture{P406_stear_material},
texture{P406_lig01_material},
texture{P406_numbe_material},
texture{P406_glass_material},
texture{P406_dashb_material},
texture{P406_rims_material},
texture{P406_shift_material},
texture{P406_handb_material},
texture{P406_rimho_material},
texture{P406_seats_material},
texture{P406_log01_material},
texture{P406_lig02_material},
texture{P406_chass_material},
texture{P406_tires_material},
texture{P406_mirro_material},
texture{P406_mir01_material},
texture{P406_rubbe_material},
texture{P406_body_material}
}
face_indices{
14444,
<1,48,0>,0,
<3,44,45>,0,
<3,2,44>,0,
....
<62,56,95>,1,
<74,56,62>,1,
<76,60,128>,1,

The last numbers are texture indexes - according to texture list order.

So what is worth consideration in my opinion:

1. A pointer to texture is connected to every triangle in the mesh so you
have to find them all in object tree - what probably is not so difficult
but may be memory consuming - mesh in the example above has 14444 triangles
- imagine that we are creating 1000 copies of this mesh replacing each time
the textures (this is what we want) what gives us 14444000 pointers to the
textures - if I correctly understand Povray internal organisation of
objects.

2. It would be very useful if we could change only one defined texture in
such an object. For example recently I needed to replace only car paint
colour without changing the rest of the textures. So it would be very nice
if your patch could replace pointed texture with new one instead of just
removing all texture definitions (if removed all we cannot get right
texturing with objects containing many different parts - like the car
above)

Greetings,
Przemek


Post a reply to this message

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