3D swimming pool

Not actually a game at this stage, I initially started working on this project to try out some environment mapping algorithm, but I ended up modelling a whole swimming pool. (i am a big fan of swimming :D)

http://www.freewebs.com/phu004/swimmingPool.jpg

Here is a video walkthrough:

K-kBcmXgAy0

Some “advanced” features I have tried for this demo are,

  • reflective environment mapping
  • volumetric fog
  • Light mapped surface
  • image based occlusion culling.

Feel free to try the applet demo by clicking on the following link:

http://www.freewebs.com/phu004/swimmingPool.html

Controls are simple: “w a s d” for movement, arrow keys for changing view directions. If you are interested in the source code, you can grab it
from http://www.freewebs.com/phu004/SwimmingPool.jar.

Some anti-aliasing would go a long way. :slight_smile:

Nice work.

…doesn’t work with Java 6 (here at work… ;)):


java.lang.UnsupportedClassVersionError: main : Unsupported major.minor version 51.0

Looks nice, antialiasing would be good like HeroesGrave said.
Gonna make a fps swimming game? :wink:

The applet was compiled with jdk7… I have recompiled it with jdk5 so it should work for your system. Damn why i am always under the impression that people either don’t have java or have the latest version installed ???

Thanks for the nice word :slight_smile: I already used mipmap to minimize the aliasing within the texture, I have never done antialiasing on the edges, I am under the impression that it can really kill your framerate. You probably noticed a lot of seam popping up between textures, that’s caused by T-junctions, (i.e adjacent polygons that don’t share the same edge). I realized that half way through making the demo… it really makes the aliasing look a lot worse.

Short answer is No:(, currently my renderer can’t import 3d models from files, all the geometry you see in the demo is hard coded in the java files. I probably use existing APIs if I ever decide to make a FPS game.

Without an image in the first message, your project won’t get the exposure of the sidebar.

I like the lights on the wooden panels. They look very realistic.

opps, thanks for reminding me about that :smiley:

Glad you liked it :smiley: The lightmap is generated with gimp, I simply blend it with the wood texture at run time. Very cheap effect at the cost of some additional memory for storing the lightmap.

I have been trying to find a way to create anti aliased edges for my pool over the weekend. This thing is harder than i thought :’(

What I tried first is applying a 3 x 3 box filter to the pixels that are on the edges of visible polygons, it created somewhat smoothed edges, but the area where edges interests got over blurred and looks like they are out of focus.

Then I tried to apply the filter to all the pixels on the screen, it created an overall smoothed image. Although that’s not real anti aliasing, and it slows the performance quite a bit, I think it looks better than the unfiltered image. I have updated the applet, you can press “b” to enable/disable the filter.

Eventually I will have to go with the option I tried at the beginning. I will need to make a better filter (maybe assign weight to neighbor pixels based on the distance to the center pixel) and make sure the same pixel is processed exactly once by the filter.

By the way I have a question for EgonOlsen if you see this post ;D in your quake applet (http://www.jpct.net/quapplet/), What technique do you use for the anti aliasing? I noticed the it looks really good when AA option is set to 3, were you using supersampling?

Ok, I made some improvement to the anti-aliasing algorithm, now it only blurs the pixels which brightness changes sharply on either vertical or horizontal direction. This approach preserves image quality and smooth edges at the same time. Also anti aliasing is now done on a separate thread than
main thread, so it should run faster on the machines with multiple cores.

A screenshot taken at the same angle as the image in the opening post:

http://www.freewebs.com/phu004/SwimmingPool_Antialiased.jpg

Yes, jPCT uses supersampling. It supports 1.51.5 and 2.02.0 supersampling.

Nice graphics you have here! Yet, how can you process the antialiasing on a different thread? Isn’t this performed on GPU side using a shader?? (bluring on CPU side would be time-consuming)

[quote]Insert Quote
Yes, jPCT uses supersampling. It supports 1.51.5 and 2.02.0 supersampling.
[/quote]
Thanks for the clarification, no wonder it looks decent :slight_smile:

[quote]Nice graphics you have here! Yet, how can you process the antialiasing on a different thread? Isn’t this performed on GPU side using a shader?? (bluring on CPU side would be time-consuming)
[/quote]
The AA method I deployed does not depend on the geometry of the scene. Thus can be run in parallel with the rest of rasterization code. Perhaps it can be best explained by the pseudocode of the my gameloop:


while(true){
update game geometry then draw it to screenbuffer1;

while(AA thread is not idle){
mainThread.sleep(1);
}
wake the AA thread, and let it perform AA operations on screenbuffer1;  

send screenbuffer2 to video memory and call paint();
swap content of screenbuffer1 with the content of screenbuffer2;
mainThead.sleep(some milliseconds); //for maintaining steady  frame rate.
}


Although CPUs are not optimized for doing graphic calculations, you can always try to utilize all the available cores to match the speed of a GPU.

Needs some swimsuit girls.