POV-Ray : Newsgroups : povray.binaries.images : Le Forgeron: experiments : Re: Le Forgeron: experiments Server Time
6 Oct 2024 07:20:10 EDT (-0400)
  Re: Le Forgeron: experiments  
From: LanuHum
Date: 8 Mar 2017 15:30:00
Message: <web.58c068df1d798e7f7a3e03fe0@news.povray.org>
Le_Forgeron <jgr### [at] freefr> wrote:
> Le 08/03/2017 à 19:45, LanuHum a écrit :
> > stl_load { "/home/leonid/untitled.stl" texture { Material }}
> > But, the cube can have different textures for each polygon.
> > It would be nice to use a texture_list.
> >
>
> And which version of STL would you use ?
> There is 2 incompatible format for color encoding (in binaray STL):
> * As stated on wikipedia:  generic STL file reader cannot automatically
> distinguish between them.
> * 2 "attribute byte count" bytes at the end of every triangle store a
> 15-bit rgb color information
> ** bits 0-4 for blue, bits 5-9 for green, bits 10-14 for red, bit 15 set
> when color is valid
> ** bits 0-4 for red, bits 5-9 for green, bits 10-14 for blue, bit 15
> unset when color is local, set to use global
> * the header (80 bytes) can have overall color specification (only for
> the latter encoding)
> ** but it can have COLOR=RGBA or/and MATERIAL= with 12 bytes for diffuse
> reflection, specular highlight and ambient light
>
> The stl_load-ed object is an usual povray shape: immerge it in whatever
> texture/pattern you want.
> (actually, it's a mesh once loaded, but there is no uv coordinates in
> STL to help you)
>
> And to make things funnier, no one as a clue about the 15 bit color
> space: is it linear or gamma corrected ? (and which correction)
>
> happy reading :
>
> https://en.wikipedia.org/wiki/STL_(file_format)

No,no,no. Only idea. STL as base.
We can write an string array at the end of the file:
mesh_materials=['glass','wood','metal']
We can write an integer array at the end of the file:
face_material_indexes=[mesh_materials[0],mesh_materials[2],mesh_materials[1],mesh_materials[1],mesh_materials[2],mesh_m
aterials[0]]
If it is written to a file, you can change the parser.
Now in .pov
#declare Metal = texture{}
#declare Wood = texture{}
#declare Glass = texture{}
#declare My = texture_list{3,texture{Metal},texture{Wood},texture{Glass}}
stl_load{filename,texture_list{My}}


Post a reply to this message

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