POV-Ray : Newsgroups : povray.unofficial.patches : PoVMan Q: Shaders and displace warp? Server Time
1 Nov 2024 07:25:44 EDT (-0400)
  PoVMan Q: Shaders and displace warp? (Message 1 to 7 of 7)  
From: Michael Andrews
Subject: PoVMan Q: Shaders and displace warp?
Date: 26 Mar 2001 12:43:43
Message: <3ABF8052.3EC4DEA4@reading.ac.uk>
Hi Folks,

Vahur or Chris Huff may have the answer, but I'll make my question
general ...

I'm trying to use a shader as the control pigment for a displace warp,
ie

#declare swirl = pigment {
  shader{
    shader_file "swirl.slp"
    "Rot" 2
    "Power" 2
    "Dir" -z
  }
}

#declare pig_base = pigment { 
  crackle solid scale 0.4 
  colour_map {[0 rgb 0][1 rgb 1]} 
}

#declare pig_surface = pigment{ 
  pig_base
  warp { displace { swirl type 0 } }
}
 
plane{
  -z,0
  texture{
    pigment{ 
      pig_surface
    }
    finish{
      ambient 0.1
      diffuse 0.7
    }
  }
}

The shader compiles OK and when used as a pigment it gives something
close to what I would expect. I don't think it is quite right yet, but
close enough that I wanted to see what it did as a displace warp.

The PoV code parses OK and the render window appears (I'm using wpovman
0.71.3), but I then get a message "Rendering error. Pigment type 3 not
yet implemented" and the renderer stops. What I don't know is if this
message is given by the shader or by the displace warp code.

In the shader the only built in variables I'm using are P and Ci, so I
believe this should even work as a 'non-object' shader.

Any ideas out there as to why this doesn't work? If it would help I
could post the shader file as well ...

Bye for now,
	Mike Andrews.


Post a reply to this message

From: Christoph Hormann
Subject: Re: PoVMan Q: Shaders and displace warp?
Date: 26 Mar 2001 13:41:03
Message: <3ABF8D41.7326FD60@gmx.de>
Michael Andrews wrote:
> 
> [...]
> 
> The PoV code parses OK and the render window appears (I'm using wpovman
> 0.71.3), but I then get a message "Rendering error. Pigment type 3 not
> yet implemented" and the renderer stops. What I don't know is if this
> message is given by the shader or by the displace warp code.
> 

AFAIK this can only be generated by the shader, i don't know about such a
message in the warp code.

> In the shader the only built in variables I'm using are P and Ci, so I
> believe this should even work as a 'non-object' shader.
> 

If the shader works in an isosurface function, it should work in a
displace warp as well.  Vahur has added support for isosurface functions
recently, see:

Subject: POVMan 0.7 available
Date: Sun, 25 Feb 2001 18:12:14 +0200
From: Vahur Krouverk <vah### [at] aetecee>
Newsgroups: povray.unofficial.patches

Christoph

-- 
Christoph Hormann <chr### [at] gmxde>
IsoWood include, radiosity tutorial, TransSkin and other 
things on: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

From: Michael Andrews
Subject: Re: PoVMan Q: Shaders and displace warp?
Date: 27 Mar 2001 06:57:33
Message: <3AC080B3.7DF27B8E@reading.ac.uk>
Hi Christoph,

Thanks for the reply.

Christoph Hormann wrote:
> 
> Michael Andrews wrote:
> >
> > [...]
> >
> > The PoV code parses OK and the render window appears (I'm using wpovman
> > 0.71.3), but I then get a message "Rendering error. Pigment type 3 not
> > yet implemented" and the renderer stops. What I don't know is if this
> > message is given by the shader or by the displace warp code.
> >
> 
> AFAIK this can only be generated by the shader, i don't know about such a
> message in the warp code.
> 

OK, I'd started to think this, too.

> > In the shader the only built in variables I'm using are P and Ci, so I
> > believe this should even work as a 'non-object' shader.
> >
> 
> If the shader works in an isosurface function, it should work in a
> displace warp as well.  Vahur has added support for isosurface functions
> recently, see:
> 

Right, I made the declaration and return modifications (made it return
the length of the calculated displacement vector) and it worked fine.

On further testing I've found that the shader pigment will exit with the
same error when I use it in a pigment_map statement, as soon as the
renderer hits the shaded object. This may help to track the problem?

> Subject: POVMan 0.7 available
> Date: Sun, 25 Feb 2001 18:12:14 +0200
> From: Vahur Krouverk <vah### [at] aetecee>
> Newsgroups: povray.unofficial.patches
> 
> Christoph
> 
> --
> Christoph Hormann <chr### [at] gmxde>
> IsoWood include, radiosity tutorial, TransSkin and other
> things on: http://www.schunter.etc.tu-bs.de/~chris/

I'll post an example image using the shader as a pigment ...

Bye for now,
	Mike Andrews.


Post a reply to this message

From: Vahur Krouverk
Subject: Re: PoVMan Q: Shaders and displace warp?
Date: 2 Apr 2001 10:34:48
Message: <3AC88E42.E920E535@aetec.ee>
Michael Andrews wrote:
> 
> 
> The PoV code parses OK and the render window appears (I'm using wpovman
> 0.71.3), but I then get a message "Rendering error. Pigment type 3 not
> yet implemented" and the renderer stops. What I don't know is if this
> message is given by the shader or by the displace warp code.

This message comes from pigment calculation routine (Compute_Pigment
function).

> Any ideas out there as to why this doesn't work? If it would help I
> could post the shader file as well ...

I've repeated this behaviour, so provided information is sufficient.
When I have time, then I'll look at it. I've not tested shaders in
complex textures, so this might be quite easily oversight from my part.

With regards, 
Vahur


Post a reply to this message

From: Michael Andrews
Subject: Re: PoVMan Q: Shaders and displace warp?
Date: 2 Apr 2001 12:50:58
Message: <3AC8AE93.8AAE8680@reading.ac.uk>
Hi Vahur,

I had a look at the code over the weekend as well.

The problem is that although the three calls to Compute_Pigment in
lighting.c were changed to call Compute_Pigment2, complex pigments,
rainbows, skyspheres, fog, isosurface pigment function, media and
displace_warp (whew! I think that's all - this is from memory) still
call Compute_Pigment.

So, what I did was make a modified compile where I updated all the
instances of Compute_Pigment and Do_Average_Pigments (and a couple of
other functions I can't remember) to have the same extra parameters as
Compute_Pigment2, added the shader execution to the switch in
Compute_Pigment and changed references to Compute_Pigment2 back to
Compute_Pigment. I think that was all. Then you could use shaders
anywhere a normal pigment could be used. Of course, in many of the
calling places there is no knowledge of the normals or the incoming ray
so most of the calls have NULLs in the extra slots.

What I would like to do is work back up the function calling chain to
add the ray and normal information where it is available, so all the
physical effects should get the ray, surface applied warps also get
normal, etc. This should be possible in most cases I think (note all the
functions which call Compute_Pigment, add the extra parameters to the
function call, find the functions which call them, continue up the
chain). Quite a long process though.

Anyway, that's my progress so far.

Bye for now,
	Mike Andrews.

Vahur Krouverk wrote:
> 
> Michael Andrews wrote:
> >
> >
> > The PoV code parses OK and the render window appears (I'm using wpovman
> > 0.71.3), but I then get a message "Rendering error. Pigment type 3 not
> > yet implemented" and the renderer stops. What I don't know is if this
> > message is given by the shader or by the displace warp code.
> 
> This message comes from pigment calculation routine (Compute_Pigment
> function).
> 
> > Any ideas out there as to why this doesn't work? If it would help I
> > could post the shader file as well ...
> 
> I've repeated this behaviour, so provided information is sufficient.
> When I have time, then I'll look at it. I've not tested shaders in
> complex textures, so this might be quite easily oversight from my part.
> 
> With regards,
> Vahur


Post a reply to this message

From: Vahur Krouverk
Subject: Re: PoVMan Q: Shaders and displace warp?
Date: 3 Apr 2001 03:14:10
Message: <3AC97882.2DC4AD55@aetec.ee>
Michael Andrews wrote:
> 
> Hi Vahur,
> 
> I had a look at the code over the weekend as well.
> 
> The problem is that although the three calls to Compute_Pigment in
> lighting.c were changed to call Compute_Pigment2, complex pigments,
> rainbows, skyspheres, fog, isosurface pigment function, media and
> displace_warp (whew! I think that's all - this is from memory) still
> call Compute_Pigment.
> 

In POVMan there is 2 functions for pigment calculation: Compute_Pigment
and Compute_Pigment2. Second is for true pigments, first one is for
other (non-objects) and provides default values of missing parts for
shader. This way the number of source code modifications was kept
minimum.

The real problem is that when I merged POVMan with MegaPOV 0.7, I missed
shader call in Compute_Pigment for shader pigments: it was there, but as
with version 0.7 pigment.c file was considerably changed (mostly
different indentation, which resulted in diff file over 700 lines) and I
had little time, I made this omission.

Here is required addition to POVMan 0.7x in order to make it work again:
following lines should be added to function Compute_Pigment, after
BITMAP_PATTERN case:

#ifdef ShaderPatch
        case SHADER_PATTERN:
            if (Intersection != NULL){
                Exec_Shader(Pigment, Intersection, NULL,
Intersection->INormal, Colour, EPoint, 0);
	    }
            else{
                Exec_Shader(Pigment, NULL, NULL, NULL, Colour, EPoint,
0);
            }
            Colour_Found = TRUE;
            break;
#endif	

Of course better would be to modify source code, as You did it, but I'd
like to keep changes minimal so far, as MegaPov is in constant changing
state. If POV-Ray 3.5 is released, then perhaps I'll do it.

I hope, that  new version of POVMan with this correction will be soon
released (if Bouf agrees, then he will do it, otherwise I'll do it on
weekend).


Post a reply to this message

From: Christophe Bouffartigue
Subject: Re: PoVMan Q: Shaders and displace warp?
Date: 3 Apr 2001 03:37:00
Message: <3AC97D9C.C6E9E60E@nanterre.marelli.fr>
Vahur Krouverk wrote:
> 
> Here is required addition to POVMan 0.7x in order to make it work again:
> following lines should be added to function Compute_Pigment, after
> BITMAP_PATTERN case:
> 
> #ifdef ShaderPatch
>         case SHADER_PATTERN:
>             if (Intersection != NULL){
>                 Exec_Shader(Pigment, Intersection, NULL,
> Intersection->INormal, Colour, EPoint, 0);
>             }
>             else{
>                 Exec_Shader(Pigment, NULL, NULL, NULL, Colour, EPoint,
> 0);
>             }
>             Colour_Found = TRUE;
>             break;
> #endif
> 
> Of course better would be to modify source code, as You did it, but I'd
> like to keep changes minimal so far, as MegaPov is in constant changing
> state. If POV-Ray 3.5 is released, then perhaps I'll do it.
> 
> I hope, that  new version of POVMan with this correction will be soon
> released (if Bouf agrees, then he will do it, otherwise I'll do it on
> weekend).

I'll try to make it before this weekend.
I'll let you know when it's ready.

Bouf.


Post a reply to this message

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