What is the difference between LightMapMethod & LightMapDiffuseMethod

Software: Away3D 4.x

Mike Samuel, Newbie
Posted: 27 July 2012 09:42 PM   Total Posts: 30

While working on normal-maps / lights I came across the “LightMapDiffuseMethod(..)” as one option to be used for diffusion.

Now on my post over here How to use Lightmap Richard explained the use of “LightMapMethod”. So of course I followed those instructions and it is working create. Just wondering, if I create a material like this.

var myMaterial:TextureMatrial (..);
myMaterial.addMethod(new LightMapMethod(new BitmapTexture((new myLightMap()).bitmapData), BlendMode.MULTIPLY, false));

and once like this

var myMaterial:TextureMatrial (..);
myMaterial.diffuseMethod = new LightMapDiffuseMethod(new BitmapTexture((new liDoor()).bitmapData), BlendMode.MULTIPLY, false, null);

and applied it, the outcome (from what I can tell) is the same. So besides the extra parameter at the end of LightMapDiffuseMethod(.....), what is the difference? Is there a use-case for one, or the other?

To be clear, I do not have any trouble with either, I’m just curios / learning.

Thanx

Mike

 

 

   

Richard Olsson, Administrator
Posted: 28 July 2012 09:21 AM   Total Posts: 1192   [ # 1 ]

The diffuse method goes, as you have guessed in the diffuse slot of the material. The shader is basically composed from all the methods in the following order (focusing on just the lights, and ignoring normal mapping, shadows et c.)

- Ambient method
- Diffuse method
- Specular method
- All methods added with addMethod()

It’s a little more complicated than that, but this basic principle still stands and means that the difference between adding light mapping in the diffuse slot from adding it at the end is that the specular light will either have already been applied, or not.

So it can absolutely affect the visual output.

There are also, of course, cases where your diffuse slot is already occupied, for example by a cel shading diffuse method, and in that case you can still use light-mapping by using the standard light map method and appending it to the shader using addMethod().

   

Mike Samuel, Newbie
Posted: 28 July 2012 02:07 PM   Total Posts: 30   [ # 2 ]

ic ic, Thank you

   
   
‹‹ Gizmo

X

Away3D Forum

Member Login

Username

Password

Remember_me



X