Ok, thank you Li, getting those reflections in place is getting a
little harder than I thought.
I get the idea of what the experts have told you.
I'm not an expert on this but however I think that a pointlight placed
so far away as I'm placing it here should behave like
a directional light. So the reflections on the object should be the same
with both lights.
A directional light is a 'light' after all. If a shiny object moves
close to you (ie the observer,
ie the camera) the reflection on the object must change accordingly to
what you would
observe in the real world. And in the real world it behaves as we were
expecting.
Of course, this is my point of view.
I've been 'playing' a little with those new PB shaders and materials.
For lights I've tested with PointLight3D (as you pointed out) and for
planet materials PhongPBMaterial.
Thus far I've been unable to get it working like the no-PB version.
Preliminary ideas:
- There is an improvement in rendering quality. Those PB shaders look
very promising.
- I have to multiply light coords (the big numbers of the test version)
by at least 1e-5 for the sphere to look as spected. Also, those 'radius'
and 'fallOff' properties of the Pointlight3D confirms my feeling that
Directional light might be more appropriate here.
- I get this artifact on the sphere
http://www.betaeridani.com/gallery/earth_pb_artifact.jpg
- By far the most worrying aspect I've noticed is that performance
gets affected by texture size. Working in hi-res mode I'm using
textures of 4096x2048 px and that makes FPS to plummet drastically.With
1200x600 textures performance is acceptable in my core2 but still worse
than with no-PB shaders.
I do know that 4096x2048 is a massive texture but I can hardly notice
any performance issues with the no-PB shaders. This project has big
numbers everywhere ;-)
If this big texture issue gets confirmed then I'll have to stick to the
no-PB shaders. Hope I can get your patch to work here. That directional
light
with your patch is just what I need.
Alright! I had a chat with the experts and I now have a clearer
picture. Anyone please correct me if what I say is incorrect:
- First of all, this is not a bug! Directional lights simulate light
sources placed at infinite distances, they are correct in ignoring the
objects' position with this in mind.
- What you need though is a PointLight, BUT the engine's standard
shading materials will not work with this type of light
(ShaidngColorMaterial, PhongColorMaterial, etc). These will simply not
react to point lights.
- Good news is that the latest pixel bender based shading materials do
react to them. This is cool also because their performance is way
higher than standard shading materials, even being bitmap based.
CONCLUSION then: Look in Away3d.com for examples on these latest PB
shaders and use them with point lights, you should get exactly what
you want. I had a go at this myself and i found them to be very easy
to implement.
This topic does bring up a couple of confusing areas in the engine.
We're taking note of this and will review materials and light and
hopefully make it clearer in the future.