Hi, I am fairly new at j3d myself, but I think normal are defined per vertex and you defined them per side of the cube. Also if you use the same normal for a vertex shared by several polygons, you get the smooth gouraud shading effect (gouraud is on by default), while when you use different normal for the same vertex for each polygon you get a hard edges. I don't know how to enter the normals, for the time being I use a function (in class GeometryInfo, if memory serves) that generates normals automatically. You can give a maximal angle (between normals of polynoms) for which shared normals will be generated. I think it takes the average of the normals of each of the polygons that share the vertex. Normals and the function are explained in one of the standard guides on sun.com (7 chapters, pretty clear)
hope this helps, anyone correct me if I am wrong? Lars -----Original Message----- From: Discussion list for Java 3D API [mailto:[EMAIL PROTECTED] Behalf Of Kevin Sent: maandag 23 februari 2004 23:51 To: [EMAIL PROTECTED] Subject: [JAVA3D] how normals work??? All, I am a newbie working on a fairly simple Java3D application that virtually models networked computer systems. I have a quick question on surface normals and how they work in the Java3D framework. But first, here is my (limited) understanding of what surface normals are from the standard Java3D tutorials, etc so you can correct it if necessary. Surface normals to me seem to be analogous to the angle of reflection for shading purposes in the virtual world. Java3D uses this angle of reflection most (visually) by the specular color and shininess attributes, but should also be used for determining information for diffuse and ambient color. Problem Background: Most of my objects in my environment are boxes of different dimensions. These boxes could be resized at any moment in the application for a multitude of reasons. Because of this interaction the Box primitive wasn't very conducive and I decided to create my own Shape3D extension that knows how to resize itself in real-time according to my parameters. The Problems: Now when I use CassattItem3D objects, they render mostly correct except that many faces seem partially transparent (I think as a function of their surface normals). I don't think that was very clear, so I'll state it a different way. The boxes seem to render the correct specular, diffuse, ambient colors, but the part of the geometry that should be blocked (i.e. the back bottom faces) seem to still affect the shading on the front faces. The object has an opaque transparency/appearance attribute. I also have these objects as a part of a TransformGroup with a mouse rotator attached so I can view them from different perspectives. As the objects rotate, faces seem to keep their specular, diffuse, ambient colors. The light is not in the TransformGroup so it should be independent of the rotation. My questions: 1) Why are the front surfaces appear to be affected by the surface normals of the back surfaces 2) When I rotate the objects, the faces seem to keep their initial specular, diffuse, emissive, and ambient colors even though I am rotating them independently of the light source. Why don't the colors change in relation to the light source after they are rendered? Anyway, I hope my questions made sense and I didn't show my stupidity too blatantly. I'm attaching the code with the implementation of the Box so you can correct, flame, etc. about my implementation. Sorry for the messy code, but it has a day and half of trial and error programming trying to test interactions out. thanks in advance for the help...any pointers to tutorials/FAQs on using surface normals appreciated. kddubb =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help". =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".