Dot3BitMapMaterial & tinted DirectionalLight3D poblem

6 views
Skip to first unread message

MarkC

unread,
Dec 24, 2009, 5:16:11 AM12/24/09
to Away3D.dev
Now I finally have my Dot3BitMapMaterial working (thanks Fabrice) I
have hit another problem...

I am using a DirectionalLight3D to illuminate you Moon sphere, here it
is with the default white light colour applied:

http://groups.google.com/group/away3d-dev/web/Capture_White.jpg

If I change the .color of the directional light (in this case I have
set it to 0xFF00D0 - which is a bright purple/magenta colour) then two
unexpected things happen. Firstly the shadow is no longer rendered
correctly, and secondly the colour applied seems to be the inverse of
light source?

Here is the render with the only change being the light source color
set to 0xFF00D0:

http://groups.google.com/group/away3d-dev/web/Capture_Shaded.jpg

The relevant bits of code are:

sun = new DirectionalLight3D({color:0xFFFFFF,brightness:1.2,ambient:
0.1,diffuse:0.9,specular:0});
var moonMaterial:Dot3BitmapMaterialF10 = new Dot3BitmapMaterialF10
(Cast.bitmap(moonMap0),Cast.bitmap(normalMap));
moonMaterial.shininess = 0;
moonMaterial.specular = 0;

Anything obvious I am doing wrong?

Thanks
Mark

MarkC

unread,
Dec 24, 2009, 6:17:38 AM12/24/09
to Away3D.dev
I should have added, that if I use a PhongMaterial then the rendering
is correct with respect to both the shadows and the color applied to
the Moon.

Regards
Mark

MarkC

unread,
Dec 28, 2009, 9:30:45 AM12/28/09
to Away3D.dev
Also confirmed that this happens both with the Dot3BitmapMaterialF10
and Dot3BitmapMaterial materials.
Also tried using one of the tutorial normal maps to rule out mine
being 'odd' in some way - same behaviour.

Mark

Rob Bateman

unread,
Dec 29, 2009, 8:28:56 AM12/29/09
to away3...@googlegroups.com
Hey Mark

which tutorial code did you use to replicate the problem? would be good to get the same effect occuring here before attempting to fix the bug

cheers

Rob
--
Rob Bateman
Flash Development & Consultancy

rob.b...@gmail.com
www.infiniteturtles.co.uk
www.away3d.com

MarkC

unread,
Dec 29, 2009, 11:41:02 AM12/29/09
to Away3D.dev
Thanks Rob

I've combined several tutorials :) I'll strip my code down to the
minimum and post it in the files section along with the images etc.

It may be tomorrow before I can do this though - kids have taken over
my main PC (which has Flash CS4 installed on it) to play games!

Mark

> rob.bate...@gmail.comwww.infiniteturtles.co.ukwww.away3d.com- Hide quoted text -
>
> - Show quoted text -

MarkC

unread,
Dec 29, 2009, 1:28:42 PM12/29/09
to Away3D.dev
OK, I kicked the kids off the 'puter ;-)

I have put a zip file in the Files section:
http://groups.google.com/group/away3d-dev/web/simple_Moon3D.zip

In Moon3D.as...

Lines 114,115 change the light source.

I have stripped out all my extrenous code for tweening and external
interfaces etc.

Hopefully this gives you enough to go on - either a bug or error on my
part.

I took some of the code (and Asteroid normal map) from here:
http://blog.tartiflop.com/tag/normal-mapping/

Many thanks
Mark

> > rob.bate...@gmail.comwww.infiniteturtles.co.ukwww.away3d.com-Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -

MarkC

unread,
Jan 6, 2010, 6:20:18 AM1/6/10
to Away3D.dev
Hi, has anyone had a chance to have a look at this? I still have the
problem with a non-white light source.

Many thanks if you can afford the time.

Mark

> > > rob.bate...@gmail.comwww.infiniteturtles.co.ukwww.away3d.com-Hidequoted text -

Rob Bateman

unread,
Feb 3, 2010, 5:39:05 AM2/3/10
to away3...@googlegroups.com
Hey Mark

had a look at your sample, and corrected a matrix calculation that should fix your problem. patch has been uploaded to the svn trunk - let us know if it works!

cheers

Rob
rob.b...@gmail.com
www.infiniteturtles.co.uk
www.away3d.com

M Crossley

unread,
Feb 3, 2010, 8:33:51 AM2/3/10
to Away3D.dev
Thanks Rob, that has fixed it. I'm most grateful.

I did notice that there seem to be some debug messages when the movie
runs now, I don't know if they are related to your code change:

_szx 1
_szy 0
_szz -3.4450524030726903e-16

Cheers
Mark

On Feb 3, 10:39 am, Rob Bateman <rob.bate...@gmail.com> wrote:
> Hey Mark
>

Rob Bateman

unread,
Feb 3, 2010, 8:59:51 AM2/3/10
to away3...@googlegroups.com
whoops. yeah, thanx for that! trace removed

glad to hear things are working for you now.

Rob

MarkC

unread,
Feb 7, 2010, 12:21:37 PM2/7/10
to Away3D.dev
Rob

I spoke too soon, though the light source colour problem has been
resolved, a new fault seems to have been introduced.

The Ambient light shadow no longer lines up with the direct light
shadow - for some angles, not all.

Take a look at the attached image, it is looking down on the pole of
my Moon sphere, the ambient light is set to zero, but you can see a
wedge between the true shadow edge (from direct light) and where the
deep ambient (black in this case) shadow starts. As I say this does
not happen for all angles of rotation of the light source around the
sphere, so I suspect it is a quadrant thing for a trig function
somewhere.

http://groups.google.com/group/away3d-dev/web/misaligned_ambient.jpg

Apologies for the low contrast image, I'm playing around trying to
stop burn out in the high-lights whilst retaining some definition up
the shadow.

Regards
Mark

> rob.bate...@gmail.comwww.infiniteturtles.co.ukwww.away3d.com

MarkC

unread,
Feb 7, 2010, 12:58:56 PM2/7/10
to Away3D.dev

MarkC

unread,
Feb 7, 2010, 2:40:21 PM2/7/10
to Away3D.dev
Rob

I couldn't reporduce this on another computer, until I noticed that I
only get the effect if I change the Dot3 material properties:

MoonMaterial.specular = 0.2; //0.2 or greater to get the effect.

Regards
Mark

On Feb 7, 5:58 pm, MarkC <m...@wilmslowastro.com> wrote:
> One more image...http://groups.google.com/group/away3d-dev/web/misaligned_ambient2.jpg

> > > rob.bate...@gmail.comwww.infiniteturtles.co.ukwww.away3d.com- Hide quoted text -

Reply all
Reply to author
Forward
0 new messages