|
|
Gilles Tran wrote:
>
> Before I start tinkering with the shading language, I was wondering if
> it was possible, in the current implementation of shaders in Pov, to
> create a shader that would take an image_map. One immediate application
> would be to apply this wonderful "skin" shader to a body map on a Poser
> model...
> G.
Current version of POVMan does not support image maps. Shading Language,
as defined by Pixar, has function texture(), which allows to have
texture lookup from image file. I want to add support for this function
in the future, hopefully next year sometimes it will be available (in
order to support filtering (antialiasing) from image maps surface
derivatives should be implemented first).
But one possibility, which comes to my mind, is layered textures: create
one texture, which contains body map and sets base color. Then on top of
it modified skin shader, which calculates highlights only and adds them
to the base color. I haven't tested shaders with multiple textures and
there might be problems lurking around, but I guess that it might work.
If I have time, then I try it today evening...
Post a reply to this message
|
|
|
|
Vahur Krouverk wrote:
>
> Gilles Tran wrote:
> >
> > Before I start tinkering with the shading language, I was wondering if
> > it was possible, in the current implementation of shaders in Pov, to
> > create a shader that would take an image_map. One immediate application
> > would be to apply this wonderful "skin" shader to a body map on a Poser
> > model...
>
> But one possibility, which comes to my mind, is layered textures: create
> one texture, which contains body map and sets base color. Then on top of
> it modified skin shader, which calculates highlights only and adds them
> to the base color. I haven't tested shaders with multiple textures and
> there might be problems lurking around, but I guess that it might work.
> If I have time, then I try it today evening...
I tried to combine several layers for skin and it seems to work in a
limited way. I did following:
created skin material from 2 textures:
1. base texture (image map or some other texture), which calculates
ambient and diffuse lighting
2. skin texture, which uses shader for calculating reflection from
skin's oily layer on grazing angles and subsurface scattering ( here is
modified material from skin.pov example file from povman documentation).
===========8<===========
#declare Object1Material = material {
texture {
pigment {
// base pigment or image map for skin
}
finish {
ambient 0.2
diffuse 0.4
specular 0
roughness 0
}
}
texture {
pigment {
shader {
shader_file "skin.slp"
"As" <1,1,1>*0.4
"skinColor" SkinColor
}
}
finish {
ambient 1
diffuse 0
}
}
}
===========8<===========
Then I modified skin shader so, that it does not calculate ambient and
diffuse color (this comes from base texture). Here is shader part from
skin.sl, other functions in this file were unmodified:
===========8<===========
surface skin(color Ka = .5; color skinColor = color(.8, .5, .5);
color sheenColor = 1.;
float eta = 1./1.4, thickness = 0.5) {
normal Nn = faceforward(normalize(N), I);
vector Vf = -normalize(I);
Oi = Os;
Ci = subsurfaceSkin(Vf, Nn, skinColor, sheenColor, eta, thickness);
Oi = smoothstep(0, 1, comp(ctransform("hsv", Ci), 2) );
}
===========8<===========
Ci contains color from the subsurface scattering and reflection color.
Last line modifies opacity with respect to lightness of this color (Ci
is converted to hsv color space and then v is extracted from it). This
line needs probably tinkering in order to obtain good results and
seamless merging with base color. One possibility is to use splines for
better control of Oi value.
Unfortunately such approach is not very flexible and will probably fail
in cases, where base color varies in great degree, but skin color is
usually quite uniform in this respect.
Of course it would be good to have color value from previous texture
layer (or layers) available in shader, but current implementation does
not support this and I haven't checked, how easy/hard its implementation
would be. Additionally, if texture lookup in shader gets implemented,
then image map could be accessed from shader and there is no need for
combining several layers. But I put this in my ideas list, as it could
become handy in some situations.
Post a reply to this message
|
|
|
|
Vahur Krouverk wrote:
> Of course it would be good to have color value from previous texture
> layer (or layers) available in shader, but current implementation does
> not support this and I haven't checked, how easy/hard its implementation
> would be. Additionally, if texture lookup in shader gets implemented,
> then image map could be accessed from shader and there is no need for
> combining several layers. But I put this in my ideas list, as it could
> become handy in some situations.
Thanks a lot !!!
It's working very well indeed. All I need now is a "goosebumps" shader !
I'll post some test renders in a couple of days.
Gilles (who can read newsgroups again)
Post a reply to this message
|
|