POV-Ray : Newsgroups : povray.unofficial.patches : POVMan Q: Coordinate transforms in shaders. : Re: POVMan Q: Coordinate transforms in shaders. Server Time
6 Oct 2024 11:01:55 EDT (-0400)
  Re: POVMan Q: Coordinate transforms in shaders.  
From: Michael Andrews
Date: 12 Jul 2001 07:40:41
Message: <3B4D8DF3.C247127F@reading.ac.uk>
Hi Vahur,

Thanks for your posts; I think they cleared up my thinking a little :-)

I've changed the transforms, taking into account that P (and Ng?) are in
shader coords already. This gave me 

    P2 = PP = P;

    if (Type == 0){
        Axis = normalize(vtransform("world", "shader", vector(Dir)));
    }
    else if (Type == 1){
        Axis = normalize(vector(PP - transform("world", "shader",
Dir)));
    }
    else if (Type == 2){
        Axis = normalize(vector(Ng));
    }

which seems to work as I expected for types 0 and 1.

Is there any way to pass normal (Ng) down to a shader in warp code that
actually is working on a true surface, rather than say in an isosurface
pigment or media density? I guess probably not ...

I've been thinking about a couple of other things I can try too: can you
get the colour of a point at another position, ie point(P + V) where V
is a given vector? Hmmm ...

Thanks again,
	Mike Andrews.


Vahur Krouverk wrote:
> 
> I just started to think, that maybe shader transformations do not apply
> to warp at all and after tests this seems to be the case: I printed out
> value of P and all transformations for it return same value. P's value
> on input is in shader space. So it seems to be an explanation, why
> transformations do not work correctly: direction vector Dir is in world
> space, but P is in shader space and transformations from one space to
> other do not work.
> One possibility is to calculate direction vector in POV-Ray beforehand
> and supply to shader (note that translations should not be applied to
> calculate vector transformation, only rotations and scales). But with
> bigger number of objects it gets messy...
> Other option is to rewrite texture as 'true' surface shader.
> 
> I have to admit, that I'm not very much learned this warping code and
> can't say right now, whether it is possible to make it working as normal
> shaders (i.e. transformation matrices will be available). Time
> permitting, I try to explore it better and improve shader support or
> write better documentation for it.
> 
> Vahur


Post a reply to this message

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