Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (499)
Games in Android Showcase (118)
games submitted by our members
Games in WIP (567)
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 1549 times)
0 Members and 1 Guest are viewing this topic.
Offline Preston

Senior Member


Medals: 4



« Posted 2003-11-14 11: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?
Offline Preston

Senior Member


Medals: 4



« Reply #1 - Posted 2003-11-15 05: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. :-)
Offline Preston

Senior Member


Medals: 4



« Reply #2 - Posted 2003-11-15 05: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.
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 09: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 14: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: 4



« Reply #5 - Posted 2003-11-18 12: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? :-)
Offline Yuri Vl. Gushchin

Senior Member




Speak Java!


« Reply #6 - Posted 2003-11-18 14: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 07: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: 4



« Reply #8 - Posted 2003-12-16 09: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. :-)
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

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

The first screenshot will be displayed as a thumbnail.

Pippogeek (37 views)
2014-09-24 16:13:29

Pippogeek (29 views)
2014-09-24 16:12:22

Pippogeek (18 views)
2014-09-24 16:12:06

Grunnt (42 views)
2014-09-23 14:38:19

radar3301 (24 views)
2014-09-21 23:33:17

BurntPizza (60 views)
2014-09-21 02:42:18

BurntPizza (30 views)
2014-09-21 01:30:30

moogie (36 views)
2014-09-21 00:26:15

UprightPath (49 views)
2014-09-20 20:14:06

BurntPizza (52 views)
2014-09-19 03:14:18
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
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!