PDA

View Full Version : noobish: Shadows in VPR/ double-sided



jeric_synergy
03-27-2011, 10:53 AM
I was recreating a bug over at http://forums.creativecow.net/thread/75/855650 when I found out my VPR wasn't casting shadows at all, let alone casting them correctly.

My test scene is dead simple, minimal change from defaults-- what could could be the problem? Ran thru all the lights and camera types.

I'm sure this is something stupidly simple. :foreheads

EDIT BEFORE POSTING: ...and here it is: the shadowcasting poly had to have DoubleSided turned on. So now the question is: Why does DoubleSided have to be on? :confused:

dwburman
03-27-2011, 11:33 AM
I guess lights are like cameras. They don't see the back side of polygons unless double sided is on.

jeric_synergy
03-27-2011, 05:36 PM
I guess lights are like cameras. They don't see the back side of polygons unless double sided is on.
I don't remember this being a problem before-- you didn't need double-sided polys to cast shadows. Achh, too tired, I'll figure it out tomorrow.

Lightwolf
03-27-2011, 05:59 PM
I don't remember this being a problem before-- you didn't need double-sided polys to cast shadows. Achh, too tired, I'll figure it out tomorrow.
If they're just single polygons they do... if you model them as, say, a box, then they don't.

The sidedness is respected by the lights as well to determine visibility when casting shadows. And shadows are cast from the light to the surface, which is why the sidedness is seemingly the opposite.

It does allow for some nice tricks though...

Cheers,
Mike

jeric_synergy
03-27-2011, 11:55 PM
And shadows are cast from the light to the surface, which is why the sidedness is seemingly the opposite.


??? Did you get this phrasing right? To me "shadows are cast from the Surface TO the Light" would make more 'sense', seeing as how the Surface can't see the poly due to its facing away from the Surface.

Anyway, found a new way to crash Lightwave.

Danner
03-28-2011, 03:24 PM
Think of it this way, if you have a single sided room with the camera inside, and you have the sun outside then the wall will cast a shadow and light will come through the windows

If you have a single sided coffee table facing up, it will not cast shadows.

This example helps me remember that shadows always cast in the direction of the normal, and not the other way.

jeric_synergy
03-28-2011, 07:28 PM
Danner, thanks, that's a great mnemonic, and makes more sense to me.

Half the fight seems to be finding a useful way to think about these things.

jwiede
04-01-2011, 08:52 PM
Odd, virtually every other 3D app where I tried this scenario showed the shadow from the single-sided poly (given the ss poly's normal is facing the light), as expected.

Are you guys sure this isn't a shadow bug that crept in at some point?

jeric_synergy
04-02-2011, 01:32 AM
jwiede, I'm with you on the making sense bit ("if the light can 'see' the object, it should cast a shadow") while simultaneously grateful for Danner's mnemonic.

What other apps did you try it in??

Lightwolf
04-02-2011, 04:51 AM
Are you guys sure this isn't a shadow bug that crept in at some point?
Yup. It's been like that for ages and I suppose by design (just because it does allow for some neat tricks).

Afaik the whole sidedness issue is also solved differently in most other apps.

Cheers,
Mike

jeric_synergy
04-02-2011, 12:07 PM
Since it reflects a wholly unnatural phenomenom (one-sidedness), I guess they just picked the convention that made sense to them at the time.

stiff paper
04-02-2011, 12:50 PM
Yup. It's been like that for ages...

LW's lights and shadows have always ignored the backface of polygons. (Or at least they have since LW was split out from VT... which is always as far as LW itself is concerned.)

There's a surface normal there on the poly for the lights to look at... so if other apps ignore the direction of that normal then I'd suggest, politely, that the other apps are completely wrong. Without the normal there's nothing facing in that direction, and if there's nothing facing in that direction... then...

jeric_synergy
04-02-2011, 03:58 PM
LW's lights and shadows have always ignored the backface of polygons. (Or at least they have since LW was split out from VT... which is always as far as LW itself is concerned.)

There's a surface normal there on the poly for the lights to look at... so if other apps ignore the direction of that normal then I'd suggest, politely, that the other apps are completely wrong. Without the normal there's nothing facing in that direction, and if there's nothing facing in that direction... then...
You've got it exactly backwards: Lightwave casts a shadow when the light is seeing the TRANSPARENT side of the polygon. Try it. I believe I included sample files.

EDIT: nope, I didn't, but here they are: btw, as the filename suggests, do NOT try this with VPR on, as it will crash.

I'd say LW has it backwards, but: it's not a realworld situation, so the devs picked a convention. Other devs picked a different convention.

stiff paper
04-02-2011, 05:03 PM
Hah! My apologies. You are completely correct.

You appear to have found a major bug (!)

I've just tested it with a single 1m by 1m poly. The face side (front) won't cast a shadow but the backface does, which is not how it is supposed to work at all (and not how it used to work).

What seems to be happening with your leaves is that the shadow is only being cast (incorrectly) by the backface, but the transparency map is (correctly) only applied to the frontface. When you make the surface double sided, then the trans map is being applied to the backface as well, and hence the shadows are taking it into account.

I think I need to test some more to make sure that's really what's happening... but it's going to have to wait until tomorrow morning...

Somebody else test this! The more evidence the better...

Edit: No, really, I don't think they've randomly "picked a convention". It used to be the other way around. The front of a poly, with the surface normal poking out if it, is supposed to cast the shadow. That's how it always worked before, so I think this is a bug.

Lightwolf
04-02-2011, 05:10 PM
Since it reflects a wholly unnatural phenomenom (one-sidedness), I guess they just picked the convention that made sense to them at the time.
That really depends on how you look at it. From the point of view of all physical objects being actual volumes (including one molecule layer of nano-whatever) it's a perfectly fine simulation.
The surface properties are the properties of the volume as defined by the (bounding) polygons. These properties only make sense when going into the volume, not when leaving it.
This is quote obvious if you look at how transparent surfaces need to be set up with respect to the medium around them (usually air) previous to volume stacking (which only deals with air as the surrounding medium as well).

So, as a summary: A single polygon is never a proper physical item (and can't be) - a polygon is always part of the volume boundary of an item.
It thus defines the (physical) surface of the item, not the item itself.

This is where CSG would come in (constructive solid geometry) - but that adds another set of contraints.

Cheers,
Mike

jeric_synergy
04-02-2011, 05:31 PM
Mike, I'm standing by "wholly unnatural phenomenon", and no amount of typing and vigorous hand-waving will budge me. As you say, "(and can't be)". :D

If we could harness the energy of waving programmers' hands world-wide, OPEC would be out of business.

It would be interesting to put the LW devs and some of the competing conventions devs into The Octagon and see who manages to exit intact.

jeric_synergy
04-02-2011, 05:33 PM
What seems to be happening with your leaves ....
CB, just a note: not 'my leaves'-- that's some other poster at C.Cow. I'm the moderator. And his actual problem was related IIRC to the light, not the issue we're seeing here.

Just in the process of investigating HIS problem, I found this one.

Lightwolf
04-02-2011, 05:34 PM
Mike, I'm standing by "wholly unnatural phenomenon", and no amount of typing and vigorous hand-waving will budge me. As you say, "(and can't be)". :D
I'm sure that you can share a physically more accurate way of emulating real world phenomena with us then...

Cheers,
Mike - waiting.

Captain Obvious
04-02-2011, 05:52 PM
Polygons just represent the limit surface of an imaginary volume, so a non-closed mesh will always be something that couldn't exist in real life anyway.

A single polygon, be it double sided or not, is a complete fabrication. If you want to discuss whether or not something is physically accurate, you'll need to close your meshes first and come back when you've done that. ;)


edit:
A closed mesh is one where each edge is shared by EXACTLY two polygons, by the way.

jeric_synergy
04-02-2011, 06:03 PM
..., is a complete fabrication.
That's my point.

Captain Obvious
04-02-2011, 06:19 PM
That's my point.
Yeah, welcome to computer graphics. ;) Lightwave can render things that cannot exist in real life, so any comparisons with real life for how it handles such matters are kind of... irrelevant.


Besides, look at it this way:


Imagine that you have invented a material that, when viewed from one side is completely transparent and when viewed from the other side is completely opaque.

Now imagine that you build a roof out of this material, with the apparently opaque side facing up towards the sky.

If you're standing underneath the roof, you would be able to see the sky and the sun.

Because you can see the sky and the sun, you are not in shadow.




That's how Lightwave works. Makes perfect sense. Never mind the fact that such a material is most likely utterly impossible.

hcoat
04-02-2011, 10:28 PM
This is how lightwave works and has worked, but it makes just as much "perfect sense" other way around (If light hits opaque side it leaves a shadow because light is not going thru and an invisible side doesn't cast a shadow because light is going thru). Since single-side poly is not a physically accurate object one way or the other is going to leave someone asking questions.

Lightwave could be made render either way, neither way makes more physical sense than the other. But having a shadow cast from the opaque side makes more intuitive sense.

So the question is which way actually has a greater benefit for the user? IMO the more intuitive way gives greater benefit.

For example If I make a cube, in lightwave right now, and flip the polys and render it, I will just get a useless 3D shadow. If lightwave switched the other way around, I could place objects in that cube and pan all around and see the object in the cube and they would cast shadows on the inside of the cube. I would find this to allow for a more creative process. Neither way physically accurate so I say let's go with way gives greatest benefit.

stiff paper
04-03-2011, 02:47 AM
Well. I just dug out an old laptop with LW8 on it and... it's the same in LW8 as it is in 9.

Which leaves me confused, because I'm almost certain that at some point in the past I've made a box and shone light into it from outside through the backface of the polys, without it casting shadows.

Of course, I learned with LW4 and 5... so... it's so long ago now that maybe I'm just not remembering it right. If anybody has an old PC with a working LW5 I'd be interested in knowing how it works in that...

stiff paper
04-03-2011, 03:26 AM
I am wrong about this, it's always worked just like it does in 9.6.

One distant light pointing down, one simple ground plane. Two single sided polys, you can see the one on the left, the one to the right is facing down so we're looking at the backface. As rendered in Lightwave 5.6: