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] 2
  ignore  |  Print  
  HUD, textoverlay with Java3D and wiered stuff...  (Read 4667 times)
0 Members and 1 Guest are viewing this topic.
Offline TexMurphy

Senior Newbie




Java games rock!


« Posted 2003-06-25 12:32:04 »

Since Im doing a space sim I really need a HUD.

I get really wiered shit going on when doing any kind of overlays. I have done this two ways with same wiered shit happening.

First one I have done with the Text2D object. I know that this causes huge overhead when changing the text so I have just had it be a static text. I have added this text to the view platform with a PlatformGeometry.

The second way was using the HUD classes at http://www.newdawnsoftware.com/

In both cases the hud works really well when within 10.000 units range of the 0 0 0 point in the coordinate system. But if I place my ship at say 50.000 units  (or fly it there) range from the 0 0 0 point the overlay bounces like mad on the screen when turning or moving.

The further I am away from the 0 0 0 point the bigger the bounces on any overlay I have.

Anyone got any idea what can cause this?

The rendering is really smooth when Im close to the 0 0 0 point with virtually no gc caused skipping.

The bouncing is not relative to movement speed or to rotation speed from what I have tested just to distance from 0 0 0.

Hope someone has a clue, I dont atm. Sad

Thanks in advance.
Tex  
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #1 - Posted 2003-06-25 13:20:21 »

Hi
 What are your front and back clip distances set to?, what depth have you placed the HUD?

Thanks

Endolf

Offline TexMurphy

Senior Newbie




Java games rock!


« Reply #2 - Posted 2003-06-30 17:10:14 »

I got the hud objects within the clipping range. So if I have clipping range at 20/20000 I have the Text at 25.

Tex.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline DavidYazel

Junior Member




Java games rock!


« Reply #3 - Posted 2003-07-01 14:38:26 »

We have the same problem and have never solved it.  I believe this is a problem with inaccuracies in the matrix transformation precision between the view and the image plate aligned geometry.  Tiny imperfections creap into the inverse transformation used to face the hud at the camera which are not present when the camera is near the origin.  we all know how sensative the screen aligned geometry is... there is no tolerance for the slightest error or else it will not align with the pixels on the screen.

Unfortunely I have never been able to figure out a way to solve this problem in java3d since the view model is non-mutable.  BTW this happens whether it is platform geometry or geometry in the scene.  It starts about 6,000 from the origin

David Yazel
Xith3D Project Founder
http://xith3d.dev.java.net

It may look complicated, but in the end it is just a bunch of triangles
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #4 - Posted 2003-07-01 15:06:59 »

Hi
 One *really* bad work around, add another transform group above the rest of your scene, and periodically (when the view is more than say 5000 units from 0,0,0), multiply the transform by the inverse of the view matrix, and set the view matrix back to 0,0,0, this way you will never be more than 5000 units from the origin, and the HUD/j3d.orgs overlay should work. But it is a nasty work around, rather than a solution.

HTH

Endolf

Offline TexMurphy

Senior Newbie




Java games rock!


« Reply #5 - Posted 2003-07-03 09:35:29 »

Workaround manupilation of possition will be a freekin pain to do as Im doing a online game. The server is always the master for position and keeping track of player positions that have been manupilated by the client will always be a freekin pain.

My next attempt is to scale all my models down ALOT so that the region where it freeks out is deep deep deeep space. Im gonna try scale down by a factor 100 or 1000. Most likely the models will look like crap but if they dont I do move the bad region to like 5mil out this way and that would be out of range for my game to have any problems.

Tex
Offline Breakfast

Senior Member




for great justice!


« Reply #6 - Posted 2003-07-03 10:41:41 »

Why not have a grid of zones held in your central universe and then give each zone it's own co-ordinate system/Java3D environment to locate ships in it?
Offline TexMurphy

Senior Newbie




Java games rock!


« Reply #7 - Posted 2003-07-03 11:38:48 »

Quote
Why not have a grid of zones held in your central universe and then give each zone it's own co-ordinate system/Java3D environment to locate ships in it?


Wouldnt that require that each zone is its own SimpleUniverse?

Actually creating a huge world of connected zones with their own coordinate system is a very interesting thought as you virtually could create a HUGE universe that way. Wormholes/Jumpgates could move you from one zone to another somewhere totally else in the universe or you could fly there.

Though I do see two problems with this. One is just the insane ammount of memory this could use to just store all the zones. Second is fights at zone edges if they are their own SimpleUniverses, people with low ping and fast machines using these borders to lag out slower players.

Though if the client always preloaded all the bordering zones the zone transition could be made smoother.

But the zones can by no means be as small as 10000 meters so I still have to scale down alot I guess.

Tex
Offline TexMurphy

Senior Newbie




Java games rock!


« Reply #8 - Posted 2003-07-03 11:40:33 »

Another issue with the Zones. Radar.

It will be extreamly hard to do a radar that can look into the next zone. As a radar has a fixed range and when you are say 1000 meters from the next zone the radar would be covering 39000 meters of the next zone (radar range 40000).

Tex
Offline kevglass

JGO Kernel


Medals: 170
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #9 - Posted 2003-07-03 13:00:01 »

Wouldn't you usually use Locale for this type of zoning.

Kev

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Breakfast

Senior Member




for great justice!


« Reply #10 - Posted 2003-07-03 13:19:26 »

Yes, I did mean Locales I couldn't think of the right word.

If I was doing this, I would probably keep the zones quite small  so you can keep your current one and closest neighbours in memory at once. Everything else can be held on the disk (or server, if you are being multiplayer, or both) until needed.

The radar information doesn't have to come from the 3d view- that kind of stuff should be running off the data model anyway, surely, so that is less of an issue.
Offline bmyers

Junior Member





« Reply #11 - Posted 2003-07-03 13:24:43 »

Quote


Actually creating a huge world of connected zones with their own coordinate system is a very interesting thought as you virtually could create a HUGE universe that way. Wormholes/Jumpgates could move you from one zone to another somewhere totally else in the universe or you could fly there.

Tex


That's what we're doing (in progress) with Galactic Village... Grin

Offline kevglass

JGO Kernel


Medals: 170
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #12 - Posted 2003-07-03 13:28:53 »

This is of course exactly what the one and only true space game did, Elite.

Kev

Offline Breakfast

Senior Member




for great justice!


« Reply #13 - Posted 2003-07-03 14:10:45 »

Why has no-one matched Elite yet? Every attempt just seems to be missing that essential spark, or just isn't genuinely freeform...
Offline kevglass

JGO Kernel


Medals: 170
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #14 - Posted 2003-07-03 14:38:15 »

No, its the same with many old games, you remember them with a rose tinted thought retrievel system. The games at the time were fantastic, but by todays expectations they would be average at best.

Try playing elite plus now, it soon gets boring.

Kev

Offline TexMurphy

Senior Newbie




Java games rock!


« Reply #15 - Posted 2003-07-05 10:58:40 »

Hmmm Locales.

If I understand it correctly everything is one branch tree but all objects within the same region are part of the same Locale. Is that correct?

Question though when I am in one locale does Java 3D still render the objects in other locales if they are within clipping range? If that is true this would actually be fantastic and exactly what I need. This way I could create a really big galaxy wich would be really cool.

Finally does anyone have some sample code on Locales?

Thanks
Tex.
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #16 - Posted 2003-07-10 15:05:09 »

Hi
 I'm having exactly the same thougts. When I commented on the work around I had assumed your data model and graphics where seperate enough that the server and data model see the object at one location, but you can them process that client side data to create and update the 3d scene, this way you always view from 0,0,0, and then have another transform just above the rest of the scene for the rest of the world that contains the inverse of the playres location.

If you scale down your world by 100 or 1000 you screw up the clipping, it's like setting the fronta nd back clip ration to 100 or 1000 times greater, your zbuffer will have the same problems, but at distances 100 or 1000 time smaller.

Locals are something I will look at when I'm done the current sub project and linux jinput code.

Cheers

Endolf

Offline TexMurphy

Senior Newbie




Java games rock!


« Reply #17 - Posted 2003-07-13 14:01:06 »

Ive done the 1000 times scale down for the moment. It works ok. I have scaled everything including physics and clipping. Though Im not happy with this solution as I cant have gigantic sectors that cover millions of kilometers but I have to chop things up into sectors that you jump between.

So if anyone will come up with a good way to use locales for this. Please post here.

Thanks
Tex.
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #18 - Posted 2003-07-13 18:35:53 »

Hi
 Having sectors of millions of kilometers isn't practicle with the z buffer depths of gaming graphics cards. There is a document floating around at http://www.starfireresearch.com/services/java3d/supplementalDocumentation.html#zbuffer that shows that for consumer graphics cards a front to back clip ratio of 3000 is the worst case, that means front clip at 1m, back clip at 3000m, which doesn't quite cover millions of kilometers, best case is probably 130km,worst case 3km, this leaves us stumped without locals and nasty work arounds. One sector of 10e6 just aint gonna happen with out some nasty code Sad

Cheers

Endolf

Offline Conzar

Junior Member




There is nothing common about common sense


« Reply #19 - Posted 2003-07-13 19:45:40 »

As I understand it, FrontClip and BackClip are relative to the position you are currently in.

For instance, if you are at 0,0,0 then you can see a max of 3000 meters
So the furthest position in view is 3000,3000,3000 (note it could also be any combination of the x,y,z coordinates being -3000 and 0).

So if you move to 10,0,0 then you can see 3010,3000,3000 to 10,3000,3000


So having a world like Tex is talking about is feasible.

Ubuntu
Offline MSchnieders

Innocent Bystander




Java games rock!


« Reply #20 - Posted 2003-07-13 23:20:33 »

Does the HUD only work with Perpsective Projection? It seems from the little I've played with it that this is the case.

I need Parallel projection for the project I'm working on. Is is possible to configure the NewDawn code to work in this mode?

Thanks,
Mike
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #21 - Posted 2003-07-14 06:30:00 »

Quote
As I understand it, FrontClip and BackClip are relative to the position you are currently in.
<snip>
Quote

So if you move to 10,0,0 then you can see 3010,3000,3000 to 10,3000,3000


So having a world like Tex is talking about is feasible.

 yes. but for some reason java3d does something weird, and once you move too far it all goes strange (depth buffer errors creap in). Also, anything more than 3km away will be clipped so you can't see it, ok for small ships, no good for planet sized objects Smiley. So you end up rendering those objects offscreen, then pasting them in as part ofthe background, ick. Just pointing out that waht ever you do there will be some nasty work arounds. This (Java 3d, directX or opengl) is a real time rendering engine, not a renderer, so there will always have to be some tricks to get it to look like what we want.

Cheers

Endolf

Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #22 - Posted 2003-07-14 07:44:17 »

Quote
Does the HUD only work with Perpsective Projection?

It *should* work, although I've not tried it, I'll take a look.

Cheers

Endolf

Offline Conzar

Junior Member




There is nothing common about common sense


« Reply #23 - Posted 2003-07-17 02:10:59 »

Quote
Does the HUD only work with Perpsective Projection? It seems from the little I've played with it that this is the case.


Yea, it works but it looks really funky if you used perspective.  Also, you get the same effect as you did with perspective so I don't think there is any gain moving to Parrallel Per (at least in my case I can't think of a reason but you guys might).

Oh yea, I tried this but it didn't work:
At the root of your graph, I added a TransformGroup and then added all the other components beneith that (excpet for your HUD/view).  Then when you move, you modify this root transform and I was thinking that would make like the player was moving but really the entire environment would move.  Your view would stay at (0,0,0).  

I guess the problem with this is if you add a BranchGroup under that, then the transform information stops Huh  What do you guys think?

Ubuntu
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #24 - Posted 2003-07-17 08:03:37 »

Quote
I guess the problem with this is if you add a BranchGroup under that, then the transform information stops   What do you guys think?

If you have a transformgroup, and place a branchgroup under it, the transform will effect everything under it, including anything in the branchgroup. My code is full of such things.

HTH

Endolf

P.S. Looking at parallel projection in the HUD is still on my list of things to do, but it's a long list atm.

Offline Conzar

Junior Member




There is nothing common about common sense


« Reply #25 - Posted 2003-07-17 10:46:54 »

Opps.  I correct myself.  What I described in the above post works!!!  I messed up the implementation of it (I added the view to the root transform group w/ everything else so my view was moving when everything else was moving).  All I did was add the view to the root branch group instead of the transform and it worked.


Quote
At the root of your graph, I added a TransformGroup and then added all the other components beneith that (excpet for your HUD/view).  Then when you move, you modify this root transform and I was thinking that would make like the player was moving but really the entire environment would move.  Your view would stay at (0,0,0).

Ubuntu
Offline Conzar

Junior Member




There is nothing common about common sense


« Reply #26 - Posted 2003-07-18 16:43:38 »

So what I have mentioned above takes care of your HUD shacking but it does introduce a new problem.  That problem is figuring out how the rest of the world should move relative to you.  Rotation seems like it would be hard to do but that can be taken care of for you easily depending on how you setup your TransformGroup structure.  This is what I did.
Below shows how each TransformGroup is connected so trans is a child of rotZ, ect.

rotX -> rotY -> rotZ -> trans

So if you do this, the world rotates properly.  The next question, and the one I have been stuck on for a couple of days is, how do you figure out what to set the trans to be each time say you move forward (once you have rotated)?  

Better stated, when you rotate, we want to be able to go in that direction.  Any suggestions on how to cacluate the Transform for that?



Ubuntu
Offline kevglass

JGO Kernel


Medals: 170
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #27 - Posted 2003-07-18 16:46:42 »

Create a vector that goes into the z axis. Use your transforms to .transform() the vector. It will then point in the direction of your camera.. move using this vector?

Kev

Offline Conzar

Junior Member




There is nothing common about common sense


« Reply #28 - Posted 2003-07-18 18:48:18 »

do you mean:
1  
2  
3  
4  
5  
6  
Vector3f vec = new Vector3f();
vec.z = (value you want to travel);
rotX.transform(vec);
rotY.transform(vec);
rotZ.transform(vec);
trans.set(vec);


If so, then this doesn't do it for me either.  Maybe i'm not thinking about this correctly Huh

Ubuntu
Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #29 - Posted 2003-07-18 20:26:54 »

Once you have your rotated vector so that it is aligned with the direction the camera is facing you add it to your camera/player position and you are done.   Movement in the direction of the camera relative to the world.  You won't be changing the rotation transform as a result of moving forward.

Pages: [1] 2
  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 (39 views)
2014-09-24 16:13:29

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

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

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

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

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

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

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

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

BurntPizza (54 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!