Fog with alternativa3d 8

David Jones

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”. fog 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.



  • avatar-p48l0
    # P48l0
    Yeah! this is what i was trying to achieve. Thanks for posting it!
  • avatar-uv-scrolling-material-for-alternativa3d
    # UV Scrolling Material for Alternativa3D |
    […] More details here:¬† […]
  • avatar-uv-scrolling-material-for-alternativa3d
    # UV Scrolling Material for Alternativa3D |
    […] Fog with alternativa3d 8 […]

Comments are currently closed