|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Alain Martel <kua### [at] videotronca> wrote:
>
> Another thing : As that scene use radiosity, you need to replace any
>
>
> reasonable value. Something in the 0.65..0.8 range.
Hi,
When using radiosity it's useful to include a big sphere and a ground plane,
each with no_image.
I also added some zeros to the y scale of the "shadow" to remove an artifact at
Bald Eagle's nice solution.
Norbert
// +fn +ua
#version 3.7;
#declare RAD = 4;
global_settings {
assumed_gamma 1
max_trace_level 5
noise_generator 2
#if (RAD > 0)
radiosity {
pretrace_start 0.08
pretrace_end 0.04/RAD
count 30*RAD
nearest_count min (20, RAD)
error_bound 2/RAD
low_error_factor 0.5
recursion_limit 1
gray_threshold 0
minimum_reuse 0.015
brightness 1
adc_bailout 0.005
normal on
media on
}
#end
}
camera {
location <0,5,-9>
look_at <0,0.65,0>
right x*image_width/image_height
angle 10
}
#declare LS = <5,15,-10>;
light_source {LS color rgb <1,0.96,0.9>}
#declare LS2 = -vnormalize (LS);
#declare ShadowTrans =
transform {
matrix <
1, 0, 0,
LS2.x, LS2.y, LS2.z
0, 0, 1,
0, 0, 0
>
}
#declare Object =
union {
cylinder {0, y, 0.05}
sphere {y, 0.25}
}
object {Object pigment {rgb 1} no_shadow}
object {
Object
transform {ShadowTrans}
scale <1,0.00001,1>
pigment {rgbt <0,0,0,0.5>}
}
plane {y, 0 pigment {color rgb 1} no_image}
sphere {
0, 1000
pigment {color rgb <0.3,0.4,0.7>}
no_image
}
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Norbert Kern" <nor### [at] t-onlinede> wrote:
> I also added some zeros to the y scale of the "shadow" to remove an artifact at
> Bald Eagle's nice solution.
Thanks Norbert,
I actually had quite a few zeros and removed them because I had an issue with
the "shadow" even showing up.
I am curious about the artifact (was that at the connection of the sphere and
cylinder? That's why I switched from union {} to merge {}, to minimize that).
I also just deleted a bunch of stuff about the results of your scene, because:
It looks like _total_ crap in my qtpovray render window.
It looks pretty nice in my directory preview window, when I went to attach it -
it has a very light gray background.
It looks great, but different still, when I open the actual file and view the
result, where it has a very dark gray background.
Hmmmm.....
Thanks,
Bill
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Bald Eagle" <cre### [at] netscapenet> wrote:
>
> ... a quick and dirty cheat like this works:
>
> Take your object(s) and put all of the parts in a merge.
> Define a vector location LS for your light source.
> Define a second vector location LS2 that is -vnormalize(LS) so that it is
> mirrored across the origin.
> Define a matrix transform with LS2 as your new y basis vector.
> Put your object in the scene with the no_shadow keyword.
>
> Put your object in the scene again, apply the matrix transform, and scale it
> really small in the y direction, and apply your semi-transparent texture
> to it.
> [code]
> > I also added some zeros to the y scale of the "shadow" to remove an
> > artifact at Bald Eagle's nice solution.
> > > [Norbert Kern's follow-up code]
>
> Thanks Norbert,
>
> I actually had quite a few zeros and removed them because I had an issue with
> the "shadow" even showing up.
>
> I am curious about the artifact (was that at the connection of the sphere and
> cylinder? That's why I switched from union {} to merge {}, to minimize that).
>
Playing with both versions of this interesting 'fake shadows' code... and
changing the mentioned y-scale to 0.001 (less zeros)...I see the strange
artifacts, which occur whether a union OR merge is used. I think the
semi-transparent texture of the 'matrix object' is *partly* to blame...
pigment{rgbt <0,0,0,.5>}
.... as it naturally shows the various object surfaces where they interconnect.
But I'm mostly curious as to just what the additional y-SCALING is for, and why
it solves the problem-- and why it is SO sensitive to the particular tiny scale
that is used (the number of zeros). I'm obviously not grasping why y needs any
scaling at all.
From experimenting, a y-scale of simply 1.0 shifts the matrix-object to a
completely different orientation(!), which I don't understand. And a y-scale of
0.000001 makes the object disappear, as mentioned. I would have assumed that the
matrix transform *by itself* would have been enough to shear the 'shadow object'
correctly, in concert with the -vnormalize(...) trick-- no additional scaling
required.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Kenneth" <kdw### [at] gmailcom> wrote:
Hi Kenneth,
Hope you're enjoying that sweet Virginia heat... ;)
> But I'm mostly curious as to just what the additional y-SCALING is for, and why
> it solves the problem-- and why it is SO sensitive to the particular tiny scale
> that is used (the number of zeros). I'm obviously not grasping why y needs any
> scaling at all.
> From experimenting, a y-scale of simply 1.0 shifts the matrix-object to a
> completely different orientation(!), which I don't understand. And a y-scale of
> 0.000001 makes the object disappear, as mentioned. I would have assumed that the
> matrix transform *by itself* would have been enough to shear the 'shadow object'
> correctly, in concert with the -vnormalize(...) trick-- no additional scaling
> required.
So, my example was just a quick and dirty proof of concept, so there are no
bells, whistles, sanity checks, or other things to flesh out the code for
robustness - meaning that it probably only works correctly if you understand why
it works in the first place.
If you are trying this with an object not at/on the origin, you'll probably get
some very strange results.
Let's suppose you have a cube. You shine a light on it from somewhere high up
and in front of the cube. The shadowed region created would look like a slanted
version of the cube - a parallelpiped. The angle of that is dependent upon a
vector between the object and the light source (playing fast and loose here).
The top & front of the cube is lit, and the back and bottom is in shadow. Since
the idea here is to use the object itself to create the fake shadow object, we
need to deform it, to sort of fold it down flat to meet the ground plane.
Let's say the cube is a cardboard box, and you cut off the sides to make a
square cardboard tube. You can now push the box back and down with a "racking
force" to rotate the tube into an increasingly oblique/eccentric parallelogram
until you flatten it out on the ground. Actual location of the light being
ignored for the sake of simplicity, that would be your shadow.
So how do we get that with something complicated and virtual?
Let's say the cube's back side is at z=0, and the light source is at some -z, +y
location. The direction / location of the thing we need to make the shadow of
is in the +z, -y location. (think: object {Cube rotate x*180} )
But now that's just a copy of the object that is underneath where the shadow
would be, so we need to scale it very small in y to get the flattened shadow
version that we want.
I have some things to do today, and the coffee needs to percolate in, but in
describing this all, I see where a problem or two might lie, and how to fix
them.
I think the shadow image should probably be scaled in -y in order to flip it
onto the same side of the ground plane, then it won't disappear.
Perhaps a completely different shear transform would allow an object pigment
pattern to be used as the top of a layered texture to shadow a complex 3D shadow
region instead of just the simple plane version I came up with off-the-cuff.
Hope that helps (?)
- The Northern Walker
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Op 28-8-2021 om 15:24 schreef Bald Eagle:
> "Kenneth" <kdw### [at] gmailcom> wrote:
>
> Hi Kenneth,
>
> Hope you're enjoying that sweet Virginia heat... ;)
>
[snip]
> - The Northern Walker
>
Out of topic, but I could not stop myself :-)
Those would be nice aliases for both of you:
"The Northern Walker" and "The Southern Walker"
--
Thomas
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Bald Eagle" <cre### [at] netscapenet> wrote:
>
> ...the idea here is to use the object itself to create the fake shadow
> object, we need to deform it, to sort of fold it down flat to meet the ground
> plane.
> [snip] ...so we need to scale it very small in y to get the flattened shadow
> version that we want.
>
The ground plane? As in, horizontal?
Oh!!! [*** slaps forehead, and kicks self in butt**]
So the matrix-oriented object is horizontal! Or more precisely (using a y-scale
of plain old 1.0 for starters) that object is now aligned along the light's
direction vector, but 'flipped' through the origin and sheared a bit, thanks to
the -vnormalize vector and the matrix itself...and because y is your 'basis
vector' for the matrix. It's all suddenly clear to me-- one of those 'eureka'
moments. Thanks!
We Southern Walkers can be a bit slow-witted at times :-P
I originally thought the matrix object was still vertical(!) but simply sheared
left and down-- which is why I couldn't understand why it should be scaled in y.
The camera view and angle fooled me. But now the tiny y-scaling makes perfect
sense-- not only to 'flatten' the object, but to bring that flatness into very
close parallelism with the x/z plane, to look like a correctly-placed shadow.
I added a few different cameras/positions to see what was going on, and did some
simple animations while changing the scale. Very interesting! There is actually
a small *range* of y-scalings that gets rid of the intersecting-surface
artifacts, before the object completely disappears (which itself must be a
precision issue.) I'm thinking that if the object was made 100-1000 times
larger, rather than just 1-unit tall, the y-scale would probably not need to
be so exacting.
BTW, I eliminated the ground-plane object; it doesn't seem to serve a purpose,
and kind of gets in the way.
The one thing that still puzzles me is *why* the smaller and smaller y-scale
eliminates those intersecting-surface artifacts; seems that they should still be
there no matter how tiny the scaling is. Perhaps the happy result of a precision
issue again?
I also tried an 'object pattern' for the shadow (no matrix needed,
just the negative vnormalize trick): I pasted its created pigment on the front
of a vertical box, then aligned/rotated the box using
Point_At_Trans(<LS2.x,0,LS2.z> It works, sort of...but the object-pattern
operation is a bit odd (or rather, unexpected)-- the pattern seems to be derived
from an infinitely thin slice of its object in the x/y (?) plane-- which leaves
out any parts that do not overlap that plane:
#declare OBJ_PATTERN =
pigment{
object{Object
// translate (-.35 + .65*clock)*z // experiment
color rgb .2
color rgb .5*<.3,1,.3>
}
}
#include "transforms.inc"
box{<-.7,-.4,0>,<.7,1.6,.01> // vertical box centered on x-axis
texture{pigment{OBJ_PATTERN} finish{ambient 1 emission 0 diffuse 0}}
Point_At_Trans(<LS2.x,0,LS2.z>)
no_shadow
}
Post a reply to this message
Attachments:
Download 'fake_shadow_comp_kw.jpg' (528 KB)
Preview of image 'fake_shadow_comp_kw.jpg'
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Kenneth" <kdw### [at] gmailcom> wrote:
>
>
> I also tried an 'object pattern' for the shadow (no matrix needed,
> just the negative vnormalize trick): I pasted its created pigment on the front
> of a vertical box, then aligned/rotated the box using
> Point_At_Trans(<LS2.x,0,LS2.z> It works, sort of...but the object-pattern
> operation is a bit odd (or rather, unexpected)-- the pattern seems to be derived
> from an infinitely thin slice of its object in the x/y (?) plane-- which leaves
> out any parts that do not overlap that plane:
>
Hmm, I was wrong about the object pattern itself-- it *is* actually a
3D/volumetric pattern, of the entire object given to it. That's rather neat! But
the box object that I 'projected' the pattern onto happened to have its front
surface exactly along the x/y plane (before I rotated it), so that's the only
'slice' of the pattern visible as the 'shadow.'
So I attempted to 'squash' the object pattern in z by scaling it-- to try and
get a more complete representation of the original object as the 'shadow'-- but
that produced no useful result. Seems that an 'infinitely thin' box surface
would require an infinitely-tiny depth-scaling of the object pattern, for the
*entire* object to show up there.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Kenneth" <kdw### [at] gmailcom> wrote:
> Hmm, I was wrong about the object pattern itself-- it *is* actually a
> 3D/volumetric pattern, of the entire object given to it. That's rather neat!
Right. Essentially, POV-Ray just checks to see if the ray intersection point is
inside the object, and gives it the appropriate texturing.
http://www.f-lohmueller.de/pov_tut/tex/tex_560e.htm
> But
> the box object that I 'projected' the pattern onto happened to have its front
> surface exactly along the x/y plane (before I rotated it), so that's the only
> 'slice' of the pattern visible as the 'shadow.'
>
> So I attempted to 'squash' the object pattern in z by scaling it-- to try and
> get a more complete representation of the original object as the 'shadow'-- but
> that produced no useful result. Seems that an 'infinitely thin' box surface
> would require an infinitely-tiny depth-scaling of the object pattern, for the
> *entire* object to show up there.
What you can do is take the object and make it into an isosurface, then use that
function like: function {Object (x, y, 0)} which will scale the object
infinitely in the z direction.
But wait - there's more!
Now use that function in a pigment pattern, and you get a silhouette (shadow) of
the object.
Easy to do for cardinal axis aligned shadows, takes a little bit more to do
off-axis either by pre-rotating the object and then rotating the pattern back,
or maybe by doing some vector normal to a plane type stuff...
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> What you can do is take the object and make it into an isosurface, then use that
> function like: function {Object (x, y, 0)} which will scale the object
> infinitely in the z direction.
> But wait - there's more!
> Now use that function in a pigment pattern, and you get a silhouette (shadow) of
> the object.
>
> Easy to do for cardinal axis aligned shadows, takes a little bit more to do
> off-axis either by pre-rotating the object and then rotating the pattern back,
> or maybe by doing some vector normal to a plane type stuff...
>
The problem with that option is the infinite gradient because the
function returns only zero or one.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Bald Eagle" <cre### [at] netscapenet> wrote:
>
> What you can do is take the object and make it into an isosurface, then use that
> function like: function {Object (x, y, 0)} which will scale the object
> infinitely in the z direction.
> But wait - there's more!
> Now use that function in a pigment pattern, and you get a silhouette (shadow) of
> the object.
>
Very cool stuff! I'm going to try out those ideas.
The 'object pattern' is a feature that I've almost never played with, if I
recall-- mainly because the docs give a very cursory explanation of what it
is/does, and also because I didn't truly grasp its usefulness from POV-ray's
example scene file. But it's a powerful feature, as I'm finding out. I've
actually been up all night (...yawn...) putting it to a *really* interesting
use, heh heh. That's off-topic here, but I plan to post about my idea very soon.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|