POV-Ray : Newsgroups : povray.general : remap RGBT color to anther RGBT color? Server Time
30 Jul 2024 10:22:50 EDT (-0400)
  remap RGBT color to anther RGBT color? (Message 6 to 15 of 15)  
<<< Previous 5 Messages Goto Initial 10 Messages
From: caduser
Subject: Re: remap RGBT color to anther RGBT color?
Date: 11 Jul 2009 01:00:04
Message: <web.4a581c2bbddeda84dbd439ba0@news.povray.org>
If it helps our typical material file adds this to the start of a POV:


#include "colors.inc"
#include "textures.inc"
#include "skies.inc"

#declare light_mul = 0.3;
#declare plane_mul = 1.2;
#switch (3)
  #case (0)
    #declare light_mul = 1.6;
    #declare plane_mul = 1.2;
  #break
  #case (1)
    global_settings {
        max_trace_level 6
        assumed_gamma 2.2

        radiosity {
          pretrace_start 0.08
          pretrace_end   0.04
          count 50

          nearest_count 2
          error_bound 0.41
          recursion_limit 1
         normal on

          low_error_factor 0.2
          gray_threshold 0.0
          minimum_reuse 0.015
          brightness 2.5

          adc_bailout 0.01/2
        }
      }
  #break
  #case (2)
    global_settings {
        max_trace_level 6
        assumed_gamma 2.2

        radiosity {
          pretrace_start 0.08
          pretrace_end   0.01
          count 150

          nearest_count 3
          error_bound 0.31
          recursion_limit 1
         normal on

          low_error_factor 0.2
          gray_threshold 0.0
          minimum_reuse 0.015
          brightness 2.5

          adc_bailout 0.01/2
        }
      }
  #break
  #case (3)
    global_settings {
        max_trace_level 6
        assumed_gamma 2.2

        radiosity {
          pretrace_start 0.08
          pretrace_end   0.005
          count 250

          nearest_count 5
          error_bound 0.21
          recursion_limit 1
         normal on

          low_error_factor 0.2
          gray_threshold 0.0
          minimum_reuse 0.015
          brightness 2.5

          adc_bailout 0.01/2
        }
      }
  #break
#end

#declare CAP =
union
{
union
{
union{

------Then comes all the coordinates to make the object-------

texture {
    pigment
      {
          color rgbt <0.,0.,0.,0.>
      }
    finish
      {
        ambient 0
        diffuse 0.42
        roughness 0.03
        reflection
          {
           0.5, 0.6
           metallic
          }
        metallic
      }
  scale 3
  scale 280.
}

The last part seems to be the construct of the environment the camera position
and if blur statements etc finally the HDRI map and the light.

Just to be clear I did not write the materials or the objects I am an end user I
asked if the program that outputs the models can capture this value and change
it but that was involved and seemed a lost cause. I had managed to create
several new material files from reading and pocking around like copper and some
other basic edits and wanted to know if this could be done with an external file
with no modification to the original POV or if it is a lost cause.

I was frustrated I could not figure it out I usually manage to work something
out find a script to modify but this tool is new to me my background is CAD, 3D
Studio and Photo editing. It seems like just about anything can be achieved with
this tool with some know how and patience.


Post a reply to this message

From: Chris B
Subject: Re: remap RGBT color to anther RGBT color?
Date: 11 Jul 2009 03:34:54
Message: <4a58409e@news.povray.org>
"caduser" <nomail@nomail> wrote in message 
news:web.4a581c2bbddeda84dbd439ba0@news.povray.org...
> If it helps our typical material file adds this to the start of a POV:
>
>   ... snip ...
>
> texture {
>    pigment
>      {
>          color rgbt <0.,0.,0.,0.>
>      }
>
>   ... snip ...
>
> ... wanted to know if this could be done with an external file
> with no modification to the original POV or if it is a lost cause.
>

Once this POV output has been written to disk containing literal color 
definitions, I don't believe there's any practical way of changing the color 
without changing the file. Having said that;  changing the file should not 
be difficult as you can perform a global change in most editors (for example 
the POV-Ray for Windows editor). You have said that it's only two specific 
values (complete Black and complete White) that you want to change and, as 
these are written out by an application program they are presumably written 
in a consistent format.

Therefore, a global change of 'color rgbt <0.,0.,0.,0.>' to 'color rgbt 
<0.01,0.01,0.01,0.01>' should be quick and easy in any decent editor. If you 
need to make this change regularly you could use an editor with a macro 
recording facility, so it would be just one button press each time. The 
POV-Ray for Windows 'editor' menu contains a couple of macro recording 
options (though I've not used them myself).  If you need to do this with a 
large number of files you'd either want a short script to perform something 
like a 'grep' command (Unix style) or you could use an editor that supports 
a 'Replace in Files' sort of operation, eg UltraEdit, or the text editors in 
most IDEs.

Regards,
Chris B.


Post a reply to this message

From: Christian Froeschlin
Subject: Re: remap RGBT color to anther RGBT color?
Date: 11 Jul 2009 07:12:39
Message: <4a5873a7$1@news.povray.org>
caduser wrote:

> Just to be clear I did not write the materials or the objects I am an end user

Just out of curiosity: Does this mean your CAD program comes
with a POV-Ray export option built in?

As Chris has said, textually processing the generated sdl script
with an editor macro (or perl script or similar) is probably your
best option. Note that there is another way but it may be overkill:
The sources to POV-Ray are available and you can compile your own
binary. This, of course, could be patched to set a dark gray
internally whenever it parses "color rgbt <0.,0.,0.,0.>".


Post a reply to this message

From: caduser
Subject: Re: remap RGBT color to anther RGBT color?
Date: 11 Jul 2009 09:05:01
Message: <web.4a588d74bddeda84dbd439ba0@news.povray.org>
Christian Froeschlin <chr### [at] chrfrde> wrote:

> Just out of curiosity: Does this mean your CAD program comes
> with a POV-Ray export option built in?
Yes that is right it is one of our image output options.

> As Chris has said, textually processing the generated sdl script
> with an editor macro (or perl script or similar) is probably your
> best option.

So far I have been using a replace all batch but this was to test samples. The
program has 2 options one to output full size renders for use in print and
second to generate preview icons for browsing inside the application, this runs
it's own internal batch of generating a temp POV then rendering and can be run
on thousands of objects. If I have to edit them all I have to use the render
single image so I can uncheck start render and then keep all the POV files.


>Note that there is another way but it may be overkill:
> The sources to POV-Ray are available and you can compile your own
> binary. This, of course, could be patched to set a dark gray
> internally whenever it parses "color rgbt <0.,0.,0.,0.>".

hmm that might be interesting but how hard would that be?

It seems if there is a way it would be the material file not the inc file right?
When I tried my colleagues approach:

<%MATERIAL
texture {
    pigment
      {
          color rgbt <<%R%> * 0.8 + 0.2,<%G%> * 0.8 + 0.2,<%B%> * 0.8 +
0.2,<%A%>>

      }
It did work for Black but shifts every color if there was a way at this point to
just push one color value.
I also need to look more at the reflectivity discussed early see if I can make
Black reflect enough to not be pure black in the render.


Post a reply to this message

From: Chris B
Subject: Re: remap RGBT color to anther RGBT color?
Date: 11 Jul 2009 11:06:44
Message: <4a58aa84@news.povray.org>
"caduser" <nomail@nomail> wrote in message 
news:web.4a588d74bddeda84dbd439ba0@news.povray.org...
> It seems if there is a way it would be the material file not the inc file 
> right?
> When I tried my colleagues approach:
>
> <%MATERIAL
> texture {
>    pigment
>      {
>          color rgbt <<%R%> * 0.8 + 0.2,<%G%> * 0.8 + 0.2,<%B%> * 0.8 +
> 0.2,<%A%>>
>
>      }
> It did work for Black but shifts every color if there was a way at this 
> point to
> just push one color value.
> I also need to look more at the reflectivity discussed early see if I can 
> make
> Black reflect enough to not be pure black in the render.
>

So did you try the other suggestions for your 'material' file (min, max or 
clip)?
They would seem to be able to do exactly what you're asking for.


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: remap RGBT color to anther RGBT color?
Date: 11 Jul 2009 11:16:10
Message: <4a58acba@news.povray.org>
caduser wrote:
> Christian Froeschlin <chr### [at] chrfrde> wrote:
> 
>> Just out of curiosity: Does this mean your CAD program comes
>> with a POV-Ray export option built in?
> Yes that is right it is one of our image output options.
> 
>> As Chris has said, textually processing the generated sdl script
>> with an editor macro (or perl script or similar) is probably your
>> best option.
> 
> So far I have been using a replace all batch but this was to test samples. The
> program has 2 options one to output full size renders for use in print and
> second to generate preview icons for browsing inside the application, this runs
> it's own internal batch of generating a temp POV then rendering and can be run
> on thousands of objects. If I have to edit them all I have to use the render
> single image so I can uncheck start render and then keep all the POV files.

You can use a single-line sed call (in unix like operating systems
or wtih Cygwin in windows) to edit as many files you like in one go.

E.g. like this:

   sed -i 's/rgbt <0.,0.,0.,0.>/Gray20/' *.pov

Alse see:

   http://unixhelp.ed.ac.uk/CGI/man-cgi?sed
   http://www-h.eng.cam.ac.uk/help/tpl/unix/sed.html
   http://www.cygwin.com/

-- 
Tor Olav
http://subcube.com


Post a reply to this message

From: Christian Froeschlin
Subject: Re: remap RGBT color to anther RGBT color?
Date: 11 Jul 2009 18:17:38
Message: <4a590f82$1@news.povray.org>
Chris B wrote:
> 
> "caduser" <nomail@nomail> wrote in message 
> news:web.4a588d74bddeda84dbd439ba0@news.povray.org...
>> It seems if there is a way it would be the material file not the inc 
>> file right?
>> When I tried my colleagues approach:
>>
>> <%MATERIAL
>> texture {
>>    pigment
>>      {
>>          color rgbt <<%R%> * 0.8 + 0.2,<%G%> * 0.8 + 0.2,<%B%> * 0.8 +
>> 0.2,<%A%>>
>>
>>      }
>> It did work for Black but shifts every color if there was a way at 
>> this point to
>> just push one color value.
>> I also need to look more at the reflectivity discussed early see if I 
>> can make
>> Black reflect enough to not be pure black in the render.
>>
> 
> So did you try the other suggestions for your 'material' file (min, max 
> or clip)?
> They would seem to be able to do exactly what you're asking for.

I think he did not want to have colors change except pure Black/White.

However, if the above syntax allows you to configure the output then
it would seem you can insert arbitrary code into the SDL, e.g.,

<%MATERIAL
   texture {
     pigment {
       #local RED   = <%R%>;
       #local GREEN = <%G%>;
       #local BLUE  = <%B%>;
       #if (RED = 0 & GREEN = 0 & BLUE  = 0)
         #local RED   = 0.1;
         #local GREEN = 0.1;
         #local BLUE  = 0.1;
       #end
       #if (RED = 1 & GREEN = 1 & BLUE  = 1)
         #local RED   = 0.9;
         #local GREEN = 0.9;
         #local BLUE  = 0.9;
       #end
      color rgbt <RED, GREEN, BLUE, <%A%>>

      ...


Post a reply to this message

From: caduser
Subject: Re: remap RGBT color to anther RGBT color?
Date: 11 Jul 2009 20:35:00
Message: <web.4a592f0bbddeda84dbd439ba0@news.povray.org>
> Chris B wrote:

>
> I think he did not want to have colors change except pure Black/White.
>
> However, if the above syntax allows you to configure the output then
> it would seem you can insert arbitrary code into the SDL, e.g.,
>
> <%MATERIAL
>    texture {
>      pigment {
>        #local RED   = <%R%>;
>        #local GREEN = <%G%>;
>        #local BLUE  = <%B%>;
>        #if (RED = 0 & GREEN = 0 & BLUE  = 0)
>          #local RED   = 0.1;
>          #local GREEN = 0.1;
>          #local BLUE  = 0.1;
>        #end
>        #if (RED = 1 & GREEN = 1 & BLUE  = 1)
>          #local RED   = 0.9;
>          #local GREEN = 0.9;
>          #local BLUE  = 0.9;
>        #end
>       color rgbt <RED, GREEN, BLUE, <%A%>>
Christian Froeschlin <chr### [at] chrfrde> wrote:
> Chris B wrote:
> >
> > "caduser" <nomail@nomail> wrote in message
> > news:web.4a588d74bddeda84dbd439ba0@news.povray.org...
> >> It seems if there is a way it would be the material file not the inc
> >> file right?
> >> When I tried my colleagues approach:
> >>
> >> <%MATERIAL
> >> texture {
> >>    pigment
> >>      {
> >>          color rgbt <<%R%> * 0.8 + 0.2,<%G%> * 0.8 + 0.2,<%B%> * 0.8 +
> >> 0.2,<%A%>>
> >>
> >>      }
> >> It did work for Black but shifts every color if there was a way at
> >> this point to
> >> just push one color value.
> >> I also need to look more at the reflectivity discussed early see if I
> >> can make
> >> Black reflect enough to not be pure black in the render.
> >>
> >
> > So did you try the other suggestions for your 'material' file (min, max
> > or clip)?
> > They would seem to be able to do exactly what you're asking for.
>
> I think he did not want to have colors change except pure Black/White.
>
> However, if the above syntax allows you to configure the output then
> it would seem you can insert arbitrary code into the SDL, e.g.,
>
> <%MATERIAL
>    texture {
>      pigment {
>        #local RED   = <%R%>;
>        #local GREEN = <%G%>;
>        #local BLUE  = <%B%>;
>        #if (RED = 0 & GREEN = 0 & BLUE  = 0)
>          #local RED   = 0.1;
>          #local GREEN = 0.1;
>          #local BLUE  = 0.1;
>        #end
>        #if (RED = 1 & GREEN = 1 & BLUE  = 1)
>          #local RED   = 0.9;
>          #local GREEN = 0.9;
>          #local BLUE  = 0.9;
>        #end
>       color rgbt <RED, GREEN, BLUE, <%A%>>
>
>       ...

Thanks Chris I will try both the Min Max and this latest suggestion, the min max
still has an effect on all the mid colors but if I understand this one it seems
it may work. I will try it this week and see what I get.


>You can use a single-line sed call (in unix like operating systems
>or wtih Cygwin in windows) to edit as many files you like in one go.
>
>E.g. like this:
>
>   sed -i 's/rgbt <0.,0.,0.,0.>/Gray20/' *.pov

As for multiple replaces that is nt a problem I have plenty of script or even
neat utilities like PSPad that can handle that but I don't want to produce them
all as it prevents me using teh program own batch render mechanism.


Post a reply to this message

From: Alain
Subject: Re: remap RGBT color to anther RGBT color?
Date: 11 Jul 2009 21:54:13
Message: <4a594245$1@news.povray.org>

> Christian Froeschlin <chr### [at] chrfrde> wrote:
> 

> It did work for Black but shifts every color if there was a way at this point to
> just push one color value.
> I also need to look more at the reflectivity discussed early see if I can make
> Black reflect enough to not be pure black in the render.
> 
> 
If you only add something like:

reflection 0.1

in the finish part, and there is something not black to reflect, the 
surface will be reflective enough to not be completely black.

If you are using some HDRI emulation that relies on many lights, then 
the best way may be the use of phong or specular highlight.

You could add something like this:

#default{ finish{ specular 0.1 roughness 0.0001 }}
//small = tight highlights
OR
#default{ finish{ phong 0.1 phong_size 200 }}
//LARGE = tight highlights

that will add some light specular highlight to every texture that don't 
have any specular/phong deffined.
This method is faster than reflections, as you don't have to shoot any 
additional rays to find what to reflect.


Alain


Post a reply to this message

From: Chris B
Subject: Re: remap RGBT color to anther RGBT color?
Date: 12 Jul 2009 04:03:01
Message: <4a5998b5@news.povray.org>
"caduser" <nomail@nomail> wrote in message 
news:web.4a592f0bbddeda84dbd439ba0@news.povray.org...

> Christian Froeschlin <chr### [at] chrfrde> wrote:
>> Chris B wrote:
>> > They would seem to be able to do exactly what you're asking for.
>>
>> I think he did not want to have colors change except pure Black/White.
>>
>
> Thanks Chris I will try both the Min Max and this latest suggestion, the 
> min max
> still has an effect on all the mid colors but if I understand this one it 
> seems
> it may work. I will try it this week and see what I get.
>

If you use a small value then the number of mid colors is very small (and 
possibly 0). The 'clip' syntax suggested by clipka is probably the most 
succinct:

color rgbt 
<clip(<%R%>,0.00001,0.99999),clip(<%G%>,0.00001,0.99999),clip(<%B%>,0.00001,0.99999),<%A%>>

Otherwise the syntax that Christian posted should give you a very precise 
control over the values.

Chris B.


Post a reply to this message

<<< Previous 5 Messages Goto Initial 10 Messages

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