 |
MS FlightX, FlyingGuns and clouds in the sky
Posted by herkules on October 13, 2006 at 06:17 AM | Comments (0)
Cloud rendering in 3D games, esp. flight simulators, is not easy. Upcoming Microsoft FlightX does a brilliant job for its clouds (amongst many other brillant things) and I assume there has been more than one developer working on it for ... hours at least.
For the FlyingGuns project there are so many things to do that I never even started to think about cloud rendering. Fortunately, IndieTechnologies offers its famous particle system GenesisFX. Using genesisfx.jar, a couple of lines of code are sufficient to create clouds that look quite impressive.
There still is long way towards true clouds, but the ratio of effect/lines_of_code makes the value.
Additionally I used GenesisFX to replace some of my own fire/smoke effects for burning planes. Again, very few lines of code - very impressive result.
Now if someone out there feels inspired to create cool graphical effects in a rich environment, just drop me a line. The FlyingGuns project is constantly looking for support. All other sources can be found in the projects CVS.
/*
* Clouds.java
*/
package de.hardcode.threed.terrain;
import com.indie.genesis.j3d.CloudPuff;
import javax.media.j3d.Transform3D;
import javax.media.j3d.TransformGroup;
import javax.vecmath.Color3f;
import javax.vecmath.Vector3d;
import javax.vecmath.Vector3f;
/**
*
* @author Herkules
*/
public class Clouds extends TransformGroup
{
private final static double RADIUS = 250.0;
private final static double GROUPRADIUS = RADIUS*12.0;
private final static float MIN_BRIGHTNESS = 0.5f;
private final static float MAX_BRIGHTNESS = 0.8f;
private final static int NUM_PUFFS = 40;
private class Cloud extends TransformGroup
{
Cloud()
{
CloudPuff cloud = new CloudPuff( (float)RADIUS, getCloudColor() );
cloud.setAlignmentMode( CloudPuff.ROTATE_ABOUT_AXIS );
cloud.setAlignmentAxis( 0,1,0 );
Transform3D tx = new Transform3D();
tx.setTranslation( new Vector3d( (Math.random()-0.5)*GROUPRADIUS,
Math.random()*RADIUS,
(Math.random()-0.5)*GROUPRADIUS ) );
setTransform(tx);
addChild(cloud);
}
Color3f getCloudColor()
{
float c = ((float)Math.random() * (MAX_BRIGHTNESS - MIN_BRIGHTNESS)) + MIN_BRIGHTNESS;
return new Color3f( c,c,c );
}
}
/**
* Creates a new instance of Clouds
*/
public Clouds( float x, float z, float baseheight )
{
Transform3D tx = new Transform3D();
tx.setTranslation(new Vector3f(x, baseheight + (float)RADIUS/2.0f, z));
setTransform(tx);
for( int i =0; i
Links
Bookmark blog post: del.icio.us Digg DZone Furl Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment
|