sure, just ask mesh.faces[index].normal;
and to refresh, there is (on top of my head) some set NormalDirty
applicable per face or entire mesh in Mesh.
Fabrice
On May 13, 2009, at 4:20 PM, digi-chris wrote:
Hi Fabrice,
Thanks for the advice - I'll have a longer look through the materials
package tonight and see if I can figure it out. I was hoping there
might be some way of applying a color transform onto specific faces as
a short-cut, but I'll have another look.. elevationModifier sounds
interesting.
Just to check, can Away3D calculate the normals for me, or do I need
to use my own routine for this?
Cheers,
Chris.
On May 13, 9:03 am, Fabrice3D <[email protected]> wrote:
Hi Chris,
Take a look into the material package, there are like 5 or 6 ways to
apply lights on different ways in there.
I would for a watery surface consider the normalmap approach. A
custom
mix of dot3 and animatedMaterial was one of the experiments I was
planning to do
ages ago... if you couple this to add mode with another source, the
little tests I did back then where looking quite convincing when it
comes to water..
however the system here would be based on noise and mostly
prerendered. The trick being offsetting both sources to get the
randomness.
Coupled to NormalUVModifier or elevationModifier for the geometry,
may
be some tiling...
I'm afraid the realtime calc+draw of a sea surface in Flash, would
have to be reduce to a little rain pool... if not more like a glas of
water,
Welcome to Away!
Fabrice
On May 13, 2009, at 3:11 AM, digi-chris wrote:
Hi all,
I've been using Away3D for a while now, but this is my first post
here. I've been struggling with something that, so far, I can't
really
see any way to solve...
I'm building an object on the fly within AS3 - the vertices can
change
position with each frame. It's kind of like a wave running through a
texture-mapped plane. This all works fine, but my problems come
when I
attempt to add some sort of lighting to the equation. I'm having
trouble calculating the normals properly.. I've tried several pieces
of example code I've found around the web without success, but I
can't
see anything in particular wrong with my method.
However, at the same time, I've noticed that repeatedly calculating
normals every frame is quite CPU-heavy. Even if I get it working, I
don't think it'll be fast enough.
Now, I'm thinking that in actuality, I might be able to save on CPU
time and not worry about the normals by simply modifying the faces
directly in some way to represent the shading that should be going
on.
All I really want to do is just darken a face depending on its
angle -
that way I could just cut out the whole lighting issue altogether.
But, is there any way I could actually darken or lighten a face or
apply some sort of shading over the top of the texture? It doesn't
seem to be possible.
I'm contemplating drawing onto the BitmapData of the material I'm
using in some way, but I'm not sure if that would be the best
approach.
Any ideas or thoughts would be greatly appreciated.
Cheers,
Chris.- Hide quoted text -
- Show quoted text -