New to Xith3d need advice on aproach to problem.

First of, let me shortly discribe to you what I want to do.
And, oh yeah, im kinnda new to 3d programming but have alot of 2d graphics and java programming experience.

I want to make a isometric landscape consisting of squares at different heights that can be individually texturized.

Is there any type of shape (for example a plane or wireframe) that i should use or should i draw everything from “scratch” with lines (vectors)?

Every advice I can get are good ones, just point me in the right direction.

Best Regards
Klaas Tojkander

depends on how much of a rush your in.

best one (off the top).

make one block. scale it in realtime. make a set of textures- add them to the blocks in realtime also.

set the camera to isometriic.

Wire Frame yes u can do this. but i find it nicer to add a texture that has transparent holes and a sholid outline. but whatever u like :wink:

most importent thing is to try it and have fun.

Ok, first off, thanks for the quick reply.

But hmmm, would making cubes really not be a waste of cpu? Not that im in a hurry, just a theoreticle question?
Since a cube have 3 dimensions but i really only need two. (ae a plane) what im actually looking for is a way to make a mesh, where every point in the mesh (dont know if thats the correct term, im just thinking in 3dMAX terms) and be able to give every point in the mesh its own height. And be able to individually texturize every “square”.

Furthermore, for events (for example when you click a “square”) can a “square” throw a Mouseevent so that i dirrectly know which square has been clicked or do i have to calculate which square has been clicked based on the (x,y) coords?

You should read about terrain.

I also want to do that kind of map (warcraft iii like maps)

First, I did like aNt and then displayed them. But, I found that it was slow. And if you have 4-5 layers, it can be pretty slow, even when you show 10x10 squares. So I think having a large plane, subdivised into small planes could be a nice idea.

But now you have a problem. If I want to put different texture on it, what should I do. Constructing a new texture (ie: taking a base texture, modify it in memory, and apply it to the plane) Or should I make “plane” category. I think constructing the texture is the best idea. Maybe I’m just off the track, if so, someone could bring me back :stuck_out_tongue:

I wanna keep this discussion flowing.

Yepp, i can imagen taht aNt:s contribution is a little resource demanding.

I started this thread in the the first place because because i didnt understand the fundamental design of xith3d. What primitives where at my disposal and if there allready was a class i could use right away for my needs.

Above i mentioned a event related question. Any input?

I’ve done this a few times. The best way seems to be subdivide your complete “plane” into sub areas (each that gets added into a branch group to help with view frustrum culling).

Within each group you create a Shape3D per different texture (since you’ll need to a Shape per texture for appearances sake). Each shape has unique geometry that maps to the tiles that have the appropriate texture.

The other option as indicated above is to build a texture specifically for what you’re going to do and use one plane. You’d still want to split it into subplanes to assist with culling geometry. This has downsides tho (having tried it).

  1. Limits map size and resolution of textures used before performance degredation (since there is only so much texture memory)

  2. The appearance varies dependant on the graphics card and its associated texture handling support.

  3. You nearly always get artifacts between tiles which looks a bit amateurish (at least in my opinion).

I did use this method for drawing a grid over a large section which looked quite nice. (http://www.cokeandcode.com/hulk/150204.gif)

Kev

Intresting. Thanks for the input, kev.

Just two questions really:

  1. Did you use Xith3d too create that example in the screenshot? If not. WHat did you use? Im kinnda distressed by the fact that i havent seen any great examples of what xith can do.

  2. Events, as i mentioned earlier, can you attach an event to a plane? (and immediatly know what caused it.) In comparison to the picking example where you figure it out based on mouse coords.

Oh yeah, any example code on that subdivide thing?

No interesting examples? Have a look at JCD’s cool examples :wink:

I think xith3d is quite new, but we should be seeing even more examples as time goes one (hopefully :p).

I would like to see the abstract layer involving JWJGL, JOGL, Swing and SWT resolved because that could attract more developers.

Yep, the example came from some code I was writing with Xith3D. Performance was pretty good.

Events, not really, what you’ll need to do is write your own picking routine really that converts a point on the screen onto your place. Xith is about to support this itself I hear but I’ve not seen anything to that effect yet. The current picking solution only goes as deep as node and isn’t actually that reliable.

Source code… I thought I posted it somewhere… I can did it out and shoot it over if you’d like. (I know Sputter had a dump of it, did I post it or mail it to you mate?)

Here’s another screenshot of something similar that I’ve also been playing with:

http://www.cokeandcode.com/xith/050104_1.gif

oh and something else:

http://www.cokeandcode.com/xith/060104_1.gif

And another running and working example would be here:

http://www.newdawnsoftware.com/martian

As you can tell I don’t stick with things long but I think the source for most stuff is available.

Kev

Nice samples Kev! In particular this one: how did you do that spot light effect - with a normal Xith/J3d spot light source?
Looks impressive anway.

Na, not a SpotLight, I believe this was my foray in playing with the Stencil buffer.

  1. Render the scene
  2. Render a spot light geometry into the stencil buffer
  3. Render the appropriate parts of the scene with lighting to the “stenciled” areas.

Kev

Further to this I’ve dug out the source for Hulk and Martian Madness, its here

http://www.cokeandcode.com/hulk/Hulk.zip
http://www.cokeandcode.com/hulk/Martian.zip

No resources are included, you’d have to grab them from the jars. I make no odds of the code being a bit poor in places.

Hope its of some help,

Kev

Just adding thought about the 2D layed out map.

I thought of something if you want to do more detailed tile like Warcraft 3 or Command & Conquere.

Let’s say you subdivid your terrain into plane. A plane is a tile. A plane can have as many poly as you want. But it’s always the same size (let’s say 4x4 units). What you can do with that plane is:

  • play with a height modifier on every point of a polygone.
  • You can do a simple average of the border height so you can allign it with the tile next to it.
  • one texture by tile.

You align every tile and you have a terrain like map… I don’t know if it can be good that way?

That sounds like a terrain really. If you want to implement a terrain based map you might want to check out the Xith Terrain demo/library.

Tile based maps normally have the constraint that they must support having a different texture per tile. Modifing the height is logically quite simple after that.

Kev

hi
Kev , where i can get Hulk jws? thanks a lot for code. it helps mutch

Fraid Hulk never got as far as having a JWS, was more sort of the beginings of a game/demo.

Kev

so too hard “grab resources from .jar” :stuck_out_tongue:

:wink: Good point!

I’ll see if I can did out the associated resources… gis an hour or so…

Kev

[quote]That sounds like a terrain really. If you want to implement a terrain based map you might want to check out the Xith Terrain demo/library.

Tile based maps normally have the constraint that they must support having a different texture per tile. Modifing the height is logically quite simple after that.

Kev
[/quote]
But, I really want a tile based terrain like map :stuck_out_tongue: Should I use terrain and make virtual tile. And can I assign diffrent texture for different tile

let’s see an exemple

With the terrain I can change every polys height and form. But can I assign grass.jpg to the tile (1,1) and sand.jpg to tile (2,3) ?

The system I proposed was different plane (tile) next to each other to build a terrain like map. And if I want, assign grass.jpg to plane (tile) (1,1) and sand.jpg to plane (2,3). If you tell me that I can do this with a terrain, I mean ONE terrain not 2 or 3 “zone”, then I’ll take terrain. I just want to make things clear here :stuck_out_tongue:

Ok, good.

Kev