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:37 EDT (-0400)
  Re: POVMan Q: Coordinate transforms in shaders.  
From: Vahur Krouverk
Date: 12 Jul 2001 14:18:32
Message: <3B4DEAA3.932A93DC@comtrade.ee>
Michael Andrews wrote:
> 
> Hi Vahur,
> 
> Thanks for your posts; I think they cleared up my thinking a little :-)

Good!
 
> 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.

Hmm, as I wrote, transforms do not work for warp shader and this means,
that Axis is probably not expected one. But as long as it works and
produces expected output, it could be left as it is (I hope that in
future I can make it work).
 
> 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 ...

Actually, already warp code misses intersection information (normal is
field in intersection structure). It is possible to pass down
intersection information to warp code and from it to shader, but this
requires probably quite big modifications in source code. I decided to
wait for version 3.5 of POV-Ray before making big source code changes to
avoid additional work with source update, although if this is not big
change and I get before v. 3.5 something releasable ready, then I could
include this feature as well.

> 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 ...

Hmm, I'm not sure, that I follow this idea. Unless this point happens to
lay exactly in surface of object, there is no way to find color for
given point in space. And even if it lays on surface, then resulting
color will still depend from point of view for non-trivial textures
(reflections, diffuse etc. for given point change with camera position
changes).
But POVMan supports shader's function 
color trace(point from; vector dir) 
by tracing ray from given point in given direction and returning
resulting colour. Is this what you meant?

Vahur


Post a reply to this message

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