[away3d] phong material on a plane

4 views
Skip to first unread message

Stefan Tabakov Стефан Табаков

unread,
Apr 30, 2008, 9:20:59 AM4/30/08
to away3...@googlegroups.com
Hey, guys

I'v tried to set a PhongColorMaterial and a PhongBitmapMaterial on a
Plane, but ... I didnt get what I've expected :)
The attachment shows a screenshot with a cube and a plane with the same
PhongColorMaterial.

Is it possible at all?

Thanks

Greets,
Stefan

planeandcube.jpg

Makc

unread,
Apr 30, 2008, 9:36:27 AM4/30/08
to away3...@googlegroups.com
that's because noone bothers to take vertex position into
calculations. normals themselves arent enough to handle flat surface.
cube have them pointing away from cube center, if you do same with
plane normals, you could expect same efect there.

Rob Bateman

unread,
Apr 30, 2008, 9:47:13 AM4/30/08
to away3...@googlegroups.com
that's because noone bothers to take vertex position into
calculations. normals themselves arent enough to handle flat surface.
cube have them pointing away from cube center, if you do same with
plane normals, you could expect same efect there.

That's right - vertex positions are taken into account with point-lit flatshading, but i usually like sticking to directional light sources (used here), as they are slightly faster and more uniform across a scene

the phong material here is doing it's best to render corrrectly on your plane, but the problem lies in the calculated vertex normals, which bear no relation to how you want the light to react across the surface. Phong shading spherically interpolates between vertex normals, assuming a smoothed curved surface. For this reason, i think flat shading using ShadingColorMaterial or WhiteShadingBitmapMaterial would be better suited to your use case. What effect are you trying to achieve?


atb


Rob
--
Rob Bateman
Flash Development & Consultancy

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

Stefan Tabakov Стефан Табаков

unread,
Apr 30, 2008, 11:03:35 AM4/30/08
to away3...@googlegroups.com
Many thanks to you both for answering.

It seems that this theory is not in the field of my knowledge. I tried to set the phong material intuitively, like in the case with other primitives, but as I see, its not like this.
The effect I am trying to achieve is to have a gradient shade on my plane, just like the one on the top surface of the cube.
The first thing I thought is to use 1px depth for the cube, but Its not good enough, so may be I will give up for now and I will leave my plane with no shade.

Thanks again.

Rob Bateman написа:

Makc

unread,
Apr 30, 2008, 11:11:05 AM4/30/08
to away3...@googlegroups.com
no need to escape so easy, here's how you should alter vertex normals
to have nice gradient:

(attached)

reply.gif

Stefan Tabakov Стефан Табаков

unread,
Apr 30, 2008, 12:22:30 PM4/30/08
to away3...@googlegroups.com
Thats great! I'll do it.

Thanks again.

Makc написа:

>> ------------------------------------------------------------------------
>>

Reply all
Reply to author
Forward
0 new messages