Is this an Away3D bug or my mistake ?

Software: Away3D 4.x

SuperSam, Sr. Member
Posted: 24 April 2013 04:14 PM   Total Posts: 102

I’m almost done working on Onkba’s example, but there’s something I don’t understand.


Why does the specular method needs to be added to unrelated materials in order to work at all ? Let’s be more clear:

//create gobal specular method
_specularMethod = new FresnelSpecularMethod();
_specularMethod.normalReflectance 1.5;

// ....

_groundMaterial.specularMethod _specularMethod;
_heroMaterial.specularMethod _specularMethod;
_gunMaterial.specularMethod _specularMethod

For the ground to be affected by the specular method, we need to at least pass the method to the ground AND one of the 2 models’ material. (i.e. gun or hero, or both)

If _specularMethod is only added to the ground and none of the other meshes, the ground is NOT affected.

Why is that ?


Thanks for your help!


(I have a second question related to Onkba’s example that might have been missed, here. It’s about why that example adds lights to the scene while it doesn’t seem necessary and possibly impacts performance. Merely adding them to a LightPicker seems to provide all desired functionalities so I don’t get it ^^)

   

SuperSam, Sr. Member
Posted: 24 April 2013 05:37 PM   Total Posts: 102   [ # 1 ]

Answering myself again, but I still need to understand what’s up if someone reads this smile


Apparently, the only difference is that the ground material has a
specularMap whereas the gun and hero don’t.
For some reason (WHYYYYYYYY ! :p), the presence of a specularMap on a material disables the specularMethod if there is one. For some ODD reason, the specularMethod is reenabled if ANOTHER material also has it. Then the specularMap’ed material will also be specularMethod’ed properly.


It does sound like a bug, doesn’t it ? Either the specular method should never work on specular mapped materials or it should always work; it probably shouldn’t depend on another material sharing it.


Until this is fixed, it’s worth knowing that the specular method takes precedence over the specular map when it is active, so you in fact don’t need the map when you use a method. At least when it’s a global method shared across materials; I didn’t do tests with unshared methods.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X