Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - paulscode

Pages: 1 2 [3] 4
31
Support / Interact2D
« on: October 15, 2008, 02:52:53 am »
Another question related to rotations.  I am planning to use Interact2D.reproject2D3D(Camera camera, FrameBuffer buffer, int x, int y, float z) for interacting with the world via the mouse.  I assume the returned SimpleVector is in Camera space, so I would need to apply the camera's rotations (inverted I assume) and translations to it to get a SimpleVector in world space.  Translations are a simple matter of addition, but what methods do I use for rotations?  I'm guessing I would start with this:

Code: [Select]
Matrix m = myCamera.getBack().cloneMatrix().invert3x3();
Then what method do I use to apply this matrix to the SimpleVector?

Thanks for the help, BTW.  I know I am asking questions that have been asked before.  I just have trouble finding things in the forums occasionally.

32
Support / Setting a Camera's orientation
« on: October 13, 2008, 01:03:46 am »
What is the best way to set a camera's orientation?  I can use the lookAt() method to tell the camera which direction to point, but I am having a little trouble figuring out a simple way to set the camera's up direction.

33
Support / Calculating vertice normals in a VertexController
« on: September 28, 2008, 10:00:10 pm »
I am sure this question has been answered before, but I am having trouble locating a previous thread about it.  I am generating a terrain which is made up of a grid of squares.  Each square consists of two polygons and four vertices:

(1)---------(3)
 | \              |
 |     \          |
 |         \      |
 |             \  |
(2)---------(0)

(the numbers represent the index of each vertex).

Each square in the terrain has its own GridVertexController (which extends GenericVertexController and implements IVertexController).  The GridVertexController class has four SimpleVectors:
Code: [Select]
    SimpleVector vertex0, vertex1, vertex2, vertex3;
My program changes these four SimpleVectors to represent the new values for the square's vertices.

In the apply() method, I update the getDestinationMesh() array, and then attempt to update the getDestinationNormals() array:

Code: [Select]
    public void apply()
    {
        SimpleVector dstVertex[] = getDestinationMesh();
        SimpleVector dstNormal[] = getDestinationNormals();
        SimpleVector A, B, C, D;
       
        dstVertex[0].set( vertex0 );
        dstVertex[1].set( vertex1 );
        dstVertex[2].set( vertex2 );
        dstVertex[3].set( vertex3 );
       
        A = vertex1.calcSub( vertex2 );
        B = vertex0.calcSub( vertex2 );
        C = A.calcCross( B ).normalize();
        dstNormal[2].set( C );
       
        A = vertex0.calcSub( vertex3 );
        B = vertex1.calcSub( vertex3 );
        D = A.calcCross( B ).normalize();
        dstNormal[3].set( D );
       
        D.add( C );
        D = D.normalize();
        dstNormal[0].set( D );
        dstNormal[1].set( D );
    }

The vertices are changed correctly, but there seems to be a problem in the algorithm I'm using to calculate the normals, because lighting on the terrain is not correct.  For example, if I generate a flat terrain on the x/z plane with a light source directly overhead, the terrain still appears dark.

34
Projects / Robot Builder
« on: September 21, 2008, 12:50:23 am »
-- This slot is reserved for resources, links, and screen shots --

 

Robot Builder 2D  (Unfinished)
My original 2D version of Robot Builder.

3D Robot Viewer
Applet I created to test my 3D robot.


Robot Odyssey  (Wikipedia)
The inspiration for Robot Builder

The Robot Odyssey Resource
AppleWin emulator and Robot Odyssey disk images

35
Bugs / Camera's up-vector y-coordinate may be signed incorrectly.
« on: September 15, 2008, 06:03:35 am »
I noticed that returned vectors for the Camera's default orientation are:

getDirection() returns: (0, 0, 1)
getUpVector() returns: (0, 1, 0)

This should mean the camera is facing into the screen and upside down (since -y is "up" in jPCT).  I am not sure if this is a bug or not, but I thought I would bring it up just in case.  It seems possible that the returned y-coordinate for the camera's up-vector is signed incorrectly.  Reason I say that is because when converting the returned values for direction and up into OpenAL coordinates, sounds are playing backwards (i.e. coordinates for an Object3D to the left create sources to the right when the listener's orientation is synced with the camera).  This is what one would expect if the listener were facing the same direction but upside down in relation to the camera.  Of course the most likely cause for this odd behavior is a bug in my code and not a bug in jPCT, but it does seem possible that the camera's actual default up-vector is really (0,-1,0) and the method Camera.getUpVector() is somehow returning an incorrectly signed value for y.

36
Feedback / New LWJGL 2.0 Beta 1 AppletLoader problem and workaround
« on: May 17, 2008, 03:40:40 pm »
The new LWJGL 2.0 Beta 1 was released on April 20, 2008.  As you all probably know, jPCT uses LWJGL for the hardware rendering mode, and in an applet this generally requires using LWJGL's AppletLoader.

Then biggest change in this release (from an AppletLoader perspective) is that it now has support for lzma and pack200.  I had some time today to work with the new AppletLoader.  Usage is similar to previous releases, but most of the files have been changed from JAR's to LZMA's.  There is a problem, though.  If you try loading an applet over the internet with it, you will receive the following error:
Fatal error occured (4): Could not verify signing in resource: lwjgl.jar.pack.lzma

The problem is not mentioned in the included documentation, and the bundle does not come with JAR's to use instead of the LZMA's.  I posted the problem on the LWJGL forums, and was informed that it is related to the following bug:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6697988

Until this bug is fixed, you can use the following work-around:

1) Create a text file named ".htaccess".
If you are running Windows, it will complain, because that is not a valid filename, according to Bill.  You'll have to name it something like ".htaccess.txt", then rename it later after uploading it.

2) Edit the file you created with a text editor, like notepad.  Add the line:
AddType application/x-lzma .lzma

3) Save your file, and FTP it to wherever lwjgl_util_applet.jar and lzma.jar are located.  If necessary, rename your file ".htaccess" (remove the ".txt" extension)
Make sure you are allowed to use .htaccess before doing this!  Some of the things that .htaccess is able to do can compromise a server configuration.  For this reason, some web hosting companies may require them to be set up by an admin, so don't get in trouble.  You should CHMOD your .htaccess file to 644 (RW-R--R--) to prevent people from messing with it

That's it.  Hope you find this helpful!

37
Projects / jPCT Birthday E-Card
« on: April 22, 2008, 09:34:42 pm »
My wife's birthday is in a couple of weeks (May 3).  She likes personalized things like home-made cards, crafts, etc.  She prefers gifts that you have to spend a little time to make, rather than taking the easy way out and buying her something.  So I decided to make her sort of a 3D "E-Card" using jPCT.  (She never reads these forums, so it's safe to talk here ;D)  I'm thinking a 3D animation of a guy and a girl who embrace, music in the background, and a message popping up.  I've already finished the man character and am almost done with the woman character.  I am using photos of my wife and me to texture them.  They don't look a lot like us, but it is an acceptable approximation.  I'll post my progress here, as well as the finished applet (after her birthday, of course, so she sees it first).  Any ideas are welcome, although I may not be able to implement them since I have a pretty tight deadline for this project.

38
Support / Character Poly Number
« on: April 18, 2008, 01:42:56 am »
I am sure there are a range of opinions on this issue, but I was wondering what some of you think is a reasonable number of polys that a character should have in a MMORPG?  There isn't really a right or wrong answer here, I just want to get a feel for what some more experienced game developers think.

39
Support / Character Animations
« on: April 11, 2008, 02:11:21 am »
This question is not about a particular problem, but more for some general advice.  I've gone through the tutorials in Autodesk 3DS Max for modeling biped humanoids and animating them, and I believe I now have a pretty good grasp on how to model and animate characters from within the Autodesk program.  My question now is, what is the next step?  How do I take this new knowledge and begin animating a 3D character in a jPCT program?  I'd like to start with something simple like a walking animation or waving or something like that.  I know that a few of you have character animation experience.  Do you happen to have any good pointers for someone like me who is just starting out?  Thanks in advance!

40
Support / Thread-safe question
« on: March 23, 2008, 10:44:56 pm »
This is a basic question more related to Java, I think, than jPCT.  I am rather new to threads, so I want to make sure I using good programming technique.  My question is: Is it is safe to call the following methods from a seperate thread (I am checking if the objects are null immediately before calling the methods):

Camera:
    getPosition()
    getDirection()
    getYAxis()
Object3D:
    getTransformedCenter()

I suppose it could be possible that the instance in question could have been changed or deleted during the nanosecond between when the "if" statement checks if the object is null and when one of these methods gets called.  How likely is that scenario, and other than that, is it likely that calling any of these methods from a seperate thread might lead to other exceptions/errors?

41
Support / How to Model Humanoids
« on: March 21, 2008, 12:31:24 pm »
Could anyone direct me to a good guide (or three) for learning how to model 3D humanoid characters in 3D Studio Max?  I am a pretty good sketch artest, but 3D modeling is a whole 'nother beast.  My initial attempts have been disasterous!  :o

42
Support / Camera position and orientation
« on: March 15, 2008, 12:45:50 am »
Hello, I have another simple question.  I need to be able to access the camera's position, a look-at point, and a point in the up-direction.  Looking through the classes, it looks like the methods I will need to use are:

getPosition()        // World Position
getDirection()       // look-at *direction*
getYAxis()           // up-direction *normalized*

My theory is that to get a look-at point, I would add getDirection() to getPosition(), and to get a point in the up-direction, I would add getYAxis() to getPosition().  Since I will be using this idea in methods which are not related to graphics, it would be difficult for me to test if this theory is correct, so I thought it would be smart to ask the experts first ;D  Thanks!

43
Support / Translation Tipoff
« on: March 14, 2008, 10:55:59 pm »
Hey, I was wondering if there is a method in Object3D that gets called from a child object when it's parent gets translated.

I want to bind to an object to know when it gets moved.  The way I was thinking of doing this, is to create a class that extends Object3D and registering it as a child to the object in question.  Then, I would just need a way to be tipped of that a translation has taken place, and then figure out what that translation is ( I could use getTranslation() for the later, right? )

44
Projects / 3D Sound System
« on: March 11, 2008, 02:38:51 am »
-- This slot is reserved for the most recent working releases --

Downloads:

Sound System  Version date:  October 23, 2010
The core SoundSystem library, independent from 3rd-party libraries.  It is stripped down to the bare essentials, and designed to be easily customizable with various sound library and codec plug-ins.  If memory is a concern (such as in an applet) this may be a good option, because it allows you to choose as many or as few plug-ins as you require for your project.  NOTE: The core SoundSystem library without any plug-ins is only capable of playing MIDI files.  Additional plug-ins should be added for more capabilities.  The source code and license are included in the .zip file.

Sound System jPCT  Version date:  October 23, 2010
The jPCT-friendly 3D sound library.  The SoundSystemJPCT class overrides the core SoundSystem libray, and provides a number of methods to make adding 3D sound to any jPCT project easy.  It includes methods for binding Listener to Camera and Sources to Object3Ds, as well as using SimpleVector parameters.  SoundSystemJPCT utilizes the LWJGL binding of OpenAL (with JavaSound as a backup option), and the J-Ogg library for .ogg support.  NOTE: The core SoundSystem library, source code, and all relevant licenses are included in the .zip file.

SoundSystem Utils  Version date:  August 8, 2009
Includes a SoundSystem loader, and an example XML file.


Plug-ins:

JavaSound library plug-in  Version date:  October 23, 2010
Interface to the Java Sound API.  More compatable than OpenAL, but not as high quality and fewer features.  This plug-in utilizes JavaSound's panning and volume control methods to simulate an reasonable-quality 3D sound system.  Known bug: quickPlaying sounds will begin playing them at full volume for a split second, before switching to the correct volume.  This is a bug with the Java Sound API itself, and therefore beyond my control to correct.  An easy workaround is to add 0.02 seconds of silence to the beginning of each sound effect (the free Audacity sound editor works well for this).

LWJGL OpenAL library plug-in  Version date:  August 24, 2010
Interface to the LWJGL binding of OpenAL.  The LWJGL library (http://www.lwjgl.org) is required for this plug-in to work.  This library sounds much better than Java Sound, but is not as compatable.  I recommend using the JavaSound library plug-in as a backup option.  NOTE: Please read the included LWJGL license.

JOAL library plug-in  Version date:  August 29, 2011
Interface to the JOAL binding of OpenAL.  The JOAL library (http://jogamp.org) is required for this plug-in to work.  As mentioned previously, this library sounds much better than Java Sound, but is not as compatable.  I recommend using the JavaSound library plug-in as a backup option.  NOTE: Please read the included JOAL license.

WAV codec plug-in  Version date:  October 23, 2010
Adds support for .wav files.

JOgg codec plug-in  Version date:  August 24, 2010
Adds support for .ogg files using the J-Ogg library.  This codec is less compatible than the JOrbis codec, but the license is less restrictive.  Sometimes running incompatable .ogg files through a converter will make them compatable.  NOTE: Please read the included JOgg license.

JOrbis codec plug-in  Version date:  November 23, 2010
Adds support for .ogg files using the JOrbis library.  More compatible than the JOgg codec, but reads data more slowly (it may not be possible to stream more than one file simultaneously when using this codec).  This plug-in is licensed by the LGPL.  NOTE: Please read the included LGPL document.

IBXM codec plug-in  Version date:  August 24, 2010
Adds support for Protracker, Fast Tracker 2, and Scream Tracker 3 (.s2m, .mod, and .xm) files using the IBXM library.  File sizes for these formats tend to be quite small, so this may be a good option for background music.  This plug-in is based on or using the IBXM library, which is bound by the BSD License.  NOTE: Please read the included license document.

JSpeex codec plug-in  Version date:  August 24, 2010
Adds support for .ogg or .wav files encoded with Speex (a compression optimized for human voice).  See http://www.speex.org/ for more information.


Documentation:

JavaDoc  Version date:  October 23, 2010
Also includes the JavaDocs for SoundSystemJPCT and all library and codec plug-ins, and the utils library.

3D Sound with SoundSystem  PDF (download the example programs)
A tutorial-style guide to using the core SoundSystem library (last updated: April 14, 2009).

Guide to SoundSystemJPCT  PDF (download the example programs)
Another tutorial-style guide to using SoundSystemJPCT. (last updated: April 14, 2009).


Demos:
(last updated: August 21, 2010)

Sound Effects Player  (download the Source Code)
Demonstrates library switching on the fly, streaming background music, playing MIDI, and playing multiple sources simultaneously.

Bullet / Target Collision  (download the Source Code)
Demonstrates the LibraryJavaSound plug-in.

Holy Bouncing Helicopter Balls!  (download the Source Code)
Currently uses the SoundSystem core -- I'm currently working on a version for SoundSystemJPCT, which will be much simpler.  Demonstrates moving through a world with multiple sources.


What's new?

- Fixed JOAL package name from the old net.java.games.joal to the new com.jogamp.openal
- Updated CodecWav link to current version
- Improved LibraryJavaSound performance slightly in non-Sun Java versions
- Handled rare pan-control exception
- Fixed fadeOutIn bug which caused fade-in effect to be silent
- Fixed a bug where certain types of .ogg files created in versions of Audacity were cut off just before the end of the sample

45
Support / How to Hardware Mode
« on: February 24, 2008, 09:04:22 pm »
I am having a little trouble getting my applet to run in SAMPLINGMODE_HARDWARE_ONLY.
The Sun Java Console shows:
Code: [Select]
Java version is: 1.6.0_03
-> support for BufferedImage
Version helper for 1.2+ initialized!
-> using BufferedImage
Software renderer (OpenGL mode) initialized
java.lang.NoClassDefFoundError: org/lwjgl/opengl/Display
at com.threed.jpct.GLHelper.findMode(Unknown Source)
at com.threed.jpct.GLHelper.init(Unknown Source)
at com.threed.jpct.GLRenderer.init(Unknown Source)
at com.threed.jpct.FrameBuffer.enableRenderer(Unknown Source)
at com.threed.jpct.FrameBuffer.enableRenderer(Unknown Source)
at com.threed.jpct.FrameBuffer.enableRenderer(Unknown Source)
at jPCTGears.init(jPCTGears.java:48)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Here is the code in question:
Code: [Select]
    // Initialize all components of the applet
    @Override
    public void init()
    {
        // sign the applet up to receive mouse messages:
        addMouseListener( this );
        addMouseMotionListener( this );
       
        world = new World();  // create a new world
       
        World.setDefaultThread(Thread.currentThread());

        // create a new buffer to draw on:
        buffer = new FrameBuffer( width, height, FrameBuffer.SAMPLINGMODE_HARDWARE_ONLY );
        buffer.enableRenderer( IRenderer.RENDERER_OPENGL );
        buffer.disableRenderer( IRenderer.RENDERER_SOFTWARE );

        // load some 3D objects and make sure they have the correct orientation:
        redGear = loadMeshFile( "RedGear.3ds" );
        redGear.rotateY( (float)Math.PI / 2.0f );
        redGear.rotateMesh();
        redGear.setRotationMatrix( new Matrix() );
        redGear.setOrigin( new SimpleVector( 0, 0, 0 ) );
        redGear.build();
        greenGear = loadMeshFile( "GreenGear.3ds" );
        greenGear.rotateY( (float)Math.PI / 2.0f );
        greenGear.rotateZ( 0.35f );
        greenGear.rotateMesh();
        greenGear.setRotationMatrix( new Matrix() );
        greenGear.setOrigin( new SimpleVector( -145.0f, 0, 0 ) );
        greenGear.build();
        blueGear = loadMeshFile( "BlueGear.3ds" );
        blueGear.rotateY( (float)Math.PI / 2.0f );
        blueGear.rotateZ( 0.40f );
        blueGear.rotateMesh();
        blueGear.setRotationMatrix( new Matrix() );
        blueGear.setOrigin( new SimpleVector( 0, 135.0f, 0 ) );
        blueGear.build();

        // Set up a pivot point for the entire gear assembly:
        //assemblyPivot = new Object3D(1);
        assemblyPivot = Object3D.createDummyObj();
        assemblyPivot.setOrigin( new SimpleVector( 0, 0, 0 ) );
        // Make the gears children to assemblyPivot.
        // Translations and rotations to assemblyPivot
        // will affect the entire gear assembly:
        assemblyPivot.addChild( redGear );
        assemblyPivot.addChild( greenGear );
        assemblyPivot.addChild( blueGear );
               
        // add the objects our world:
        world.addObject( redGear );
        world.addObject( greenGear );
        world.addObject( blueGear );
        world.buildAllObjects();
       
        lookAt( redGear );  // make sure the camera is facing towards the object
        letThereBeLight();  // create light sources for the scene
    }

The applet only works when I use SAMPLINGMODE_NORMAL and RENDERER_SOFTWARE.  I am sure it is something simple I am doing incorrectly.  I am just having a little trouble figuring out what.

Pages: 1 2 [3] 4