Fog with alternativa3d 8

Posted by davidejones

Fog seems to be something that has been part of the alternativa3d 8 library for a while now but development appears to have been put on hold. Here is a quick guide on how to get started with the in built fog system that is currently “under development”.

First up visit the alternativa3d github account and grab a copy of the StandardMaterial. If you read through the code you can see various references to fog which have been commented out. Go through and uncomment any of this, then in the standardmaterial constructor we need to add a few lines to turn the fog on.

public function StandardMaterial(diffuseMap:TextureResource = null, normalMap:TextureResource = null, specularMap:TextureResource = null, glossinessMap:TextureResource = null, opacityMap:TextureResource = null) {
	super(diffuseMap, opacityMap);
	this.normalMap = normalMap;
	this.specularMap = specularMap;
	this.glossinessMap = glossinessMap;
	fogMode = FogMode.SIMPLE;
	fogNear = 40;  
	fogFar = 300;  
	fogMaxDensity = 1;  
	fogColorR = 0xCC/255;  
	fogColorG = 0xCC/255;  
	fogColorB = 0xCC/255;

Here I’ve set the fog mode to simple set some near and far values, density and color. I haven’t played with the settings too much but I’m sure you can achieve some better effects than my demo.

That’s it! Just create your scene as usual setting the standard material to your objects add a few lights to the scene and you should see the fog appear.

You can see the demo files here, I tend to use the alternativa swc then just place in the changed standard material in the folder as shown rather than download the whole github repository.

Trackback URL for this post:

Being Sociable...

  • If you like this article then please share it on your favourite social network and follow me on twitter for the latest updates

3 Responses to Fog with alternativa3d 8

  • Pingback: Alternativa3d 8 Fog! «

  • Pingback: Alternativa platform : fog, pixel material and more | Kim TASKER webgrafiks

  • Leave a Reply

    Your email address will not be published. Required fields are marked *

    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>