Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (541)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (604)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Is there any open source engine allowing to perform portal culling?  (Read 3906 times)
0 Members and 1 Guest are viewing this topic.
Offline gouessej
« Posted 2009-04-16 14:46:26 »

Hi!

I don't succeed in ending the implementation of the portal culling, especially the computation of new frustums by using the portals. I would like to look at any other open source engine written in Java that already implements this algorithm to understand how it works. JPCT allows portal rendering but it is not open source. EgonOlsen, if you read this, can you at least explain to me the different steps to project the portal onto the near plane? Xith3D does not use portal culling, JME neither (of course, I'm implementing this feature in it), 3DzzD neither Sad Is there any open source engine written in Java allowing to perform portal culling?

Offline zammbi

JGO Coder


Medals: 4



« Reply #1 - Posted 2009-04-16 14:56:29 »

You could just use JPCT, it now has the option to use your favourite JOGL  Roll Eyes
I know there are a few minor open sourced engines, but not sure if any have what you want... Ill have a basic look around.

Current project - Rename and Sort
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #2 - Posted 2009-04-16 15:01:00 »

Hi!

I don't succeed in ending the implementation of the portal culling, especially the computation of new frustums by using the portals. I would like to look at any other open source engine written in Java that already implements this algorithm to understand how it works. JPCT allows portal rendering but it is not open source. EgonOlsen, if you read this, can you at least explain to me the different steps to project the portal onto the near plane? Xith3D does not use portal culling, JME neither (of course, I'm implementing this feature in it), 3DzzD neither Sad Is there any open source engine written in Java allowing to perform portal culling?

Blogger

PM

Ta.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline zammbi

JGO Coder


Medals: 4



« Reply #3 - Posted 2009-04-16 15:03:51 »

This might have what you want: http://www.espresso3d.com/

Current project - Rename and Sort
Offline tom
« Reply #4 - Posted 2009-04-16 16:27:34 »

Don't know of an source code, but it should be fairly straight forward. Maybe we can help you threw it. The frustum is a set of planes. The portal is a convex polygon. Then you have to clip the polygon against the planes. Then you have to create a plane for each edge in the clipped polygon. This will be the new frustum that you use in the next room.

Clipping a polygon against the view frustum is a common operation in old software renderers, so there should be able to find information about it. Google for "frustum polygon clipping" or something similar.

Good luck.

edit: how to clip:
http://en.wikipedia.org/wiki/Sutherland-Hodgeman

Offline gouessej
« Reply #5 - Posted 2009-04-16 20:45:26 »

You could just use JPCT,
No as it is not open source.

it now has the option to use your favourite JOGL  Roll Eyes
It is a good piece of news for the people who push JOGL like me Cheesy

I know there are a few minor open sourced engines, but not sure if any have what you want... Ill have a basic look around.
Thank you for your help.

Good idea.

This might have what you want: http://www.espresso3d.com/
I'm watching it, it use portal culling Cheesy Excellent Cheesy

Don't know of an source code, but it should be fairly straight forward. Maybe we can help you threw it. The frustum is a set of planes. The portal is a convex polygon. Then you have to clip the polygon against the planes. Then you have to create a plane for each edge in the clipped polygon. This will be the new frustum that you use in the next room.

Clipping a polygon against the view frustum is a common operation in old software renderers, so there should be able to find information about it. Google for "frustum polygon clipping" or something similar.

Good luck.

edit: how to clip:
http://en.wikipedia.org/wiki/Sutherland-Hodgeman
Thank you very much, it is a precise explanation.

Offline gouessej
« Reply #6 - Posted 2009-04-21 18:47:12 »

Hi!

I found what was wrong in my code in the way of using the culled test and now I get the expected behavior Cheesy Thank you.

Offline gouessej
« Reply #7 - Posted 2009-05-03 15:26:28 »

It works almost fine but there is still a problem. I follow these steps:
if a portal is inside or intersects with the currently used frustum
      then
         look for its leftmost point
         look for its rightmost point
         look for its topmost point
         look for its bottommost point
         left <- max( abscissa of the leftmost point , current frustum left )
         bottom <- max( ordinate of the bottommost point , current frustum bottom )
         right <- min( abscissa of the rightmost point , current frustum right )
         top <- min( ordinate of the topmost point , current frustum top )
         sub-frustum <- copyOf( current frustum )
         sub-frustum.left = left
         sub-frustum.right = right
         sub-frustum.top = top
         sub-frustum.bottom = bottom

As my explanation might be not clear enough, please look at this article, it deals with some algorithms used in Fallout 3:
http://geck.bethsoft.com/index.php/Occlusion_Culling
My sub-frustum seems to be too small whereas I only get normalized device coordinates of the portal and I convert them into frustum coordinates. When I create a sub-frustum from the current frustum, should I change anything else than left, right, top and bottom?

Normalized device coordinates are defined in the explanation below:
Quote
Object Coordinates are transformed by the ModelView matrix to produce Eye Coordinates.

Eye Coordinates are transformed by the Projection matrix to produce Clip Coordinates.

Clip Coordinate X, Y, and Z are divided by Clip Coordinate W to produce Normalized Device Coordinates.

Normalized Device Coordinates are scaled and translated by the viewport parameters to produce Window Coordinates.

Offline tom
« Reply #8 - Posted 2009-05-04 10:17:30 »

I guess you have to multiply x, y, z with w and then multiply that point with the inverse of the projection matrix.

Although I think you are making it difficult for yourself. I think it would be easier to do everything in world space. Also don't get hung up on "frustum" word in the article. A frustum is just a set of plane. Don't use frustum culling in your algorithm. Write your own culling that starts off with the frustum planes. Just my opinion.

Offline gouessej
« Reply #9 - Posted 2009-05-04 11:10:55 »

I guess you have to multiply x, y, z with w and then multiply that point with the inverse of the projection matrix.
If I do this, I will get the eye coordinates according to the FAQ of OpenGL, won't I?

Although I think you are making it difficult for yourself. I think it would be easier to do everything in world space. Also don't get hung up on "frustum" word in the article. A frustum is just a set of plane. Don't use frustum culling in your algorithm. Write your own culling that starts off with the frustum planes. Just my opinion.
I have to implement the portal culling as smartly as I can by using existing features of JME 2.0 when it is possible. If I write my own culling, I will compute the frustum planes whereas they are already computed in an object of JME 2.0. I have succeeded in using the frustum culling of JME, it is not the problem and the result is already interesting (the blue print is at least between 2 and 4 times faster now) but when I try to create my own frusta, it does not work anymore. I have already spent some months on it, I cannot restart from scratch whereas 95% of the source code is reliable (it does what it is expected to do)  Undecided

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline gouessej
« Reply #10 - Posted 2009-05-04 11:20:54 »

I guess you have to multiply x, y, z with w and then multiply that point with the inverse of the projection matrix.
You have just given me an interesting idea... Maybe I should rather use the clip coordinates instead of the normalized device coordinates and then apply some transformations by using the frustum parameters to get the "frustum" coordinates. I will try this when I'm back home.

Pages: [1]
  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.

Mr.CodeIt (12 views)
2014-12-27 04:03:04

TheDudeFromCI (16 views)
2014-12-27 02:14:49

Mr.CodeIt (25 views)
2014-12-23 03:34:11

rwatson462 (56 views)
2014-12-15 09:26:44

Mr.CodeIt (46 views)
2014-12-14 19:50:38

BurntPizza (92 views)
2014-12-09 22:41:13

BurntPizza (113 views)
2014-12-08 04:46:31

JscottyBieshaar (86 views)
2014-12-05 12:39:02

SHC (96 views)
2014-12-03 16:27:13

CopyableCougar4 (102 views)
2014-11-29 21:32:03
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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