Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (498)
Games in Android Showcase (115)
games submitted by our members
Games in WIP (563)
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  
  Loading Terragen OBJ  (Read 1489 times)
0 Members and 1 Guest are viewing this topic.
Offline angon2006

Junior Newbie





« Posted 2006-01-23 12:08:56 »

Hi,

I had modified the obj loader to generate per-vertex color data. The color value is based on the Z coord.

Because the terragen obj exporter don´t generate normals, i exported the terragen data into lwo files, then imported in blender and exported in obj. Blender not only generate normals, but also material files.

The results:


This is the jar with the classes: http://personales.ya.com/angon/terragenInXith.jar

Those are the files you need: http://personales.ya.com/angon/xith_pruebas/files/terreno3.obj  (7MB), http://personales.ya.com/angon/xith_pruebas/files/terreno3.mtl

When generate terragen files, limit the height between 0 and 256.
Be careful with the size of the terrain or you have out of memory errors!!

I´m working with Xith3d for short time and my english is very poor, don't kill me  Wink ...

thanks all
Offline angon2006

Junior Newbie





« Reply #1 - Posted 2006-01-23 12:12:57 »

I forgot:

use cursors, re-pag and av-pag to move

left click + mouse motion to rotate
Offline jaakko777

Senior Newbie





« Reply #2 - Posted 2006-01-23 19:40:13 »

I get the following exeption loading the obj file:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
org.angon.xith3d.loader.obj.OBJTerragenLoader:  ignoring unknown OBJ tag:  "HTTP/1.1 200 OK"
org.angon.xith3d.loader.obj.OBJTerragenLoader:  ignoring unknown OBJ tag:  "Date: Mon, 23 Jan 2006 17:39:10 GMT"
org.angon.xith3d.loader.obj.OBJTerragenLoader:  ignoring unknown OBJ tag:  "Server: Apache"
org.angon.xith3d.loader.obj.OBJTerragenLoader:  ignoring unknown OBJ tag:  "cache-control: no-cache"
org.angon.xith3d.loader.obj.OBJTerragenLoader:  ignoring unknown OBJ tag:  "P3P: CP='NOI DSP COR CURa ADMa DEVa TAIa PSAa PSDa OUR IND UNI C
OM NAV INT CNT', policyref = 'http://personales.ya.com/w3c/p3p.xml'"

org.angon.xith3d.loader.obj.OBJTerragenLoader:  ignoring unknown OBJ tag:  "Keep-Alive: timeout=15, max=999"
org.angon.xith3d.loader.obj.OBJTerragenLoader:  ignoring unknown OBJ tag:  "Connection: Keep-Alive"
org.angon.xith3d.loader.obj.OBJTerragenLoader:  ignoring unknown OBJ tag:  "Transfer-Encoding: chunked"
org.angon.xith3d.loader.obj.OBJTerragenLoader:  ignoring unknown OBJ tag:  "Content-Type: text/plain"
org.angon.xith3d.loader.obj.OBJTerragenLoader:  ignoring unknown OBJ tag:  "2000"
org.xith3d.loaders.obj.MaterialLibLoader2:  ignoring unknown material tag:  "d 1.000000"
org.xith3d.loaders.obj.MaterialLibLoader2:  ignoring unknown material tag:  "illum 2"
org.angon.xith3d.loader.obj.OBJTerragenLoader:  ignoring unknown OBJ tag:  "o terreno2_terreno2"
java.util.NoSuchElementException
java.util.NoSuchElementException
        at java.util.StringTokenizer.nextToken(StringTokenizer.java:332)
        at org.xith3d.loaders.obj.VertexList.add(VertexList.java:25)
        at org.angon.xith3d.loader.obj.OBJTerragenLoader.load(OBJTerragenLoader.java:72)
        at org.xith3d.loaders.obj.OBJLoader2.load(OBJLoader2.java:207)
        at org.xith3d.loaders.obj.OBJLoader2.load(OBJLoader2.java:194)
        at org.angon.xith3d.loader.obj.OBJTerragenLoader.load(OBJTerragenLoader.java:35)
        at org.angon.xith3d.loader.obj.test.OBJTerragenTest.loadOBJ(OBJTerragenTest.java:166)
        at org.angon.xith3d.loader.obj.test.OBJTerragenTest.access$1(OBJTerragenTest.java:161)
        at org.angon.xith3d.loader.obj.test.OBJTerragenTest$1.actionPerformed(OBJTerragenTest.java:122)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
        at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
        at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
        at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
        at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1000)
        at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1041)
        at java.awt.Component.processMouseEvent(Component.java:5488)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
        at java.awt.Component.processEvent(Component.java:5253)
        at java.awt.Container.processEvent(Container.java:1966)
        at java.awt.Component.dispatchEventImpl(Component.java:3955)
        at java.awt.Container.dispatchEventImpl(Container.java:2024)
        at java.awt.Component.dispatchEvent(Component.java:3803)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
        at java.awt.Container.dispatchEventImpl(Container.java:2010)
        at java.awt.Component.dispatchEvent(Component.java:3803)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
        at com.xith3d.scenegraph.Group.addChild(Group.java:78)
        at org.angon.xith3d.loader.obj.test.OBJTerragenTest$1.actionPerformed(OBJTerragenTest.java:122)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
        at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
        at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
        at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
        at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1000)
        at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1041)
        at java.awt.Component.processMouseEvent(Component.java:5488)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
        at java.awt.Component.processEvent(Component.java:5253)
        at java.awt.Container.processEvent(Container.java:1966)
        at java.awt.Component.dispatchEventImpl(Component.java:3955)
        at java.awt.Container.dispatchEventImpl(Container.java:2024)
        at java.awt.Component.dispatchEvent(Component.java:3803)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
        at java.awt.Container.dispatchEventImpl(Container.java:2010)
        at java.awt.Component.dispatchEvent(Component.java:3803)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)


Im using Java 1.5.0_04..
The exception seems to come from the StringTokenizer and not from your code.
If you can tell on what versions you have tested it on id be pleased to try testing this again Smiley
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 799
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #3 - Posted 2006-01-23 23:39:41 »

Obviously you're parsing an HTTP-header... why?

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline angon2006

Junior Newbie





« Reply #4 - Posted 2006-01-24 08:45:17 »

Obviously you're parsing an HTTP-header... why?

I don´t know where the bug is  Huh

Please, download the obj and the mtl to the hard disk. Verify the obj don´t have HTTP-header inserted by the web server. This is the begining of the file:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
# Blender OBJ File: C:/blender/blender-2.37a-windows/.blender/untitled.blend
# www.blender.org
mtllib terreno3.mtl
o terreno2_terreno2
v 0.000000 0.000000 73.066330
v 11.718750 0.000000 71.002365
v 23.437500 0.000000 65.095154
v 35.156250 0.000000 59.269215
v 46.875000 0.000000 51.538433
v 58.593750 0.000000 50.123905
v 70.312500 0.000000 51.307514
v 82.031250 0.000000 50.007015
v 93.750000 0.000000 48.594082
v 105.468750 0.000000 42.627319
v 117.187500 0.000000 37.938297
v 128.906250 0.000000 37.162228
v 140.625000 0.000000 34.147972
v 152.343750 0.000000 29.164997
v 164.062500 0.000000 26.168726
v 175.781250 0.000000 25.259737


You can see the source code. The obj loader is still the same. Try to load another obj, please.

I´m using java 1.4.2_08, but i test it with 1.5 and works.
Offline williamsellick

Senior Newbie





« Reply #5 - Posted 2006-01-24 09:25:42 »

I know this is a noobie question but what is the advantage of generating normals and material files?

I am currently just loading an Obj file exported from Terragen and am wondering about the benifits
of changing my setup to something similar to angon2006's. Could anyone tell me the pros / cons
to altering my setup?

Thanks
Offline angon2006

Junior Newbie





« Reply #6 - Posted 2006-01-24 10:20:54 »

I begin loading a terragen exported obj, but the result terrain was very "flat".

To calculate the lighting, i think, the render engine use the material of the face, the light sources and the face normal. Also it´s use the vertex color.

When you load and obj without material/normals, you can generate it. Extends DefaultNodeFactory class and make the work that blender do for me. It´ll been a better method than mine.

Someone know, if in xith, are something like Java3D's NormalGenerator?? Having the face with her 3 vertex, it´s may be easy to obtain the normal.  Huh
Offline jaakko777

Senior Newbie





« Reply #7 - Posted 2006-01-24 10:33:00 »

Obviously you're parsing an HTTP-header... why?
Please, download the obj and the mtl to the hard disk. Verify the obj don´t have HTTP-header inserted by the web server.

Ok, so thats the problem, ill remove the header and test again Wink
Offline Amos Wenger

Senior Member




Everything's possible, but not everything's fun...


« Reply #8 - Posted 2006-01-24 17:07:53 »

IIRC, there is a function in Xith that compute the normals for a whole mesh. But I remember using it I got numerous error messages, and I abandoned it (because 2D game = only textured quads, normals specified by hand Cheesy )

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
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.

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

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

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

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

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

BurntPizza (31 views)
2014-09-19 03:14:18

Dwinin (48 views)
2014-09-12 09:08:26

Norakomi (74 views)
2014-09-10 13:57:51

TehJavaDev (102 views)
2014-09-10 06:39:09

Tekkerue (50 views)
2014-09-09 02:24:56
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!