Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shadows example looks weird #655

Open
cosw0t opened this issue May 20, 2020 · 7 comments
Open

Shadows example looks weird #655

cosw0t opened this issue May 20, 2020 · 7 comments

Comments

@cosw0t
Copy link

cosw0t commented May 20, 2020

Hi there!

I'm trying to run the Python Rendering/Shadows example with vtk8.1.0, on windows 10 (through anaconda3).

The result seems a bit odd to me. I can't understand where the rectangular shaded area comes from. What is casting that long straight shadow on the floor? It can't be from the sphere as a sphere would only cast oblong shadows.

the code is just as in master, the lights are at [0, 1, 0.2], and [1.0, 1.0, 1.0]

image

@ajpmaclean
Copy link
Collaborator

ajpmaclean commented May 20, 2020 via email

@cosw0t
Copy link
Author

cosw0t commented May 20, 2020

Hi Andrew, and thanks for replying to my issue.

I've place some spheres where the lights would be, and as you can see they are all above. I can't understand how the plane can cast a shadow on itself like that?

image

if i use the cow as you suggested (and I move both lights up by 1 unit, +[0, 1., 0.] i get this which also looks weird - and different from the image in https://lorensen.github.io/VTKExamples/site/Python/Rendering/Shadows/:

image

Finally, if i switch to vtk 8.2.0, the result is the following:
image
image

which is similar to the image in https://lorensen.github.io/VTKExamples/site/Python/Rendering/Shadows/
But why is the light not reaching all the way until the end of the plane?
And why is the behaviour so much different between v8.1.0 and 8.2.0? is there a hidden light somewhere?

thanks, Michele

@ajpmaclean
Copy link
Collaborator

ajpmaclean commented May 21, 2020

Look at ShadowsLightsDemo and you will see that the light is actually a frustum, hence the rectangular cross-section on the plane. I'll do a Python version of this soon. It will appear in the master but not on the web pages at this point in time.

If you use this as a plane source, you can see the illuminated rectangular areas quite clearly:

    plane = vtk.vtkPlaneSource()
    expand = 1
    x = bounds[1] - bounds[0] + (rnge[0] * expand)
    y = -0.5
    z = bounds[5] - bounds[4] + (rnge[2] * expand)

    plane.SetOrigin(-x, y, -z)
    plane.SetPoint1(x, y, -z)
    plane.SetPoint2(-x, y, z)
    plane.SetXResolution(100)
    plane.SetYResolution(100)

As to the differences between the versions of VTK this is to be expected since there is a process of continuous improvement going on. As you can see the VTK 8.2 rendering is much better than VTK 8.1. The VTK 9.0 rendering is even better.

Regards
Andrew

@ajpmaclean
Copy link
Collaborator

Here is a Python version of ShadowsLightsDemo : ShadowsLightsDemo.zip

Regards
Andrew

@cosw0t
Copy link
Author

cosw0t commented May 27, 2020

Hi Andrew, thanks for the explanation. Thanks also for the ShadowLightsDemo.

Yes i see the rectangular areas clearly. But why does the light frustum cover a smaller volume than the light cone?

In a similar way I notice in the ShadowLightsDemo that while the pyramid shown as frustum for white light embraces the whole expected cone volume, and does indeed reach large part of the plane, yet the plane is not illuminated entirely. Again the question is why the frustum doesn't embrace the whole cone, and why does it not match what the prop seem to show?

image

Thanks

@ajpmaclean
Copy link
Collaborator

I cam answer that, it is probably best if you ask on the VTK Discourse forum.

@cosw0t
Copy link
Author

cosw0t commented May 28, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants