POV-Ray : Newsgroups : povray.general : Faster "specular mapping"? Server Time
1 Aug 2024 18:26:08 EDT (-0400)
  Faster "specular mapping"? (Message 1 to 3 of 3)  
From: Tom York
Subject: Faster "specular mapping"?
Date: 28 May 2005 03:25:01
Message: <web.42981b303c530a66e0d101b60@news.povray.org>
I'm looking for an optimisation. I've used material_map in the past to
control finish properties like reflectivity, specular properties and so on.
Based on a procedure posted some time ago on this news group (in 2000, I
think) I do something like

texture {
  material_map {
    tga "specular_map.tga"
    #declare Count = 1;
    #while (Count <= 255)
      texture {
        pigment { rgb 1 }
        finish {
          specular (Count/255)
        }
      }
      #local Count = Count + 1;
    #end
  }
}

The above is wrapped in a simple macro that accepts arbitrary pigments and
specular map file names and spits out the texture. It works, but it takes a
long time to parse. For example, I tried this with a 14.5MB mesh and a
1024x1024 specular map stored as a TGA file. On disk, this TGA
file (RLE compressed) is a few hundred K. If I load the specular map
into a dummy texture but don't use it in the above code (i.e. I don't use
specular mapping) then the parse time is 15 seconds (and a 640x360 takes
about 4 seconds to render). If I then remove the dummy and use the specular
map in the above code, I get a parse time of 32 seconds, which I would like
to reduce greatly. Even with specular mapping on the render time remains
between 4 and 5 seconds, which I was very happy with.

Now, this inflated parse time is maybe not too bad - if it's a disk access
issue then it should disappear when I render from a RAMdisk. However, if
anyone knows a more efficient way to achive the same result then I might be
able to avoid a RAMdisk altogether (desirable, since I'm going to be doing
animation). If it's not a disk access issue then I'm looking for a more
minimalist approach that produces the same result. Does anyone know of such
a way? I am using POVRay 3.6.1 on Windows XP (service pack 2)


Post a reply to this message

From: Christoph Hormann
Subject: Re: Faster "specular mapping"?
Date: 28 May 2005 04:25:02
Message: <d799qt$af7$1@chho.imagico.de>
Tom York wrote:
> I'm looking for an optimisation. I've used material_map in the past to
> control finish properties like reflectivity, specular properties and so on.
> Based on a procedure posted some time ago on this news group (in 2000, I
> think) I do something like
> 
> texture {
>   material_map {
>     tga "specular_map.tga"
>     #declare Count = 1;
>     #while (Count <= 255)
>       texture {
>         pigment { rgb 1 }
>         finish {
>           specular (Count/255)
>         }
>       }
>       #local Count = Count + 1;
>     #end
>   }
> }

How about:

texture {
   image_pattern {
     tga "specular_map.tga"
   }
   texture_map {
     [ 0
       pigment { rgb 1 }
       finish {
         specular 0
       }
     ]
     [ 1
       pigment { rgb 1 }
       finish {
         specular 1
       }
     ]
   }
}

Also note you don't need to use a paletted image for this - grayscale 
will work fine as well (even 16 bit).

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 03 May. 2005 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Tom York
Subject: Re: Faster "specular mapping"?
Date: 28 May 2005 05:10:00
Message: <web.4298348288a229dbe0d101b60@news.povray.org>
Christoph Hormann <chr### [at] gmxde> wrote:
> How about:
> [...]
> Also note you don't need to use a paletted image for this - grayscale
> will work fine as well (even 16 bit).

Many thanks, Christoph, that works very well! This solution cuts about 40%
off the parsing time relative to the material_map approach, which is
plenty.

Tom


Post a reply to this message

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