Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (408)
games submitted by our members
Games in WIP (293)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  IndexedTriangleArray.calculateFaceNormals()  (Read 1215 times)
0 Members and 1 Guest are viewing this topic.
Offline Preston

Senior Member


Medals: 2



« Posted 2003-11-14 12:59:59 »

Well, this doesn't seem to work for me when it comes to light. A kind of vectors are being calculated but the light isn't correct...

I think I've read here somewhere that there's still a problem with the calculateFaceNormals() method and indexed triangles? Unfortunately a search doesn't find it...

William mentioned once that the way this method would work in J3d and Xith3d differs, but what dit he mean by this?

How would it be possible to calculate the normals for a IndexedTriangleArray?

Memento mori.
Offline Preston

Senior Member


Medals: 2



« Reply #1 - Posted 2003-11-15 06:34:51 »

The Java3d Tutorium chapter 6.5 describes the normal problem, too. It says:
Quote

When a vertex is shared by surfaces of widely varying orientations, having only one normal per vertex can result in problems. (..) If the normal is selected as the actual normal for one surface, it is very wrong for its neighbor. (..) The solution to both problems is to increase the number of vertices in order to increase the number of normals. This, of course, increases memory usage and rendering time.


So do I understand it correctly that bascially it's impossible for a method like calculateFaceNormals for an IndexedTriangleArray do calculate the normals, because surfaces with totally different orientation share the same vertex and hence normal?
Is the problem different with TriangleStripArrays? Because there the shared vertexes are always neighbours?

So this is the "art": with IndexedTriangleArrays you've to find out all vertexes/normals which can't be shared and so you insert new ones?

Being on that topic: I read many times in the Tutorial that usually TriangleStrips are faster than indexed ones. Do you Xith3d users out there use Strips or Indexed arrays?
In case you use strips: do you calculate the strips manually or is there a helper class inside Xith3d? Like in Java3d the GeometryInfo's Stripifier. However I don't find such a thing in Xith3d. :-)

Memento mori.
Offline Preston

Senior Member


Medals: 2



« Reply #2 - Posted 2003-11-15 06:54:47 »

With J3d-Tutorium I meant this one from September 2000: http://developer.java.sun.com/developer/onlineTraining/java3d/

Since Xith3d has got a similar architecture to Java3d I find this Tutorium a be good start point for Xith3d newbies, too. Additional to the official Xith3d Tutorium.

Memento mori.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Yuri Vl. Gushchin

Senior Member




Speak Java!


« Reply #3 - Posted 2003-11-15 10:00:00 »

Quote
So do I understand it correctly that bascially it's impossible for a method like calculateFaceNormals for an IndexedTriangleArray do calculate the normals, because surfaces with totally different orientation share the same vertex and hence normal?
Is the problem different with TriangleStripArrays? Because there the shared vertexes are always neighbours?


The problems with automatic calculations of face normals may happen in every case where you have vertex shared by multiple (2 or more) triangles, because of this MAY happen that two normals should be associated with the same vectex coordinates. This is true for all indexed geometries, strips and triangle fans.

If you still want to use indexed or stripified geometries in your app [which IS the case, because of often they give you higher performance], you may go simple way and first convert your geom to triangle array, calculate normals and the indexify/stripify geom.

Another case is when you KNOW that surface of your geom is smoothed, i.e. guaranteed to have one normal per vertex. Then you can invent the algorithm that will generate normals on indexed/stripified geom.

Quote
I read many times in the Tutorial that usually TriangleStrips are faster than indexed ones. Do you Xith3d users out there use Strips or Indexed arrays?


Not always and not in every case. This depends primarily on strip lengths, number of strips, etc.

Yuri

Yuri Vl. Gushchin
JProof Group
Offline Yuri Vl. Gushchin

Senior Member




Speak Java!


« Reply #4 - Posted 2003-11-17 15:25:34 »

I think all com.sun.j3d.utils.geometry.* classes should be ported to Xith3D, but major question is WHEN...

Yuri

Yuri Vl. Gushchin
JProof Group
Offline Preston

Senior Member


Medals: 2



« Reply #5 - Posted 2003-11-18 13:25:04 »

Quote
I think all com.sun.j3d.utils.geometry.* classes should be ported to Xith3D, but major question is WHEN...

I see. You, David, Wil and Jens should have more time. :-)  Like most of us, here, I suppose. ;-)

A general thought on the Java3d to Xith3d connection: how's the legal status of porting parts of Java3d to Xith3d?
We talked about this topic recently concerning Vecmath. It looks like there's soon a free/opensource Vecmath which we/Xith3d could use as replacement for SUN's vecmath.
However what about other ports? It depends on what "port" actually means, I suppose. If it's a new implementation of a borrowed design it shouldn't be a problem. Or anybody know more?

It would be strange, if for copyright issues a Xith3d based game would have to include the entire Java3d runtime environment... ;-)
(Or isn't this funny? I'm no lawyer, just a developer)

A second thought: What would happen if SUN revived their Java3d some day (or did they do already) ? Would they have to port some parts back to Java3d, or would they tend to dislike Xith3d as a competitor? :-)

Memento mori.
Offline Yuri Vl. Gushchin

Senior Member




Speak Java!


« Reply #6 - Posted 2003-11-18 15:13:48 »

Regarding com.sun.j3d.utils.geometry.*, there is a clear copyright statement in every source file (in fact, very close to BSD license).

Regarding Vecmath, I personally use now Kenji Hiranabe vecmath with minor modifications, and can state that it is 100% compatible with Xith3D [means no Xith3D modifications required to replace Sun VecMath with that one]. See http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=xith3d;action=display;num=1063928279 "third party library copyright issues" for more details.

I don't think Xith3D should be dependent on Java3D at all [even I think right now it is already not dependent, but maybe I missed something].

Yuri

Yuri Vl. Gushchin
JProof Group
Offline abies

Senior Member





« Reply #7 - Posted 2003-12-16 08:37:40 »

I have added simple implementation of normal generator for IndexedTriangleArray, which smooth all normals. It is certainly not perfect for all models, but at least works for simple case. I'll commit a patch to issue list later today.

Artur Biesiadowski
Offline Preston

Senior Member


Medals: 2



« Reply #8 - Posted 2003-12-16 10:21:00 »

Quote
I have added simple implementation of normal generator for IndexedTriangleArray, which smooth all normals. It is certainly not perfect for all models, but at least works for simple case. I'll commit a patch to issue list later today.

Will this normal generator be added to the official Xith3d source code? That would be nice.

Currently I'm also using such a "always smooth normals" generator (but it's seperate to IndexedTriangleArrays) but still all the >90° surfaces are smoothed, too ... which looks not very good on the typical Lightwave models I use. :)
When this will be added to Xith3d I'll use it thankfully. :-)

Memento mori.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Try the Free Demo of Revenge of the Titans

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (130 views)
2013-05-17 21:29:12

alaslipknot (139 views)
2013-05-16 21:24:48

gouessej (169 views)
2013-05-16 00:53:38

gouessej (162 views)
2013-05-16 00:17:58

theagentd (173 views)
2013-05-15 15:01:13

theagentd (158 views)
2013-05-15 15:00:54

StreetDoggy (202 views)
2013-05-14 15:56:26

kutucuk (226 views)
2013-05-12 17:10:36

kutucuk (226 views)
2013-05-12 15:36:09

UnluckyDevil (229 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.073 seconds with 21 queries.