Author Topic: Performance Questions  (Read 864 times)

Offline aZen

  • int
  • **
  • Posts: 94
    • View Profile
Performance Questions
« on: May 18, 2013, 07:00:38 pm »
Two questions:

A) Would it be possible to render only certain parts of the whole FrameBuffer in software mode? I'm updating only certain, well defined areas and would like to avoid re-rendering everything every time I do an update. I've already experimented with moving the camera, but that is extremely tricky to get right.

B) Hit testing is a performance problem for me at a certain point (when I have a lot of objects). I'm assuming you're using some kind of index for all the triangles and then doing a hit-test with the ray? I'm using http://www.jpct.net/doc/com/threed/jpct/World.html#calcMinDistanceAndObject3D%28com.threed.jpct.SimpleVector,%20com.threed.jpct.SimpleVector,%20float%29. Would it be possible/helpful to support this function with a set of possible objects or an area (using my own index)?

Thank you!

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: Performance Questions
« Reply #1 on: May 20, 2013, 08:55:23 pm »
A) Would it be possible to render only certain parts of the whole FrameBuffer in software mode? I'm updating only certain, well defined areas and would like to avoid re-rendering everything every time I do an update.
No, that's not possible and in almost every case, it's not needed and not worth the trouble. This would be possible in only some really special and rare situations anyway.

B) Hit testing is a performance problem for me at a certain point (when I have a lot of objects). I'm assuming you're using some kind of index for all the triangles and then doing a hit-test with the ray? I'm using http://www.jpct.net/doc/com/threed/jpct/World.html#calcMinDistanceAndObject3D%28com.threed.jpct.SimpleVector,%20com.threed.jpct.SimpleVector,%20float%29. Would it be possible/helpful to support this function with a set of possible objects or an area (using my own index)?
Ray-polygon tests are done only if the ray intersects and object's bounding box, which is a pretty cheap test. So as long as your objects aren't located very close to each other, these expensive tests against each polygon shouldn't happen too often. You can disable collision checks on objects that you consider to be impossible to be hit by the ray before doing the check to see if that improves things.