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 - raft

Pages: 1 ... 130 131 [132]
1966
Feedback / kind of brain storming
« on: February 17, 2005, 05:55:14 am »
i have a two roomed world (each an object3d) with a door or tunnel combining the two rooms. i created an octree from each, assigned the octree to room and turned on collision detection for octree.

i assumed while going through the door a collision will be detected. but it didnt. why ? or doesnt it work that way ? if there isnt a polygon there, you cannot collide it.

if so, how can i implement such a door mechanism. i want to be notified when something passes there but i dont want that something changes its movement.

can i disable camera/object sliding in case of a collision ? in both ways: it shouldnt slide but stop and it will go into collision target.

Code: [Select]
r a f t

1967
Projects / tokima
« on: February 17, 2005, 03:53:45 am »
Quote from: "EgonOlsen"
As a rule of thumb: Never let any other thread than the main-thread (the thread that does the rendering) modify the camera or some object's matrices. Not the timer-thread and not an Event-Listener-thread (like a Key- or Mouse-Listener) because you may run into trouble. And it's a real pain to debug this stuff...believe me... :wink:


it is quite true that debugging a multi-threaded application is a real pain. however using timers greatly eases some tasks.

you may consider using javax.swing.Timer instead of java.util.Timer since the former is executed in awt's event dispatching thread. assuming your rendering is done in paint or paintComponent methods you end up with a thread-safe timer mechanism.

Quote
r a f t

1968
Feedback / kind of brain storming
« on: February 17, 2005, 01:37:28 am »
no, stupid enough i didnt have a look at projects page at forum. only at jpct home page

there seems to be a hidden treasure there  :D
Code: [Select]
r a f t

1969
Feedback / kind of brain storming
« on: February 16, 2005, 01:52:27 am »
hi,

as a dreamer i am trying to develop a chat system in which you may move around. maybe kind of virtual reality system at very very later phases..

well, after toying with jpct and with helge's valuable helps i am not that far from moving in a 3d world and animating characters according to their state. (walking, dancing etc)

here is what i have: a world description with node groups and nodes as leafs. users and world entities (items etc) can only exist in a node. i assumed nodes as parts (mostly rooms) of a building and node groups as buildings.

to minimize network traffic and hence to increase speed, clients are loaded with users' starting node group and its current state (user positions etc). any movement from node to node (in same group) generates a user moved event to user and a one moved event to users of that node group. moving among node groups requires loading of new group and state. (just like switching levels in an fps)

the idea behind this was to optimize network traffic (download size and game speed). downloading and generating event for all of the world both increases the initial download size and event broadcasting amount.

the mechanism is grounded on this: part of world is serialized to client at the beginning and it is reconstructed identical to server's one at client side as need arrives. (moves at node group or jump from group to group)

i planned all that with the idea of no real time graphics: with at most a static image of the node user is in.

now with a desire to fit graphics to it, i am looking for the best way to integrate it with jpct.

one idea is to map karga's nodes to a jpct world and make no change in karga's node definition. genarate 'user moved in node' events and send them to users of that node.

or use octree nodes or portal sectors mapped to karga nodes (this seems harder to implement. by the way, is there any way to define portals in 3dmax, without the need to define portals externally with exact coordinates ?) of course genarate 'user moved in node' events is necessary again.

or is there a way to define nodes as floating but not static. (position in 3d space with a radius etc.) and still generate user moved events ?

another main problem is either to make it fps like (camera at user's eye) or not (camera around user. adjusting itself's position according to user's position in the current scene)
 
this way or other it comes to problem of network speed and latency. like fps, we need to broadcast every keystroke of user (maybe some optimization is possible) to clients. with outer camera (movement with mouse clicks to destination) it can be implemented with sending only destination point. (say you are moving from one side to other side of a room, like fps it requires lots of movement events (key strokes) to be broadcasted, with outer camera only one event: destination point). does anyone imagine any user friendly way to move with mouse clicks while looking from user's eyes ?

trying to look rationally it seems to chose outer camera and movement with mouse clicks as far more reasonable. but i really wanna it like to be a first person shooter. i am asking myself contsantly, which is the point of optimal trade off ?

well thats are the main questions to answer before going any further. i am open to and in fact looking for any smart and/or efficient ideas.

Code: [Select]
r a f t
maybe it's best to try both and see what   :?:

1970
Support / visible sides
« on: February 09, 2005, 07:54:53 pm »
here is the answer (self service :idea: )

by default Config.maxPolysVisible is 4096 which does not allow any additional polies to be drawn

Code: [Select]
r a f t

1971
Support / visible sides
« on: February 09, 2005, 06:23:44 pm »
hi all,

first of all i must mention jpct really seems great :)

i am just a newbea at computer graphics and toying with it to grasp the basics.

i loaded a 3ds model and rotate the camera around it. for a model with one or two objects it is all-well. but with three, four or more objects, i couldnt manage to draw them properly. they are either not drawn or drawn half like the camera at completely different point.

first i suspected if 3dmax exporting fails. i retried it one object in 3ds file and cloning object or by reloading the file. still couldnt manage it.

stranger enough world.getVisibilityList().getSize() seems to remain constant at 4097.

what may be wrong ? below is the complete source. you may try it with any 3ds file.

Code: [Select]

import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.threed.jpct.*;

public class Test1 {
private final static SimpleVector STARTING_POS = new SimpleVector(0, 2, -150);
private final static SimpleVector CAMERA_TARGET = new SimpleVector(0, 1, 0);

private World world;
private FrameBuffer buffer;
private RenderPanel panel;
private Timer timer;

private Test1(String[] args) throws Exception {
String fileName = args[0];
float scale = args.length >= 2 ? Float.parseFloat(args[1]) : 1f;
int period = args.length >= 3 ? Integer.parseInt(args[2]) : 100;
int copies = args.length >= 4 ? Integer.parseInt(args[3]) : 3;

world = new World();

for (int i = 0; i < copies; i++) {
FileInputStream fis = new FileInputStream(args[0]);
Object3D[] os = Loader.load3DS(fis, scale);
System.out.println("loaded objects size: " + os.length + " scale: " + scale);

for (int oIndex = 0; oIndex < os.length; oIndex++) {
Object3D o = os[oIndex];
o.rotateX((float) (Math.PI / -2f)); // since 3dmax coordinate system differ
o.translate(new SimpleVector(20 * i, 20 * i, 20 * i)); // move this
world.addObject(o);
System.out.println("added object " + o.getName());

}
}

world.buildAllObjects();
Camera camera = world.getCamera();
      camera.setPosition(STARTING_POS);
camera.lookAt(CAMERA_TARGET);

buffer = new FrameBuffer(600, 400, FrameBuffer.SAMPLINGMODE_NORMAL);

JFrame frame = new JFrame("testing jpct");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

panel = new RenderPanel();
panel.setPreferredSize(new Dimension(600, 400));
panel.addMouseListener(new MouseAdapter(){
public void mouseClicked(MouseEvent e) {
if (timer.isRunning())
timer.stop();
else timer.start();
}
});

frame.add(panel);

timer = new Timer(period, new ActionListener(){
// no need to synchronize this stuff since paint and this is both called in awt's thread
public void actionPerformed(java.awt.event.ActionEvent e) {
Camera camera = world.getCamera();

SimpleVector v = camera.getPosition();
v.rotateY((float) (Math.PI / 20));
camera.setPosition(v);

camera.lookAt(CAMERA_TARGET);
panel.repaint();
}
});
timer.start();

frame.pack();
frame.setVisible(true);

System.out.println("started");
}

class RenderPanel extends JPanel {
public void paintComponent(Graphics g) {
super.paintComponent(g);
g.setColor(Color.ORANGE);

buffer.clear();
world.renderScene(buffer);
//world.draw(buffer);
world.drawWireframe(buffer, Color.ORANGE);

g.drawImage(buffer.getOutputBuffer(), 0, 0, null);
                  g.drawString("running..", 10, 15);

g.drawString("visible size: " + world.getVisibilityList().getSize(), 10, 30);
g.drawString("camera: " + world.getCamera().getPosition(), 10, 45);
}
}

public static void main(String[] args) throws Exception {
System.out.println("usage: test1 <3ds file> [scale] [update period im ms] [# copies]");

Test1 test1 = new Test1(args);
}
}


r a f t

Pages: 1 ... 130 131 [132]