Shadows acting weird

Udart's picture

So I've been playing around with some simple objects cubes mainly, trying to get them to cast shadows on each other. Doesn't always look too realistic but hey better than nothing...

But I am really lacking some sort of cone lighting / spot light and I thought I could create a mesh and punch a whole in it - place it between the light and my objects and get a nice light fall off.

But then weirdness starts to happen. Have a look here. try enabling and disabling the 'hole mask' mesh.

Sigh... Any ideas on how to get cast shadows and a cone light effect?

PreviewAttachmentSize
hole shadow example.qtz31.28 KB

Udart's picture
Re: Shadows acting weird

I've been reading around and I know all this shadow business is a tricky thing. But let me know if you have any work arounds....

cybero's picture
Re: Shadows acting weird

Define weirdness please :-).

See attached, which also exemplifies what I think is part of best practice for handing around a problem or solution in QC, especially when involving external assets.

I don't have your model to work with but have bundled my own and set it with two lights.

Note the file path that results  ./foldername/assetname.ext for the mesh file.

BTW, without your original mesh I can't explore the possibility that your problem results from your model alone.

As ever, a picture speaks a thousand words, so have attached a screenshot of what to expect from my slight redraft of your original composition.

PreviewAttachmentSize
holeshadow.zip28.1 KB
holeshadow.png
holeshadow.png71.86 KB

Udart's picture
Re: Shadows acting weird

Yeah I'm sorry, it was late and I forgot that meshes are linked and not embedded. Here's the original file if it has any interest. The mesh is a flat plane with a hole punched in the middle. With realistic lighting I would expect a shadow falling on the cube hat matches the shape of the mesh. However that doesn't happen. If I turn shadows on in the lighting patch the cube shading disappears and the cube is 100% lit on both of the visible vertices.

So it seems the mesh somehow breaks the lighting.

PreviewAttachmentSize
hole mask.zip19.42 KB

cybero's picture
Re: Shadows acting weird

Sphere.dae is the bedrock exemplar for the embedded mesh upon which all other mesh activity subtends in QC.

It is in it's own Lighting environment [sans shadows].

Thus affects all other placements of .dae assets.

Anyhow find attached a rework that shows how effectively shadows get painted upon the underlying Cube patch.

There are glitches with the Lighting environment.

Try turning off the cube, the mesh turns off too, though it shouldn't.

Moving into a GLSL environment shader helps with Lighting.

PreviewAttachmentSize
hole mask 2.zip48.74 KB

Udart's picture
Re: Shadows acting weird

Thank you for your example but I don't think it's working as intended on my machine. I see no cast shadows anywhere. Or did I misunderstand? My original intention was to have the shadow of the hole projected onto the cube.

PreviewAttachmentSize
Screen Shot 2012-06-03 at 3.37.43 AM.png
Screen Shot 2012-06-03 at 3.37.43 AM.png485.59 KB

cybero's picture
Re: Shadows acting weird

The hole should casts no shadow but the surrounding shape does. At least, that's what happens for me.

PreviewAttachmentSize
hole shadow example 01.png
hole shadow example 01.png43.38 KB

cybero's picture
doublepostglitch

doublepostglitch

Udart's picture
Re: Shadows acting weird

Of course I didn't mean to say that the hole itself casts a shadow... :-)

But as you can see from the above screenshot I get a very different result. What is the configuration of your machine?

harrisonpault's picture
Re: Shadows acting weird

Works pretty well for me. You might try softening your shadow a bit: give shadow color something less than 100% opacity, or a bit of luminance (basically, grey not pitch black) Then you can see whats going on. In the configuration you give (light position, 3d object orientation, position) the shadow covers the entire visible portion of the cube, and shadows are pitch black, so, yeah, the cube basically disappears.

cybero's picture
Re: Shadows acting weird

Also works in Lion QC as well as Snow QC 10.6.8 and 10.7.4 respectively. Both mesh and shadows. Positioning does differ between Snow and Lion though.

PreviewAttachmentSize
meshmask.png
meshmask.png35.09 KB
meshmask2.png
meshmask2.png35.21 KB

Udart's picture
Re: Shadows acting weird

You are mistaken, the screen shot above was not from my patch but directly from your example. If you doubt this take a look at this new screen shot.

Also your screen shot 'meshmask.png' seems to me to resemble what I see on my machine. And your 'meshmask.png' does not contain any visible cast shadow on the cube? Can you confirm this? Because then the problem may be specific to Lion (I'm on 10.7.3).

Thank you for staying with me on this.

PreviewAttachmentSize
Screen Shot 2012-06-04 at 8.20.13 PM.png
Screen Shot 2012-06-04 at 8.20.13 PM.png265.4 KB

cybero's picture
Re: Shadows acting weird

Actually there is a shadow but it is barely discernible, screenshot in question taken in Lion 10.7.4. Shadowing does work after a fashion, the positional paramaters seem to differ slightly from Snow QC.