three-rs / three

[abandoned] Totally not inspired Rust 3D library
Apache License 2.0
555 stars 46 forks source link

Shadow casting/receiving API #38

Open kvark opened 7 years ago

kvark commented 7 years ago

Three.js has a pair of simple boolean flags per object:

object3d.castShadow = true;
object3d.receiveShadow = false;

This doesn't exactly work with remote nodes that we have, and is not flexible enough. One possible scheme:

light.clear_casters()l
light.add_caster(&mesh1);
light.add_caster(&mesh2);

If the light affects an object, then the object automatically becomes the receiver. I don't think it ever makes sense to be lit but not receive the shadow.

vitvakatu commented 7 years ago

I like the current proposal with add_caster, it seems flexible enough. @alteous?

alteous commented 7 years ago

I can't offer an informed opinion. Let me play around with the shadow system for a little while and I'll get back to you.

Looking at the aviator demo, it seems that only the aeroplane casts a shadow which seems odd to me.

expenses commented 6 years ago

Do shadows work at all (without getting into lower level things like shaders) right now?

kvark commented 6 years ago

@expenses the lights example shows how the lower level thing works. You cycle through the light types with left/right, and you can see both the shadow casted, and the shadow map itself rendered.

expenses commented 6 years ago

Right, yeah, sorry. When i was having trouble I was using a PBR shader, which doesn't seem to cast shadows.