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.


Messages - .jayderyu

Pages: 1 [2] 3 4 ... 8
16
Support / Re: Helper class for camera operations
« on: February 09, 2010, 10:26:26 pm »
It would be really cool that these camera classes were designed for straight JPCT and put up on the Wiki. I notice a lot of reinventing the wheel happening on this forum. Camera helper as an example. It probably puts some people off since many of the other 3d api already have many more features. Even if extension features aren't part of the core. Making them easy to find would be very helpful.

If I ever finish FilmGrain for GLSL(if I ever start). i'll post that up. As it is now it's a bit heavy duty on the fill rate.

17
Support / Re: Helper class for camera operations
« on: February 09, 2010, 07:07:53 am »
Egon posted this a while back. Personally I think it should be part of Object3D.

Code: [Select]
public SimpleVector deriveAngles(Matrix mat) {
    SimpleVector s=new SimpleVector();
    float[] m=mat.getDump();
    s.x=(float) Math.atan(m[9]/m[10]);
    s.y=(float) Math.asin(-m[2]);
    s.z=(float) Math.atan(m[4]/m[0]);
    return s;
}

'It's funny, because I was going to work on a camera helper class too. Though I wasn't sure it's features so I haven't done much :P

18
Support / Re: Question about transparency
« on: February 08, 2010, 11:42:21 pm »
yeah, i'm not sure what parts use 0-1 and what uses 0-255. I just remember while trying to get filmgrain working right alpha was based on 0-1 not 255.

I'm glad you found the problem. The picture looks nicer now :)

19
Support / Re: Some questions.
« on: February 08, 2010, 11:39:25 pm »
Hi, I have some questions.  Whats the best way to sync two objects together over a network.  Right now I send transformation and rotation matrix clones every 50 ms over an ObjectOutputStream or something like that and also have the keypresses sending so that it can continue to translate the objects in between those 50ms. its pretty good but doesn't seem to be perfect when i have 2 clients open it has a slight delay before one can see the movement.  I was just wondering if theres a better way or perhaps this delay is due to my logic in constructing a pojo to send across the stream and then checking all the objects on the client side to find the one that is referenced by the pojo, etc.
I agree with Wojtek. It's also the standard way to do network game communications. Messages are given as instructional commands not current positions. TURN, MOVEFORWARD.... these commands are then flagged in your update loop so that if say float TURN is <> 0 then your character turns by said amount. that value does not change until a new TURN command has been sent with a new value. More turn or 0 or even the other way. Everycommand you send is also packed with current situation data. so you do send position/angle with every message. Finally you also send this data every so often. You will want to personally test how often you will want to send though. Also you want to keep track of game time. ie time since the game started. So that every message will also send said game time. Finally upon receiving you calculate the difference between gametime of sent message and game time of receiving the message and the figure the difference based on rate of current movement. Finally theres dead reckoning. I would suggest reading up on that.

My early games avoided dead reckoning due to the simplicty of them, but if your going to have combat then deadreckoning is essential.

I don't know the api you are using, but I would really suggest either Java Gaming Network. You can create a binding for  JPCT. Objects through the system it will handle Object syncing. It also uses UDP over the internet. Handles things like packet loss and so on. Theres also project DarkStar(which I use). It doesn't handle object synching, but it's built on a solid scalable server core.


Also why does it seem like sometimes parts of my 3ds file will be in the wrong position when i load it into jpct instead of the position it was in when i open it in 3ds max.  If i use a .obj file though this position problem doesn't happen but i'm not sure how to use textures.  So far I believe this 3ds problem only happened if I cloned a copy of an object, but im not sure.

Thanks,
Disastorm

I've heard of people having this problem. There a sticky on 3ds models in this category. Maybe the solution is in there.

20
Support / Re: Question about transparency
« on: February 07, 2010, 03:28:44 am »
Well I can offer some advice to keep in mind. Though I don't know if it will help.

When using alpha textures(ie textures that have alpha value) the transparency works from 0-255. You got this part fine. What I learned the hard way was that GL or JPCT doesn't use 0-255 transparency. It's 0-1, with 0 being 0% and 1 being 100%.

I don't know if this knowledge will help. But I hope it's something you can work with.

To me it looks like the stars are showing through the billboard. maybe you can turn of transparency in the billboard to see if the layering is right?

btw way nice screenshot :) i'm sure it will look fantastic when everything is working right :)

21
Support / Re: looking for reasonable Object3d net data
« on: February 07, 2010, 12:15:21 am »
I'll try that then. I haven't work a whole lot with networking data before. I've only "finished"(ie playable) one "game" that used networking. I had thought that sending float or int.int  might be a bit heavy on the datapackets. but if your game works well wit it then there can't be that much of a problem with it. i'll take a look through some of the source to. I'm sure I can find some better design in there than what I got.

22
Support / Re: Texture Splatting for Terrain Texturing
« on: February 07, 2010, 12:09:27 am »
I never really understood BLEND myself. You can look at the formula in the OpenGL documentation to see what it actually does, but i never got a feel for the outcome. I've never ever used it except for the detail textures in the terrain demo (i'm not sure if the downloadable version supports that). Just try some other mode.
ahh it's part of the OpenGL stuff. I'll will take a look at that. I thought it might be a JPCT thing.


About the two objects: The terrain demo uses one object mapped with only the base texture and one that contains the rocks and the sand (under water) as well as the vertex alpha values. As long as you are using this approach, you need those two objects. There are other ways (shader based for example) that may not need it, but i've never used them.
I went looking over the code after this comment. I finally get what's fully going on. I originally thought that the setVertexTransparency(poly, vertice, alpha) was in relation to the a new texture over the old texture. When what's happening is that only part of the object is transparent. Allowing the object underneath to be seen. I had made a mistake in regards to how that works. I think I have a clearer picture.

getSourceMesh() returns the SimpleVector[] copy of the mesh that the controller holds. This isn't the mesh that the object itself uses. However, as long as you are manipulating your mesh with the controller only, the controller's mesh and the internal mesh of the object will be in sync. That said, do you really need this geomipmapping stuff? Today's hardware is pretty fast when it comes to pushing polygons. It's usually not needed to use lower res models unless your terrain if really large.
ok thanks. I know it's safe to use now.

I was originally wondering that myself. After a few positional tests of the camera to try a capture the feel of different game styles I noticed a strong performance difference for compileandstrip() in HW mode working with 512x512.
Being low and in the scene produced ok framerates. I suppose there is a lot of culling going on. however as scene goes up towards mountain peaks or towards corners of the scene fps drops a lot. While at the moment I'm not looking to design a flight sim I can see a significant difference. Though I haven't tried splitting the terrain into octrees yet. It's still a single big mesh. I also use 512x512 textures and think that maybe even the locations that are very far off are using the full res texture instead of mipmapped. It still probably worth it to break the map into patches for the mipmapping to work. Though I could be wrong.

23
Support / Re: Texture Splatting for Terrain Texturing
« on: February 06, 2010, 02:32:54 pm »
So I was trying blend mode when setting texture. PolygonManager.setTexture(polyId, textureId, BLEND_MODE);. what I found is that the two brightish textures were super dark. In the distance they look near black. I was wondering how to avoid that. Also I was wondering how to use MODE_ADD_SIGNED to achieve gradual or strong blendings of different textures.

Also I noticed that terraindemo uses two terrain objects to achieve a certain blending effect. I'm not going to have to do that to get similar effects. or do I?


Edit:
just to be clear on IVertexController.getSourceMesh(). This is just a copy of the SimpleVector[] mesh. As I'm looking through the geomipmapping I might need to use it as reference to build the LOD meshes. So I though I would use the VC to pull a copy of the Vertices out.

24
Support / looking for reasonable Object3d net data
« on: February 06, 2010, 02:28:18 pm »
ok so i'm slow an working on my prototype. I've got server/client stuff.. blah blah.

What i'm looking for is rotation data to send in a ByteBuffer. I have jBullet to do most of the work in regards to movement and stuff. I have commands that tell the system to start moving, stopping, turning, stopping.... but I had thought to send sync data with these messages. Looking through Object3D it seems I might have to send a float[16] through system. That seems a bit heavy handed though. I can't really see much data outside of the matrix that I can grab and dump into the remote Object.

25
Support / Re: Haw to draw a line?
« on: February 05, 2010, 09:27:31 pm »
you can use this

Code: [Select]
     Graphics g = frameBuffer.getGraphics();
     Camera cam = world.getCamera();

      //use whatever source vectors you want. if you want to show lines between children and parents
      // use Object3D.getTransformedCenter() instead of a new SimpleVector()
      SimpleVector pointA = Interact2D.project3D2D(cam, frameBuffer, new SimpleVector(0,0,0)); // start
      SimpleVector pointB = Interact2D.project3D2D(cam, frameBuffer, new SimpleVector(1,1,1)); // to

      g.drawLine((int)pointA.x, (int)pointA.y, (int)pointB.x, (int)pointB.y);

26
Support / Re: Texture Splatting for Terrain Texturing
« on: February 04, 2010, 01:18:25 am »
I have a question about Object3D and distance. Is there a way to set it up to automaticly change to a different mesh or object on distance. I was studying up on geomipmapping. Since there is no way to manually alter the mesh. I was thinking of swapping the mesh or Object3D with another. I haven't worked on animation at all, but I suppose it would be a form of animation on distance. So looking through the Animation class I couldn't see anything in regards to distance. What I have learned is that that if there isn't something apparent JPCT still might have something that can do it.

27
Support / Re: quaternions and matrices
« on: February 04, 2010, 12:53:01 am »
Only when your familiar with the process. Otherwise it's a major pain in the @$$.

I remember working with Quaternion before. Just glad that jBullet used 3x3 matrices and JPCT matrice while 4x4 seem to work on 3x3 :P

28
Support / Re: Texture Splatting for Terrain Texturing
« on: January 31, 2010, 03:41:35 pm »
I finally found the thread in question. http://www.jpct.net/forum2/index.php/topic,1479.30.html

the funny thing is that. what the poster was taking about. was along the lines I was thinking of too. That would explain why the vertex shading works well. Thanks for the heads up. Now I just need to make the maps in question for the terrain alpha vertex....

you know. this procedural height mapping, terrain texturing and geomipmapping is getting out of hand for a simple prototype :\

though know how this vertex stuff is really important regardless.

29
Support / Re: Texture Splatting for Terrain Texturing
« on: January 31, 2010, 03:50:01 am »
First. I'm a bit texture stupid :P I understand how UV works and alpha channels. past that i'm a bit duh. So If I make mistakes on my undestanding in my following comments please bear with me :P


"Or use vertex alphas instead like the terrain demo does. It limits it's usage to display different height, but that's just a limitation of the demo, not of the method."
I think I'll try this one. Looking at the terrain video. This effect looks similar. It also looks like it has 3 textures applied. so I assume it can handle more.


"The alpha channel is part of the texture. You can create a new texture out of the dirt texture and the alpha map with the usual Java2D image methods and create a new Texture-instance from that."
Well tiling the texture with alpha set to it would just alpha the tile. Which wouldn't really work.

"To render the base texture independantly, you'll need at least two passes, which means that you'll need two different Object3Ds using the same mesh but different u/v-coords and textures."
Sounds inefficient. :\

"You can set textures on a per polygon level using the PolygonManager or you can assign them for the whole object using setTexture()."
Sounds interesting, but it doesn't sound like it would blend to other textures. Though I suppose you can make a blended texture.

I'm going to certainly try the vertex alpha.

edit:
umm, can't find the source code example for the terrain demo.

30
Support / Texture Splatting for Terrain Texturing
« on: January 30, 2010, 06:40:26 pm »
I was reading up on Oddlabs Procedurality api. I thought it was nifty, while I was reading their talk about game terrain and looking through the api. I noticed there was nothing on texturing. So after some digging around I found out something called Texture Splatting. Visually it meshes with Tribal Trouble and other nice terrain.

http://tribaltrouble.com/screenshots?id=04(I use to use some of their early screen shots as wall paper. When it was just terrain).

Here is I thought a descent reference to how it works.
http://blog.nostatic.org/2007/11/3d-landscape-rendering-with-texture.html

Heres the jist of it as an example.
create a plane say 256x256 by 2units(as meters). That's  512 meters. though size doesn't really matter. Set the UV to tile a textures.

create 2 or more alpha maps. Let's say circles. One is a white circle that slow fades to black. The other is reverse that. Black circle slowly fading to white.
This is a 0-255 alpha map that is translated to a 0-1 as needed.

get 2 textures. one is bumpy grass that is 64x64. or bigger/less. regardless it's a detailed texture that will be tiled. the other can be dirt.

render the plane. texture the plane with the tiled dirt using the white circle alpha map. this results in a dirt circle on the first pass.
on the second texture pass. render the tiling grass texture with the black circle. what happens is that the grass is rendered onto the white alpha values of the surface. Now since both have some grey fade in between both texture will visually create a smooth transition.

I've gone over Object3D. While I could find setAllTextures(String Texture, String bumbmap). I couldn't easily see any way to do alphamaps.

maybe JPCT has something that can do this, but I don't know where I would look.


Pages: 1 [2] 3 4 ... 8