POV-Ray : Newsgroups : povray.advanced-users : multipigment surface Server Time
31 Oct 2024 21:27:42 EDT (-0400)
  multipigment surface (Message 1 to 10 of 11)  
Goto Latest 10 Messages Next 1 Messages >>>
From: PC John
Subject: multipigment surface
Date: 28 Jul 2011 07:50:01
Message: <web.4e314bd9a2633e0d5d9babcb0@news.povray.org>
Hello,

I have written pov-exporter for OpenSceneGraph rendering and visualization
library. It generates quite COOL results. However, I have one problem:

It seems like POV-Ray is not capable of handling OpenGL materials as it uses
just one pigment. It is even not possible to implement OpenGL texture MODULATE
mode, e.g. image (called texture in OpenGL) multiplied by the result of the
lighting that is performed on surface pigment (called material in OpenGL).

To simplify the things, I want to have one pigment for OpenGL emissive color and
another pigment for OpenGL diffuse color. POV-Ray should compute the lighting on
both of them and the final color would be sum of these. Is it possible to do
this in POV-Ray?

Thanks,
John


Post a reply to this message

From: Le Forgeron
Subject: Re: multipigment surface
Date: 28 Jul 2011 10:14:51
Message: <4e316edb$1@news.povray.org>
Le 28/07/2011 13:45, PC John nous fit lire :
> Hello,
> 
> I have written pov-exporter for OpenSceneGraph rendering and visualization
> library. It generates quite COOL results. However, I have one problem:
> 
> It seems like POV-Ray is not capable of handling OpenGL materials as it uses
> just one pigment. It is even not possible to implement OpenGL texture MODULATE
> mode, e.g. image (called texture in OpenGL) multiplied by the result of the
> lighting that is performed on surface pigment (called material in OpenGL).

I do not get it... (ambient 0 diffuse 1) is what would perform this
computation (but you might want also to play with the options of
light_source such as fade_power and fade_distance

> http://wiki.povray.org/content/Documentation:Reference_Section_4.3#Light_Sources



> 
> To simplify the things, I want to have one pigment for OpenGL emissive color and
> another pigment for OpenGL diffuse color. POV-Ray should compute the lighting on
> both of them and the final color would be sum of these. Is it possible to do
> this in POV-Ray?

If I get it correctly:
OpenGL     povray
=========+=========
emissive | ambient
diffuse  | diffuse

To perform a sum, use the average pigment with relevant map

> http://wiki.povray.org/content/Documentation:Reference_Section_5.3#Average


Post a reply to this message

From: PC John
Subject: Re: multipigment surface
Date: 28 Jul 2011 15:30:01
Message: <web.4e31b79533486a128a2333330@news.povray.org>
> > To simplify the things, I want to have one pigment for OpenGL
> > emissive color and another pigment for OpenGL diffuse color.
> > POV-Ray should compute the lighting on both of them and the
> > final color would be sum of these. Is it possible to do
> > this in POV-Ray?
>
> If I get it correctly:
> OpenGL     povray
> =========+=========
> emissive | ambient
> diffuse  | diffuse
>
> To perform a sum, use the average pigment with relevant map
>
> > http://wiki.povray.org/content/Documentation:Reference_Section_5.3#Average

Things are more difficult:

OpenGL           povray
===============+================
ambient  COLOR | ambient  COLOR
diffuse  COLOR | diffuse  float
specular COLOR | specular float
emission COLOR | (no equivalent, but can be emulated by ambient)

In OpenGL, ambient color is real color used for the computation of ambient light
contribution to the final color, while ambient on povray side is just pigment
filter.

In OpenGL diffuse, specular and emission are all colors that can be completely
different colors while povray's diffuse and specular is just float multiplying
pigment color.

As a result, OpenGL allows to specify for example blue diffuse color - e.g.
object is blue when lit by the light coming from the scene, and red ambient
light (e.g. surface shines red, provided that there is global ambient light in
the scene).

You may wonder why I need this, but it would allow to correctly show all the
models that are used in OpenSceneGraph, OpenGL, DirectX, and real-time graphics
in general.

Thanks for any good advice,
John


Post a reply to this message

From: Zeger Knaepen
Subject: Re: multipigment surface
Date: 28 Jul 2011 18:25:01
Message: <4e31e1bd@news.povray.org>
On 28/07/2011 21:25, PC John wrote:
> Things are more difficult:

only if you want it :)

> OpenGL           povray
> ===============+================
> ambient  COLOR | ambient  COLOR
> diffuse  COLOR | diffuse  float
> specular COLOR | specular float
> emission COLOR | (no equivalent, but can be emulated by ambient)

texture {
   average
   texture_map {
     //ambient
     [1
       pigment {[ambient pigment with all colors * 4]}
       finish {diffuse 0 ambient 1}
     ]
     //diffuse
     [1
       pigment {[diffuse pigment with all colors * 4]}
       finish {diffuse 1 ambient 0}
     ]
     //specular
     [1
       pigment {[specular pigment with all colors * 4]}
       finish {diffuse 0 ambient 0 specular 1 metallic}
     ]
     //emission
     [1
       pigment {[emission pigment with all colors * 4]}
       finish {diffuse 0 ambient 0 emission 1}
     ]
   }
}

didn't test it, but I believe this should do the trick


Post a reply to this message

From: Patrick Elliott
Subject: Re: multipigment surface
Date: 28 Jul 2011 19:13:06
Message: <4e31ed02$1@news.povray.org>
On 7/28/2011 12:25 PM, PC John wrote:
>>> To simplify the things, I want to have one pigment for OpenGL
>>> emissive color and another pigment for OpenGL diffuse color.
>>> POV-Ray should compute the lighting on both of them and the
>>> final color would be sum of these. Is it possible to do
>>> this in POV-Ray?
>>
>> If I get it correctly:
>> OpenGL     povray
>> =========+=========
>> emissive | ambient
>> diffuse  | diffuse
>>
>> To perform a sum, use the average pigment with relevant map
>>
>>> http://wiki.povray.org/content/Documentation:Reference_Section_5.3#Average
>
> Things are more difficult:
>
> OpenGL           povray
> ===============+================
> ambient  COLOR | ambient  COLOR
> diffuse  COLOR | diffuse  float
> specular COLOR | specular float
> emission COLOR | (no equivalent, but can be emulated by ambient)
>
> In OpenGL, ambient color is real color used for the computation of ambient light
> contribution to the final color, while ambient on povray side is just pigment
> filter.
>
> In OpenGL diffuse, specular and emission are all colors that can be completely
> different colors while povray's diffuse and specular is just float multiplying
> pigment color.
>
> As a result, OpenGL allows to specify for example blue diffuse color - e.g.
> object is blue when lit by the light coming from the scene, and red ambient
> light (e.g. surface shines red, provided that there is global ambient light in
> the scene).
>
> You may wonder why I need this, but it would allow to correctly show all the
> models that are used in OpenSceneGraph, OpenGL, DirectX, and real-time graphics
> in general.
>
> Thanks for any good advice,
> John
>
>
Hmm. This may be a kind of interesting point. Not sure if such exists, 
but its not completely improbable that an objects optical properties 
would cause its "reflective" color to be slightly different than its 
real one, like red, when looked at directly, but say, blue when seeing 
the diffuse/specular results. Maybe the odd paint they make that seems 
to change color, by angle, as an example, where its the reflected light 
that determines that?


Post a reply to this message

From: Zeger Knaepen
Subject: Re: multipigment surface
Date: 28 Jul 2011 19:46:09
Message: <4e31f4c1$1@news.povray.org>
On 29/07/2011 0:25, Zeger Knaepen wrote:
> On 28/07/2011 21:25, PC John wrote:
> didn't test it, but I believe this should do the trick

just tested it, seems to me like it works, but it would actually be 
easier to do:

texture {
   average
   texture_map {
     //ambient
     [1
       pigment {[ambient pigment]}
       finish {diffuse 0 ambient 4}
     ]
     //diffuse
     [1
       pigment {[diffuse pigment]}
       finish {diffuse 4 ambient 0}
     ]
     //specular
     [1
       pigment {[specular pigment]}
       finish {diffuse 0 ambient 0 specular 4 metallic}
     ]
     //emission
     [1
       pigment {[emission pigment]}
       finish {diffuse 0 ambient 0 emission 4}
     ]
   }
}


Post a reply to this message

From: Alain
Subject: Re: multipigment surface
Date: 29 Jul 2011 17:36:14
Message: <4e3327ce@news.povray.org>

>>> To simplify the things, I want to have one pigment for OpenGL
>>> emissive color and another pigment for OpenGL diffuse color.
>>> POV-Ray should compute the lighting on both of them and the
>>> final color would be sum of these. Is it possible to do
>>> this in POV-Ray?
>>
>> If I get it correctly:
>> OpenGL     povray
>> =========+=========
>> emissive | ambient
>> diffuse  | diffuse
>>
>> To perform a sum, use the average pigment with relevant map
>>
>>> http://wiki.povray.org/content/Documentation:Reference_Section_5.3#Average
>
> Things are more difficult:
>
> OpenGL           povray
> ===============+================
> ambient  COLOR | ambient  COLOR
> diffuse  COLOR | diffuse  float
> specular COLOR | specular float
> emission COLOR | (no equivalent, but can be emulated by ambient)

Add this in your global_settings block:
ambient_lights Ambient_COLOR

Now, any ambient component of your finish will be MULTIPLYED by that 
value. it will effectively colour the shadowed areas. With version 3.7, 
it will be disabled in a radiosity scene.

For your diffuse modification you can:
1 - precompute the desired pigment OR
2 - use layered pigments with a plain filtering pigment of the desired 
colour over your base texture.

If you add metallic to your finish, the specular highlights will be 
coloured with the pigment. You can use a float after metallic to adjust 
that colouring.

Use POV-Ray 3.7. It have an emission COLOR component for your finish.

>
> In OpenGL, ambient color is real color used for the computation of ambient light
> contribution to the final color, while ambient on povray side is just pigment
> filter.
>
> In OpenGL diffuse, specular and emission are all colors that can be completely
> different colors while povray's diffuse and specular is just float multiplying
> pigment color.
>
> As a result, OpenGL allows to specify for example blue diffuse color - e.g.
> object is blue when lit by the light coming from the scene, and red ambient
> light (e.g. surface shines red, provided that there is global ambient light in
> the scene).
>
> You may wonder why I need this, but it would allow to correctly show all the
> models that are used in OpenSceneGraph, OpenGL, DirectX, and real-time graphics
> in general.
>
> Thanks for any good advice,
> John
>
>

Just remember that those separated components are there to get faster 
real time graphics at the cost of geting away from actual physicaly 
correct lighting.


Post a reply to this message

From: Alain
Subject: Re: multipigment surface
Date: 29 Jul 2011 17:46:35
Message: <4e332a3b$1@news.povray.org>

> On 7/28/2011 12:25 PM, PC John wrote:
>>>> To simplify the things, I want to have one pigment for OpenGL
>>>> emissive color and another pigment for OpenGL diffuse color.
>>>> POV-Ray should compute the lighting on both of them and the
>>>> final color would be sum of these. Is it possible to do
>>>> this in POV-Ray?
>>>
>>> If I get it correctly:
>>> OpenGL povray
>>> =========+=========
>>> emissive | ambient
>>> diffuse | diffuse
>>>
>>> To perform a sum, use the average pigment with relevant map
>>>
>>>> http://wiki.povray.org/content/Documentation:Reference_Section_5.3#Average
>>>>
>>
>> Things are more difficult:
>>
>> OpenGL povray
>> ===============+================
>> ambient COLOR | ambient COLOR
>> diffuse COLOR | diffuse float
>> specular COLOR | specular float
>> emission COLOR | (no equivalent, but can be emulated by ambient)
>>
>> In OpenGL, ambient color is real color used for the computation of
>> ambient light
>> contribution to the final color, while ambient on povray side is just
>> pigment
>> filter.
>>
>> In OpenGL diffuse, specular and emission are all colors that can be
>> completely
>> different colors while povray's diffuse and specular is just float
>> multiplying
>> pigment color.
>>
>> As a result, OpenGL allows to specify for example blue diffuse color -
>> e.g.
>> object is blue when lit by the light coming from the scene, and red
>> ambient
>> light (e.g. surface shines red, provided that there is global ambient
>> light in
>> the scene).
>>
>> You may wonder why I need this, but it would allow to correctly show
>> all the
>> models that are used in OpenSceneGraph, OpenGL, DirectX, and real-time
>> graphics
>> in general.
>>
>> Thanks for any good advice,
>> John
>>
>>
> Hmm. This may be a kind of interesting point. Not sure if such exists,
> but its not completely improbable that an objects optical properties
> would cause its "reflective" color to be slightly different than its
> real one, like red, when looked at directly, but say, blue when seeing
> the diffuse/specular results. Maybe the odd paint they make that seems
> to change color, by angle, as an example, where its the reflected light
> that determines that?

You can use the aoi pattern.
You can greatly alter the appearance of a surface just by changing it's 
brilliance value.
You can add some reflection, and make it variable relative to the 
incident angle, or make it coloured:
reflection{color, color [fresnel] [metallic float] [exponent float] 
[falloff float]}

This is a VALID reflection statement:

reflection{rgb<1, 0.5, 0.1> rgb<0, 0.2, 1>}

It will reflect orange when viewed perpendicularly, and greenish blue 
when viewed tengentialy.



Alain


Post a reply to this message

From: PC John
Subject: Re: multipigment surface
Date: 2 Aug 2011 09:05:00
Message: <web.4e37f54333486a122fb8b12b0@news.povray.org>
Zeger Knaepen <zeg### [at] povplacecom> wrote:
> just tested it, seems to me like it works, but it would actually be
> easier to do:
>
> texture {
>    average
>    texture_map {
>      //ambient
>      [1
>        pigment {[ambient pigment]}
>        finish {diffuse 0 ambient 4}
>      ]
>      [....]
>    }
> }

Thanks! This average is exactly what I was looking for. Cool!

Is there a way to combine the "average result" with the uvmapping pigment? All I
want is to multiply them.

To give an example, if the computation of "average pattern" computes < 0.5, 0.5,
0.5 >, e.g. grey (50% white), multiplication with uvmapping pigment would result
in 50% intensity of the image mapped on an object.

If "average pattern" returns < 1, 0, 0 >, multiplication with uvmapping pigment
would return image filtered by red color.

Thanks,
John


Post a reply to this message

From: Christian Froeschlin
Subject: Re: multipigment surface
Date: 2 Aug 2011 16:51:22
Message: <4e38634a$1@news.povray.org>
PC John wrote:

> Is there a way to combine the "average result" with the uvmapping pigment? All I
> want is to multiply them.

I'm not sure I fully understand your input data. Do you have the
uv-mapping pigment in addition to your other pigments? Otherwise
you can just use the uv-mapped pigment in the average.

If the pigments in the average are only intended as a filter for
some base pigment then you should probably make all your pigments in
the average use colors with filter 1 and then use layered textures
(if you assign two textures to an object the second will cover the
first, which only makes sense with some form of transparency).

However, layering textures sometimes does not work if the
individual textures are too complex.


Post a reply to this message

Goto Latest 10 Messages Next 1 Messages >>>

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